Add `BigInt64Array` and `BigUint64Array` tests (#27920)
diff --git a/FileAPI/blob/Blob-constructor.any.js b/FileAPI/blob/Blob-constructor.any.js
index 6c34d7e..d16f760 100644
--- a/FileAPI/blob/Blob-constructor.any.js
+++ b/FileAPI/blob/Blob-constructor.any.js
@@ -311,7 +311,16 @@
desc: "Passing a Float64Array as element of the blobParts array should work."
});
-
+test_blob(function() {
+ return new Blob([
+ new BigInt64Array([BigInt("0x5353415053534150")]),
+ new BigUint64Array([BigInt("0x5353415053534150")])
+ ]);
+}, {
+ expected: "PASSPASSPASSPASS",
+ type: "",
+ desc: "Passing BigInt typed arrays as elements of the blobParts array should work."
+});
var t_ports = async_test("Passing a FrozenArray as the blobParts array should work (FrozenArray<MessagePort>).");
t_ports.step(function() {
diff --git a/encoding/encodeInto.any.js b/encoding/encodeInto.any.js
index eca0e1b..69d7089 100644
--- a/encoding/encodeInto.any.js
+++ b/encoding/encodeInto.any.js
@@ -120,19 +120,22 @@
});
});
-[DataView,
- Int8Array,
- Int16Array,
- Int32Array,
- Uint16Array,
- Uint32Array,
- Uint8ClampedArray,
- Float32Array,
- Float64Array].forEach(view => {
+["DataView",
+ "Int8Array",
+ "Int16Array",
+ "Int32Array",
+ "Uint16Array",
+ "Uint32Array",
+ "Uint8ClampedArray",
+ "BigInt64Array",
+ "BigUint64Array",
+ "Float32Array",
+ "Float64Array"].forEach(type => {
["ArrayBuffer", "SharedArrayBuffer"].forEach((arrayBufferOrSharedArrayBuffer) => {
test(() => {
- assert_throws_js(TypeError, () => new TextEncoder().encodeInto("", new view(createBuffer(arrayBufferOrSharedArrayBuffer, 0))));
- }, "Invalid encodeInto() destination: " + view.name + ", backed by: " + arrayBufferOrSharedArrayBuffer);
+ const viewInstance = new self[type](createBuffer(arrayBufferOrSharedArrayBuffer, 0));
+ assert_throws_js(TypeError, () => new TextEncoder().encodeInto("", viewInstance));
+ }, "Invalid encodeInto() destination: " + type + ", backed by: " + arrayBufferOrSharedArrayBuffer);
});
});
diff --git a/fetch/api/response/response-clone.any.js b/fetch/api/response/response-clone.any.js
index 7cc8f20..9f4f36e 100644
--- a/fetch/api/response/response-clone.any.js
+++ b/fetch/api/response/response-clone.any.js
@@ -119,6 +119,8 @@
testReadableStreamClone(new Uint8ClampedArray(arrayBuffer), "Uint8ClampedArray");
testReadableStreamClone(new Uint16Array(arrayBuffer, 2), "Uint16Array");
testReadableStreamClone(new Uint32Array(arrayBuffer), "Uint32Array");
+testReadableStreamClone(typeof BigInt64Array === "function" ? new BigInt64Array(arrayBuffer) : undefined, "BigInt64Array");
+testReadableStreamClone(typeof BigUint64Array === "function" ? new BigUint64Array(arrayBuffer) : undefined, "BigUint64Array");
testReadableStreamClone(new Float32Array(arrayBuffer), "Float32Array");
testReadableStreamClone(new Float64Array(arrayBuffer), "Float64Array");
testReadableStreamClone(new DataView(arrayBuffer, 2, 8), "DataView");
diff --git a/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/test-incrementer.js b/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/test-incrementer.js
index 2bdd2ba..9c3fb81 100644
--- a/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/test-incrementer.js
+++ b/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/test-incrementer.js
@@ -15,30 +15,37 @@
}
};
+self.maybeBigInt = (view, value) => {
+ if (view.constructor.name === "BigInt64Array" || view.constructor.name === "BigUint64Array") {
+ return BigInt(value);
+ }
+ return value;
+};
+
self.testSharingViaIncrementerScript = (t, whereToListen, whereToListenLabel, whereToSend, whereToSendLabel, origin, type = "Int32Array") => {
return new Promise(resolve => {
const sab = new SharedArrayBuffer(8);
const view = new self[type](sab);
- setViewValue(view, 0, 1);
+ setViewValue(view, 0, maybeBigInt(view, 1));
whereToListen.onmessage = t.step_func(({ data }) => {
switch (data.message) {
case "initial payload received": {
- assert_equals(data.value, 1, `The ${whereToSendLabel} must see the same value in the SharedArrayBuffer`);
+ assert_equals(data.value, maybeBigInt(view, 1), `The ${whereToSendLabel} must see the same value in the SharedArrayBuffer`);
break;
}
case "changed to 2": {
- assert_equals(getViewValue(view, 0), 2, `The ${whereToListenLabel} must see changes made in the ${whereToSendLabel}`);
+ assert_equals(getViewValue(view, 0), maybeBigInt(view, 2), `The ${whereToListenLabel} must see changes made in the ${whereToSendLabel}`);
- setViewValue(view, 0, 3);
+ setViewValue(view, 0, maybeBigInt(view, 3));
whereToSend.postMessage({ message: "changed to 3" }, origin);
break;
}
case "changed to 3 received": {
- assert_equals(data.value, 3, `The ${whereToSendLabel} must see changes made in the ${whereToListenLabel}`);
+ assert_equals(data.value, maybeBigInt(view, 3), `The ${whereToSendLabel} must see changes made in the ${whereToListenLabel}`);
resolve();
break;
}
@@ -57,7 +64,7 @@
view = data.view;
whereToSendBackTo.postMessage({ message: "initial payload received", value: getViewValue(view, 0) }, origin);
- setViewValue(view, 0, 2);
+ setViewValue(view, 0, maybeBigInt(view, 2));
whereToSendBackTo.postMessage({ message: "changed to 2" }, origin);
break;
diff --git a/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.https.html b/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.https.html
index 4b86f9b..c9b41d0 100644
--- a/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.https.html
+++ b/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.https.html
@@ -21,6 +21,8 @@
"Uint16Array",
"Int32Array",
"Uint32Array",
+ "BigInt64Array",
+ "BigUint64Array",
"Float32Array",
"Float64Array"
].forEach(type => {
diff --git a/resources/idlharness.js b/resources/idlharness.js
index 6aec02e..d81693d 100644
--- a/resources/idlharness.js
+++ b/resources/idlharness.js
@@ -564,6 +564,8 @@
case "Uint16Array":
case "Uint32Array":
case "Uint8ClampedArray":
+ case "BigInt64Array":
+ case "BigUint64Array":
case "Float32Array":
case "Float64Array":
case "ArrayBuffer":
diff --git a/resources/test/tests/unit/IdlArray/is_json_type.html b/resources/test/tests/unit/IdlArray/is_json_type.html
index bd89c91..18e83a8 100644
--- a/resources/test/tests/unit/IdlArray/is_json_type.html
+++ b/resources/test/tests/unit/IdlArray/is_json_type.html
@@ -37,7 +37,10 @@
assert_false(idl.is_json_type(typeFrom("Uint16Array")));
assert_false(idl.is_json_type(typeFrom("Uint32Array")));
assert_false(idl.is_json_type(typeFrom("Uint8ClampedArray")));
+ assert_false(idl.is_json_type(typeFrom("BigInt64Array")));
+ assert_false(idl.is_json_type(typeFrom("BigUint64Array")));
assert_false(idl.is_json_type(typeFrom("Float32Array")));
+ assert_false(idl.is_json_type(typeFrom("Float64Array")));
assert_false(idl.is_json_type(typeFrom("ArrayBuffer")));
assert_false(idl.is_json_type(typeFrom("DataView")));
}, 'should return false for all buffer source types');
diff --git a/xhr/send-data-sharedarraybuffer.any.js b/xhr/send-data-sharedarraybuffer.any.js
index 912f622..79774c3 100644
--- a/xhr/send-data-sharedarraybuffer.any.js
+++ b/xhr/send-data-sharedarraybuffer.any.js
@@ -12,7 +12,8 @@
}, "sending a SharedArrayBuffer");
["Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array",
- "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "DataView"].forEach((type) => {
+ "Int32Array", "Uint32Array", "BigInt64Array", "BigUint64Array",
+ "Float32Array", "Float64Array", "DataView"].forEach((type) => {
test(() => {
const xhr = new XMLHttpRequest();
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`