mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 1721302 [wpt PR 29713] - webcrypto: merge tentative BigInt test into main, a=testonly
Automatic update from web-platform-tests webcrypto: merge tentative BigInt test into main (#29713) -- wpt-commits: cdd0f03df41b222aed098fbbb11c6a3cc500a86b wpt-pr: 29713
This commit is contained in:
parent
67c90f68c3
commit
2b08763d1b
@ -1,26 +0,0 @@
|
||||
// Tentative: see https://github.com/w3c/webcrypto/issues/255
|
||||
|
||||
const arrays = [
|
||||
'BigInt64Array',
|
||||
'BigUint64Array',
|
||||
];
|
||||
|
||||
for (const array of arrays) {
|
||||
const ctor = globalThis[array];
|
||||
|
||||
test(function() {
|
||||
assert_equals(self.crypto.getRandomValues(new ctor(8)).constructor,
|
||||
ctor, "crypto.getRandomValues(new " + array + "(8))")
|
||||
}, "Integer array: " + array);
|
||||
|
||||
test(function() {
|
||||
const maxlength = 65536 / ctor.BYTES_PER_ELEMENT;
|
||||
assert_throws_dom("QuotaExceededError", function() {
|
||||
self.crypto.getRandomValues(new ctor(maxlength + 1))
|
||||
}, "crypto.getRandomValues length over 65536")
|
||||
}, "Large length: " + array);
|
||||
|
||||
test(function() {
|
||||
assert_true(self.crypto.getRandomValues(new ctor(0)).length == 0)
|
||||
}, "Null arrays: " + array);
|
||||
}
|
@ -15,34 +15,34 @@ test(function() {
|
||||
}, "Float64Array (too long)")
|
||||
}, "Float arrays")
|
||||
|
||||
var arrays = {
|
||||
'Int8Array': Int8Array,
|
||||
'Int16Array': Int16Array,
|
||||
'Int32Array': Int32Array,
|
||||
'Uint8Array': Uint8Array,
|
||||
'Uint8ClampedArray': Uint8ClampedArray,
|
||||
'Uint16Array': Uint16Array,
|
||||
'Uint32Array': Uint32Array,
|
||||
};
|
||||
const arrays = [
|
||||
'Int8Array',
|
||||
'Int16Array',
|
||||
'Int32Array',
|
||||
'BigInt64Array',
|
||||
'Uint8Array',
|
||||
'Uint8ClampedArray',
|
||||
'Uint16Array',
|
||||
'Uint32Array',
|
||||
'BigUint64Array',
|
||||
];
|
||||
|
||||
test(function() {
|
||||
for (var array in arrays) {
|
||||
assert_equals(self.crypto.getRandomValues(new arrays[array](8)).constructor,
|
||||
arrays[array], "crypto.getRandomValues(new " + array + "(8))")
|
||||
}
|
||||
}, "Integer array")
|
||||
for (const array of arrays) {
|
||||
const ctor = globalThis[array];
|
||||
|
||||
test(function() {
|
||||
for (var array in arrays) {
|
||||
var maxlength = 65536 / (arrays[array].BYTES_PER_ELEMENT);
|
||||
test(function() {
|
||||
assert_equals(self.crypto.getRandomValues(new ctor(8)).constructor,
|
||||
ctor, "crypto.getRandomValues(new " + array + "(8))")
|
||||
}, "Integer array: " + array);
|
||||
|
||||
test(function() {
|
||||
const maxlength = 65536 / ctor.BYTES_PER_ELEMENT;
|
||||
assert_throws_dom("QuotaExceededError", function() {
|
||||
self.crypto.getRandomValues(new arrays[array](maxlength + 1))
|
||||
self.crypto.getRandomValues(new ctor(maxlength + 1))
|
||||
}, "crypto.getRandomValues length over 65536")
|
||||
}
|
||||
}, "Large length")
|
||||
}, "Large length: " + array);
|
||||
|
||||
test(function() {
|
||||
for (var array in arrays) {
|
||||
assert_true(self.crypto.getRandomValues(new arrays[array](0)).length == 0)
|
||||
}
|
||||
}, "Null arrays")
|
||||
test(function() {
|
||||
assert_true(self.crypto.getRandomValues(new ctor(0)).length == 0)
|
||||
}, "Null arrays: " + array);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user