Closed Bug 1233040 Opened 9 years ago Closed 8 years ago

ArrayBuffer.prototype.slice does not respect subclassing

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1165053

People

(Reporter: lth, Assigned: mrrrgn)

References

(Blocks 1 open bug)

Details

Consider:

Also see bug 1233011, bug 1232966 for analogous cases for SharedArrayBuffer and references to (currently pending) test cases.

class MySub extends ArrayBuffer { constructor(n) { super(n) } }
var m = new MySub(10)
m.byteLength             // 10
m instanceof ArrayBuffer // true
m instanceof MySub       // true
var xx = m.slice(0,5)
xx instanceof MySub      // ***false***

Almost certainly that last one should be true, cf ES6 24.1.4.3, steps 13 and 15, which will use SpeciesConstructor to pick up a constructor that is appropriate to the "this" object, which is a MySub.
Blocks: es6
A dup of part 11 of the monster bug :arai is working on.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Groan, 1165052 is about Array (only), not ArrayBuffer.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
See Also: → 1165053
Depends on: 1165053
See Also: 1165053
Assignee: nobody → winter2718
apparently fixed by bug 1165053, and the testcase in comment #0 returns true now.

also, there are some more testcases about subclassing added by the patch there, so I think we can just close this bug.
https://hg.mozilla.org/mozilla-central/rev/35e1fd91ca89
Status: REOPENED → RESOLVED
Closed: 9 years ago8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.