Closed Bug 1168260 Opened 9 years ago Closed 8 years ago

Promise constructor methods should not be enumerable

Categories

(Core :: JavaScript: Standard Library, defect)

41 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: ljharb, Assigned: evilpie)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3

Steps to reproduce:

`Object.keys(Promise).length === 0 && !['resolve', 'reject', 'all', 'race'].map(k => Promise.propertyIsEnumerable(k)).some(Boolean)`


Actual results:

`false`


Expected results:

`true`
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
As of today, Promises in Firefox are implemented on the DOM side, not in JS.
Component: JavaScript Engine → DOM
We could add something in Web IDL to make things non-enumerable.... or we could just wait until SpiderMonkey in fact implements promises like it should.  Unless there's an urgent need to fix this, I would rather just do the latter.

That said, Cameron, are there any plans to add a way to annotate things as non-enumerable in IDL?
Status: UNCONFIRMED → NEW
Depends on: 911216
Ever confirmed: true
Flags: needinfo?(cam)
(In reply to Not doing reviews right now from comment #2)
> That said, Cameron, are there any plans to add a way to annotate things as
> non-enumerable in IDL?

No plans to add this currently.  Of course, that doesn't need to affect whether we support such a way in our bindings so that we can fix these Promise methods.
Flags: needinfo?(cam)
This bug was filed for constructor methods, but the exact same issue exists for instance methods:

    Object.keys(Promise.prototype).length // should be 0, is currently 2
Yes, it's the exact same issue.  The difference between ES6 builtins and web platform builtins in this regard is quite vexing.
No longer blocks: es6
Fixed with bug 911216:

js> Object.keys(Promise.prototype).length
0
js> Object.keys(Promise).length           
0
Component: DOM → JavaScript: Standard Library
Assignee: nobody → evilpies
Why is this bug (and bug 1237762) still open?
Attachment #8778172 - Flags: review?(till)
Comment on attachment 8778172 [details] [diff] [review]
Test: Promise methods are not enumerable

Review of attachment 8778172 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you.
Attachment #8778172 - Flags: review?(till) → review+
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ab210b9e2172
Test: Promise methods should not be enumerable. r=till
https://hg.mozilla.org/mozilla-central/rev/ab210b9e2172
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: