Closed Bug 973988 Opened 10 years ago Closed 10 years ago

DOM Promise constructor should call the executor with `undefined` as thisArg

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: bbenvie, Assigned: wchen)

Details

Attachments

(1 file)

> "use strict";
> new Promise(() => assert(this === undefined));

Currently this test fails in our implementation. |this| in the executor is the new Promise object itself, rather than undefined.

See ES6 spec draft January 2014 revision section 25.4.3.1.1 InitialisePromise, step 8.
'this' in an arrow function doesn't work how you think it works.
Woops, my example was incorrect but what I said is right:

> new Promise(function(){ console.log(this) }); // [object Promise]
William, can you take a look please?
Flags: needinfo?(wchen)
Looking into it.
Assignee: nobody → wchen
Flags: needinfo?(wchen)
Comment on attachment 8377951 [details] [diff] [review]
DOM Promise constructor should call the executor with "undefined" as thisArg

r=me assuming the spec is clear on this and whatnot.
Attachment #8377951 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/5c6b2dcd79eb
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: