Closed
Bug 1062075
Opened 10 years ago
Closed 9 years ago
Throw for ES6 built-in constructors called without `new`
Categories
(Core :: JavaScript: Standard Library, defect)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
People
(Reporter: 446240525, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete, meta, site-compat, Whiteboard: [DocArea=JS])
js> Map()
({}) // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-iterable steps 1-2
js> Set()
({}) // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-iterable steps 1-2
js> WeakMap()
({}) // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap-iterable steps 1-2
js> ArrayBuffer()
({}) // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraybuffer-length steps 1-2
js> DataView(ArrayBuffer())
({}) // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-dataview-buffer-byteoffset-bytelength steps 1-2
According to the spec, these should all throw an exception like Promise does
devtools>Promise()
TypeError: Constructor Promise requires 'new'
The discussion thread is here: http://esdiscuss.org/topic/promise-vs-new-promise
Comment 1•10 years ago
|
||
There is bug 980945 for typed arrays specifically, but we don't yet have a tracking bug for this. Turning this into one.
Updated•10 years ago
|
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
Updated•10 years ago
|
Keywords: site-compat
Comment 2•9 years ago
|
||
I think we are done here.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment 3•9 years ago
|
||
Added a note to https://www.fxsitecompat.com/en-US/docs/2015/calling-typed-array-constructors-without-new-will-throw/
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•