Closed
Bug 915669
Opened 11 years ago
Closed 11 years ago
Make array methods use `this.constructor` when operating on any exotic array
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 911135
People
(Reporter: d, Unassigned)
References
()
Details
User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release) Build ID: 20130814063812 Steps to reproduce: Per the latest ES6 spec, all array methods that create new arrays (e.g. map, filter, ...) include clauses that basically boil down to: "if `this` is an exotic array object, construct the return value by doing `new this.constructor(0)`." Currently this does not matter, because there is only one way to create exotic array objects: namely, creating arrays. But once bug #838540 is implemented, you will be able to create them by subclassing Array, or even with code like function X() { } X.__proto__ = Array; X.prototype = Object.create(Array.prototype); var x = new X(); x.filter(a => true) instanceof X; // should be true
Reporter | ||
Updated•11 years ago
|
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•11 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•