Throw for ES6 built-in constructors called without `new`

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: 446240525, Unassigned)

Tracking

(Blocks 1 bug, {dev-doc-complete, meta, site-compat})

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [DocArea=JS])

(Reporter)

Description

5 years ago
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
There is bug 980945 for typed arrays specifically, but we don't yet have a tracking bug for this. Turning this into one.
Blocks: es6
Status: UNCONFIRMED → NEW
Depends on: 980945
Ever confirmed: true
Keywords: meta
Summary: New built-in constructors in ES6 cannot be called without `new` → Throw for ES6 built-in constructors called without `new`
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
Depends on: 1108930
Depends on: 1108965
Depends on: 1142279
Depends on: 1214936
I think we are done here.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.