Closed
Bug 982671
Opened 12 years ago
Closed 11 years ago
Promise subclasses throw on construction
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jakea, Unassigned)
References
Details
(Whiteboard: [bugday-20140317])
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
Steps to reproduce:
http://jsbin.com/noloz/2/edit?js,console & press run.
Actual results:
TypeError: Constructor Promise requires 'new'
Expected results:
"It worked!"
Updated•12 years ago
|
Component: Untriaged → DOM
OS: Mac OS X → All
Product: Firefox → Core
Whiteboard: [bugday-20140317]
Comment 1•12 years ago
|
||
Hmm. So this behavior changed in bug 916644.
Before that, the line "Promise.apply(this, arguments);" created a new Promise and then threw it away. The return value of the constructor was not in fact a Promise object (and the exception that got thrown was "TypeError: 'then' called on an object that does not implement interface Promise. (line 23)".
Now calling the constructor as a function will throw, at least in non-release builds, instead of doing something totally unexpected. Note that Chrome has the same behavior.
And the real upshot here is that we don't support ES6 subclassing at all yet; there is no @@create support. That's bug 838540 (of which this may well be a duplicate).
Depends on: 838540
Comment 2•12 years ago
|
||
> at least in non-release builds,
Er, in release builds too, in this case, starting with Firefox 30.
Comment 3•11 years ago
|
||
Marking this invalid; per current ES6 spec this code should not work, afaict.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•