Closed Bug 1233011 Opened 4 years ago Closed 4 years ago

Subclassing SharedArrayBuffer does not work properly

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Consider:

class C1 extends ArrayBuffer {
  constructor(n) { super(n) }
}
var c1 = new C1(10);
c1 instanceof ArrayBuffer // true
c1 instanceof C1          // true

But then:

class C2 extends SharedArrayBuffer {
  constructor(n) { super(n) }
}
var c1 = new C2(10);
c1 instanceof SharedArrayBuffer // true
c1 instanceof C2                // ***false***

Probably just needs a small adjustment somewhere.
A number of test cases for this will land with bug 1232966 in jit-test/tests/sharedbuf/methods.js but could usefully be broken out and/or generalized when we fix the present bug.
See Also: → 1233040
Copied from the ArrayBuffer case.  Plus test cases.
Attachment #8698982 - Flags: review?(efaustbmo)
Comment on attachment 8698982 [details] [diff] [review]
SharedArrayBuffer subclassing + tests

Review of attachment 8698982 [details] [diff] [review]:
-----------------------------------------------------------------

Looks perfect. If it's a cargo-cult, it's a very well understood one :P
Attachment #8698982 - Flags: review?(efaustbmo) → review+
For extra credit, you can even add testBuiltin(SharedArrayBuffer) to tests/ecma_6/Class/extendBuiltinConstructors.js, if you want, though the current test coverage is sufficient.
https://hg.mozilla.org/mozilla-central/rev/70cfa74485fd
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Note, this change was incomplete, we also need a SpeciesConstructor thingie.  See bug 1314564.
You need to log in before you can comment on or make changes to this bug.