This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21427 - Futures: use thenable
Summary: Futures: use thenable
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-28 18:00 UTC by Anne
Modified: 2013-03-28 18:56 UTC (History)
3 users (show)

See Also:


Attachments

Description Anne 2013-03-28 18:00:06 UTC
In http://dom.spec.whatwg.org/#concept-resolver-resolve add this for when the branding check fails:

* Let /then/ be null.
* If /value/ is a JavaScript object, set /then/ to the result of invoking /value/'s [[Get]] internal method for "then".
* If that throws an exception, invoke resolver's reject with the thrown exception and terminate steps.
* If [[IsCallable]] /then/, run substeps: ... setup callbacks and invoke /then/.

Now because this change resolver's resolvers can be invoked several times. So http://dom.spec.whatwg.org/#concept-resolver needs to account for that by checking and setting the resolved flag.

(Now we could see if there's some additional refactoring possible and we could even do away with the branding check altogether, but changing that would complicate the definition of then().)
Comment 1 Domenic Denicola 2013-03-28 18:31:46 UTC
> Now because this change resolver's resolvers can be invoked several times.

This is already true, I think, because of future initialization. E.g.

  new Future(({ resolve, reject }) => {
    resolve(1);
    throw 2;
  });
Comment 2 Anne 2013-03-28 18:56:01 UTC
https://github.com/whatwg/dom/commit/77c556982412383cf27653bbbeb41c620aee62ee

Thanks, sorry about raising stress levels. Just doing my best ;-)