Bug 1885337 - Part 3: Import tests from test262 PR. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / prs / 3994 / built-ins / Uint8Array / fromHex / ignores-receiver.js
blob421a0278d74bd7f617f4b8e8338c235f4d1f744e
1 // |reftest| shell-option(--enable-uint8array-base64) skip-if(!Uint8Array.fromBase64||!xulRuntime.shell) -- uint8array-base64 is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 Kevin Gibbons. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-uint8array.fromhex
6 description: Uint8Array.fromHex ignores its receiver
7 features: [uint8array-base64, TypedArray]
8 ---*/
10 var fromHex = Uint8Array.fromHex;
11 var noReceiver = fromHex("aa");
12 assert.sameValue(Object.getPrototypeOf(noReceiver), Uint8Array.prototype);
14 class Subclass extends Uint8Array {
15   constructor() {
16     throw new Test262Error("subclass constructor called");
17   }
19 var fromSubclass = Subclass.fromHex("aa");
20 assert.sameValue(Object.getPrototypeOf(fromSubclass), Uint8Array.prototype);
22 reportCompare(0, 0);