mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 05:08:36 +02:00
Automatic update from web-platform-tests
Replace some assert_throws("Something", stuff) calls with assert_throws_dom. (#21377)
This diff was generated by running:
find . -type f -print0 | xargs -0 perl -pi -e 'BEGIN { $/ = undef; } s/assert_throws\(([ \n]*"[A-Za-z_]*") *(, *.)/assert_throws_dom(\1\2/gs'
followed by a fix to
xhr/resources/send-after-setting-document-domain-window-helper.js to make
xhr/send-after-setting-document-domain.htm pass.
This does affect indentation poorly in cases when the first arg was on the same
line as the assert_throws, there was a newline after the ',' after the first
arg, and the following args were lined up with the first arg. Fixing that,
especially when there are multiple lines after the first arg, is not trivial
with a regexp.
Co-authored-by: Boris Zbarsky <bzbarsky@mit.edu>
--
wpt-commits: 3696f2233a37437896505b7187968aa605be9255
wpt-pr: 21377
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
// Step 1.
|
|
test(function() {
|
|
assert_throws_dom("TypeMismatchError", function() {
|
|
self.crypto.getRandomValues(new Float32Array(6))
|
|
}, "Float32Array")
|
|
assert_throws_dom("TypeMismatchError", function() {
|
|
self.crypto.getRandomValues(new Float64Array(6))
|
|
}, "Float64Array")
|
|
|
|
assert_throws_dom("TypeMismatchError", function() {
|
|
self.crypto.getRandomValues(new Float32Array(65537))
|
|
}, "Float32Array (too long)")
|
|
assert_throws_dom("TypeMismatchError", function() {
|
|
self.crypto.getRandomValues(new Float64Array(65537))
|
|
}, "Float64Array (too long)")
|
|
}, "Float arrays")
|
|
|
|
var arrays = {
|
|
'Int8Array': Int8Array,
|
|
'Int16Array': Int16Array,
|
|
'Int32Array': Int32Array,
|
|
'Uint8Array': Uint8Array,
|
|
'Uint8ClampedArray': Uint8ClampedArray,
|
|
'Uint16Array': Uint16Array,
|
|
'Uint32Array': Uint32Array,
|
|
};
|
|
|
|
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")
|
|
|
|
test(function() {
|
|
for (var array in arrays) {
|
|
var maxlength = 65536 / (arrays[array].BYTES_PER_ELEMENT);
|
|
assert_throws_dom("QuotaExceededError", function() {
|
|
self.crypto.getRandomValues(new arrays[array](maxlength + 1))
|
|
}, "crypto.getRandomValues length over 65536")
|
|
}
|
|
}, "Large length")
|
|
|
|
test(function() {
|
|
for (var array in arrays) {
|
|
assert_true(self.crypto.getRandomValues(new arrays[array](0)).length == 0)
|
|
}
|
|
}, "Null arrays")
|