You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6. If result.[[ContentType]] ≠ exemplar.[[ContentType]], throw a TypeError exception.
For example, this should print Checked content type instead of Missing content type check:
classTypedArrayextendsUint32Array{staticget[Symbol.species](){returnBigUint64Array;}}try{newTypedArray().filter(()=>{});console.log("Missing content type check");}catch{console.log("Checked content type");}
This is because Uint32Array is of type Number, whereas BigUint64Array is of type BigInt, which should throw as per the specification above.
However, there are no test cases for this. Both V8 and SpiderMonkey print Missing content type check, whereas JavaScriptCore throws and thus prints Checked content type:
if(@typedArrayContentType(this)!== @typedArrayContentType(result))
@throwTypeError("TypedArray.prototype.filter constructed typed array of different content type from |this|");
In TypedArraySpeciesCreate, it says:
For example, this should print
Checked content type
instead ofMissing content type check
:This is because
Uint32Array
is of typeNumber
, whereasBigUint64Array
is of typeBigInt
, which should throw as per the specification above.However, there are no test cases for this. Both V8 and SpiderMonkey print
Missing content type check
, whereas JavaScriptCore throws and thus printsChecked content type
:Source: https://github.com/WebKit/WebKit/blob/075023a72c83201aca70a9c2238a5886300f501b/Source/JavaScriptCore/builtins/TypedArrayPrototype.js#L370-L371
Note that this should also happen for
map
,slice
andsubarray
, I just happened to usefilter
for the example.The text was updated successfully, but these errors were encountered: