зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1718914 [wpt PR 27920] - Add `BigInt64Array` and `BigUint64Array` tests, a=testonly
Automatic update from web-platform-tests Add `BigInt64Array` and `BigUint64Array` tests (#27920) -- wpt-commits: 3ccab5e25f082e8d055aef70b692a98786b9a9f2 wpt-pr: 27920
This commit is contained in:
Родитель
d4f7d0a8f9
Коммит
5e1158fbff
|
@ -311,7 +311,16 @@ test_blob(function() {
|
|||
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() {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ testReadableStreamClone(new Uint8Array(arrayBuffer), "Uint8Array");
|
|||
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");
|
||||
|
|
|
@ -15,30 +15,37 @@ self.setViewValue = (view, index, value) => {
|
|||
}
|
||||
};
|
||||
|
||||
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 @@ self.setupDestinationIncrementer = (whereToListen, whereToSendBackTo, origin) =>
|
|||
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;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
"Uint16Array",
|
||||
"Int32Array",
|
||||
"Uint32Array",
|
||||
"BigInt64Array",
|
||||
"BigUint64Array",
|
||||
"Float32Array",
|
||||
"Float64Array"
|
||||
].forEach(type => {
|
||||
|
|
|
@ -564,6 +564,8 @@ IdlArray.prototype.is_json_type = function(type)
|
|||
case "Uint16Array":
|
||||
case "Uint32Array":
|
||||
case "Uint8ClampedArray":
|
||||
case "BigInt64Array":
|
||||
case "BigUint64Array":
|
||||
case "Float32Array":
|
||||
case "Float64Array":
|
||||
case "ArrayBuffer":
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -12,7 +12,8 @@ test(() => {
|
|||
}, "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()`
|
||||
|
|
Загрузка…
Ссылка в новой задаче