Bug 1610938 [wpt PR 21354] - Replace some "assert_throws(new FooError(), stuff)" calls with assert_throws_js, a=testonly

Automatic update from web-platform-tests
Replace some "assert_throws(new FooError(), stuff)" calls with assert_throws_js. (#21354)

This diff was generated by running:

  find . -type f -print0 | xargs -0 perl -pi -e 'BEGIN { $/ = undef; } s/assert_throws\(([ \n]*)new ([A-Za-z]*Error) *\(\) *(, *.)/assert_throws_js(\1\2\3/gs'

and then:

1) Manually adjusting fullscreen/rendering/fullscreen-pseudo-class-support.html
to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS
SyntaxError).

2) Manually adjusting performance-timeline/po-observe-type.any.js to test for
the right sort of exceptions ("SyntaxError" DOMException, not a JS
SyntaxError).

3) Manually adjusting performance-timeline/po-observe.any.js to test for
the right sort of exceptions ("SyntaxError" DOMException, not a JS
SyntaxError).

4) Manually adjusting user-timing/mark_exceptions.html to test for the right
sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError).

5) Manually adjusting user-timing/measure_syntax_err.any.js to test for the right
sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError).

6) Manually adjusting domxpath/lexical-structure.html to test for a
"SyntaxError" DOMException, since that's what all browsers throw and there is no
clear spec for this.

7) Manually adjusting workers/constructors/Worker/Worker-constructor.html to
test for the right sort of exceptions ("SyntaxError" DOMException, not a JS
SyntaxError).

8) Backing out the changes to resources/idlharness.js because some tests pass
objects from a different window to it, and we end up with the wrong TypeError
constructor in those cases.

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>
Co-authored-by: Stephen McGruer <smcgruer@chromium.org>

--

wpt-commits: 2c5c3c4c27d27a419c1fdba3e9879c2d22037074
wpt-pr: 21354
This commit is contained in:
Stephen McGruer 2020-01-23 22:56:35 +00:00 committed by moz-wptsync-bot
parent 36da211367
commit c67612824c
426 changed files with 2060 additions and 2060 deletions

View File

@ -19,121 +19,121 @@
var t = async_test("Missing arguments cause TypeError");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.scale(); });
assert_throws(new TypeError(), function() { ctx.scale(1); });
assert_throws(new TypeError(), function() { ctx.rotate(); });
assert_throws(new TypeError(), function() { ctx.translate(); });
assert_throws(new TypeError(), function() { ctx.translate(0); });
assert_throws_js(TypeError, function() { ctx.scale(); });
assert_throws_js(TypeError, function() { ctx.scale(1); });
assert_throws_js(TypeError, function() { ctx.rotate(); });
assert_throws_js(TypeError, function() { ctx.translate(); });
assert_throws_js(TypeError, function() { ctx.translate(0); });
if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported)
assert_throws(new TypeError(), function() { ctx.transform(); });
assert_throws(new TypeError(), function() { ctx.transform(1); });
assert_throws(new TypeError(), function() { ctx.transform(1, 0); });
assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0); });
assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.transform(); });
assert_throws_js(TypeError, function() { ctx.transform(1); });
assert_throws_js(TypeError, function() { ctx.transform(1, 0); });
assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); });
assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); });
}
if (ctx.setTransform) {
assert_throws(new TypeError(), function() { ctx.setTransform(1); });
assert_throws(new TypeError(), function() { ctx.setTransform(1, 0); });
assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0); });
assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.setTransform(1); });
assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); });
assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); });
assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); });
}
assert_throws(new TypeError(), function() { ctx.createLinearGradient(); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0); });
assert_throws(new TypeError(), function() { ctx.createPattern(canvas); });
assert_throws(new TypeError(), function() { ctx.clearRect(); });
assert_throws(new TypeError(), function() { ctx.clearRect(0); });
assert_throws(new TypeError(), function() { ctx.clearRect(0, 0); });
assert_throws(new TypeError(), function() { ctx.clearRect(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.fillRect(); });
assert_throws(new TypeError(), function() { ctx.fillRect(0); });
assert_throws(new TypeError(), function() { ctx.fillRect(0, 0); });
assert_throws(new TypeError(), function() { ctx.fillRect(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.strokeRect(); });
assert_throws(new TypeError(), function() { ctx.strokeRect(0); });
assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0); });
assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.moveTo(); });
assert_throws(new TypeError(), function() { ctx.moveTo(0); });
assert_throws(new TypeError(), function() { ctx.lineTo(); });
assert_throws(new TypeError(), function() { ctx.lineTo(0); });
assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(); });
assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0); });
assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0); });
assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.bezierCurveTo(); });
assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0); });
assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0); });
assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.arcTo(); });
assert_throws(new TypeError(), function() { ctx.arcTo(0); });
assert_throws(new TypeError(), function() { ctx.arcTo(0, 0); });
assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.rect(); });
assert_throws(new TypeError(), function() { ctx.rect(0); });
assert_throws(new TypeError(), function() { ctx.rect(0, 0); });
assert_throws(new TypeError(), function() { ctx.rect(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.arc(); });
assert_throws(new TypeError(), function() { ctx.arc(0); });
assert_throws(new TypeError(), function() { ctx.arc(0, 0); });
assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); });
assert_throws_js(TypeError, function() { ctx.createPattern(canvas); });
assert_throws_js(TypeError, function() { ctx.clearRect(); });
assert_throws_js(TypeError, function() { ctx.clearRect(0); });
assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); });
assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.fillRect(); });
assert_throws_js(TypeError, function() { ctx.fillRect(0); });
assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); });
assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.strokeRect(); });
assert_throws_js(TypeError, function() { ctx.strokeRect(0); });
assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); });
assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.moveTo(); });
assert_throws_js(TypeError, function() { ctx.moveTo(0); });
assert_throws_js(TypeError, function() { ctx.lineTo(); });
assert_throws_js(TypeError, function() { ctx.lineTo(0); });
assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); });
assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); });
assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); });
assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); });
assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); });
assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); });
assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.arcTo(); });
assert_throws_js(TypeError, function() { ctx.arcTo(0); });
assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); });
assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.rect(); });
assert_throws_js(TypeError, function() { ctx.rect(0); });
assert_throws_js(TypeError, function() { ctx.rect(0, 0); });
assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.arc(); });
assert_throws_js(TypeError, function() { ctx.arc(0); });
assert_throws_js(TypeError, function() { ctx.arc(0, 0); });
assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); });
// (6th argument to arc is optional)
if (ctx.isPointInPath) {
assert_throws(new TypeError(), function() { ctx.isPointInPath(); });
assert_throws(new TypeError(), function() { ctx.isPointInPath(0); });
assert_throws_js(TypeError, function() { ctx.isPointInPath(); });
assert_throws_js(TypeError, function() { ctx.isPointInPath(0); });
}
if (ctx.drawFocusRing) {
assert_throws(new TypeError(), function() { ctx.drawFocusRing(); });
assert_throws(new TypeError(), function() { ctx.drawFocusRing(canvas); });
assert_throws(new TypeError(), function() { ctx.drawFocusRing(canvas, 0); });
assert_throws_js(TypeError, function() { ctx.drawFocusRing(); });
assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); });
assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); });
}
if (ctx.fillText) {
assert_throws(new TypeError(), function() { ctx.fillText(); });
assert_throws(new TypeError(), function() { ctx.fillText('test'); });
assert_throws(new TypeError(), function() { ctx.fillText('test', 0); });
assert_throws(new TypeError(), function() { ctx.strokeText(); });
assert_throws(new TypeError(), function() { ctx.strokeText('test'); });
assert_throws(new TypeError(), function() { ctx.strokeText('test', 0); });
assert_throws(new TypeError(), function() { ctx.measureText(); });
assert_throws_js(TypeError, function() { ctx.fillText(); });
assert_throws_js(TypeError, function() { ctx.fillText('test'); });
assert_throws_js(TypeError, function() { ctx.fillText('test', 0); });
assert_throws_js(TypeError, function() { ctx.strokeText(); });
assert_throws_js(TypeError, function() { ctx.strokeText('test'); });
assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); });
assert_throws_js(TypeError, function() { ctx.measureText(); });
}
assert_throws(new TypeError(), function() { ctx.drawImage(); });
assert_throws(new TypeError(), function() { ctx.drawImage(canvas); });
assert_throws(new TypeError(), function() { ctx.drawImage(canvas, 0); });
assert_throws_js(TypeError, function() { ctx.drawImage(); });
assert_throws_js(TypeError, function() { ctx.drawImage(canvas); });
assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); });
// TODO: n >= 3 args on drawImage could be either a valid overload,
// or too few for another overload, or too many for another
// overload - what should happen?
if (ctx.createImageData) {
assert_throws(new TypeError(), function() { ctx.createImageData(); });
assert_throws(new TypeError(), function() { ctx.createImageData(1); });
assert_throws_js(TypeError, function() { ctx.createImageData(); });
assert_throws_js(TypeError, function() { ctx.createImageData(1); });
}
if (ctx.getImageData) {
assert_throws(new TypeError(), function() { ctx.getImageData(); });
assert_throws(new TypeError(), function() { ctx.getImageData(0); });
assert_throws(new TypeError(), function() { ctx.getImageData(0, 0); });
assert_throws(new TypeError(), function() { ctx.getImageData(0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.getImageData(); });
assert_throws_js(TypeError, function() { ctx.getImageData(0); });
assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); });
assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); });
}
if (ctx.putImageData) {
var imgdata = ctx.getImageData(0, 0, 1, 1);
assert_throws(new TypeError(), function() { ctx.putImageData(); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0); });
assert_throws_js(TypeError, function() { ctx.putImageData(); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); });
}
var g = ctx.createLinearGradient(0, 0, 0, 0);
assert_throws(new TypeError(), function() { g.addColorStop(); });
assert_throws(new TypeError(), function() { g.addColorStop(0); });
assert_throws_js(TypeError, function() { g.addColorStop(); });
assert_throws_js(TypeError, function() { g.addColorStop(0); });
});

View File

@ -19,7 +19,7 @@
var t = async_test("");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.drawImage(null, 0, 0); });
assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); });
});

View File

@ -19,10 +19,10 @@
var t = async_test("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.drawImage(undefined, 0, 0); });
assert_throws(new TypeError(), function() { ctx.drawImage(0, 0, 0); });
assert_throws(new TypeError(), function() { ctx.drawImage("", 0, 0); });
assert_throws(new TypeError(), function() { ctx.drawImage(document.createElement('p'), 0, 0); });
assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); });
assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); });
assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); });
assert_throws_js(TypeError, function() { ctx.drawImage(document.createElement('p'), 0, 0); });
});

View File

@ -19,29 +19,29 @@
var t = async_test("createLinearGradient() throws TypeError if arguments are not finite");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(NaN, 0, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, -Infinity, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, NaN, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, -Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, NaN, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, -Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, NaN); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); });
assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(NaN, 0, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, -Infinity, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, NaN, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, -Infinity, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, NaN, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, -Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, NaN); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); });
assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); });
});

View File

@ -22,9 +22,9 @@ _addTest(function(canvas, ctx) {
var g = ctx.createLinearGradient(0, 0, 100, 0);
assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(-1, '#000'); });
assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(2, '#000'); });
assert_throws(new TypeError(), function() { g.addColorStop(Infinity, '#000'); });
assert_throws(new TypeError(), function() { g.addColorStop(-Infinity, '#000'); });
assert_throws(new TypeError(), function() { g.addColorStop(NaN, '#000'); });
assert_throws_js(TypeError, function() { g.addColorStop(Infinity, '#000'); });
assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#000'); });
assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#000'); });
});

View File

@ -19,81 +19,81 @@
var t = async_test("createRadialGradient() throws TypeError if arguments are not finite");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); });
assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); });
assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); });
});

View File

@ -19,7 +19,7 @@
var t = async_test("");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createPattern(null, 'repeat'); });
assert_throws_js(TypeError, function() { ctx.createPattern(null, 'repeat'); });
});

View File

@ -19,7 +19,7 @@
var t = async_test("");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createPattern('../images/red.png', 'repeat'); });
assert_throws_js(TypeError, function() { ctx.createPattern('../images/red.png', 'repeat'); });
});

View File

@ -19,7 +19,7 @@
var t = async_test("");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createPattern(undefined, 'repeat'); });
assert_throws_js(TypeError, function() { ctx.createPattern(undefined, 'repeat'); });
});

View File

@ -20,9 +20,9 @@ var t = async_test("createImageData(imgdata) should throw when called with the w
_addTest(function(canvas, ctx) {
var imgdata = ctx.createImageData(1, 1);
assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(null, imgdata); });
assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, imgdata); });
assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call({}, imgdata); });
assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, imgdata); });
assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, imgdata); });
assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, imgdata); });
});

View File

@ -19,7 +19,7 @@
var t = async_test("createImageData(null) throws TypeError");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createImageData(null); });
assert_throws_js(TypeError, function() { ctx.createImageData(null); });
});

View File

@ -19,23 +19,23 @@
var t = async_test("createImageData() throws TypeError if arguments are not finite");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.createImageData(-Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.createImageData(NaN, 10); });
assert_throws(new TypeError(), function() { ctx.createImageData(10, Infinity); });
assert_throws(new TypeError(), function() { ctx.createImageData(10, -Infinity); });
assert_throws(new TypeError(), function() { ctx.createImageData(10, NaN); });
assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); });
assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); });
assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); });
assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); });
assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); });
var posinfobj = { valueOf: function() { return Infinity; } },
neginfobj = { valueOf: function() { return -Infinity; } },
nanobj = { valueOf: function() { return -Infinity; } };
assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, 10); });
assert_throws(new TypeError(), function() { ctx.createImageData(neginfobj, 10); });
assert_throws(new TypeError(), function() { ctx.createImageData(nanobj, 10); });
assert_throws(new TypeError(), function() { ctx.createImageData(10, posinfobj); });
assert_throws(new TypeError(), function() { ctx.createImageData(10, neginfobj); });
assert_throws(new TypeError(), function() { ctx.createImageData(10, nanobj); });
assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, posinfobj); });
assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); });
assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); });
assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); });
assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); });
assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); });
assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); });
assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); });
});

View File

@ -19,9 +19,9 @@
var t = async_test("createImageData(sw, sh) should throw when called with the wrong |this|");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); });
assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, 1, 1); });
assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call({}, 1, 1); });
assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); });
assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, 1, 1); });
assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, 1, 1); });
});

View File

@ -19,55 +19,55 @@
var t = async_test("getImageData() throws TypeError if arguments are not finite");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(-Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(NaN, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, -Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, NaN, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, -Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, NaN, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, -Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, NaN); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); });
var posinfobj = { valueOf: function() { return Infinity; } },
neginfobj = { valueOf: function() { return -Infinity; } },
nanobj = { valueOf: function() { return -Infinity; } };
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(neginfobj, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(nanobj, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, neginfobj, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, nanobj, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, neginfobj, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, nanobj, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, neginfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, nanobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, 10); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, posinfobj); });
assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); });
assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); });
});

View File

@ -25,8 +25,8 @@ assert_throws("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedAr
assert_throws("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(3), 1); });
assert_throws("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 0); });
assert_throws("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 1, 2); });
assert_throws(new TypeError(), function() { new ImageData(new Uint8Array(8), 1, 2); });
assert_throws(new TypeError(), function() { new ImageData(new Int8Array(8), 1, 2); });
assert_throws_js(TypeError, function() { new ImageData(new Uint8Array(8), 1, 2); });
assert_throws_js(TypeError, function() { new ImageData(new Int8Array(8), 1, 2); });
});

View File

@ -20,88 +20,88 @@ var t = async_test("putImageData() throws TypeError if arguments are not finite"
_addTest(function(canvas, ctx) {
var imgdata = ctx.getImageData(0, 0, 10, 10);
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); });
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); });
});

View File

@ -19,7 +19,7 @@
var t = async_test("putImageData() with null imagedata throws TypeError");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { ctx.putImageData(null, 0, 0); });
assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); });
});

View File

@ -20,9 +20,9 @@ var t = async_test("putImageData() does not accept non-ImageData objects");
_addTest(function(canvas, ctx) {
var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] };
assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0, 0); });
assert_throws(new TypeError(), function() { ctx.putImageData("cheese", 0, 0); });
assert_throws(new TypeError(), function() { ctx.putImageData(42, 0, 0); });
assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); });
assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); });
assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); });
});

View File

@ -233,7 +233,7 @@ def genTestUtils(TESTOUTPUTDIR, IMAGEOUTPUTDIR, TEMPLATEFILE, NAME2DIRFILE, ISOF
code)
code = re.sub(r'@assert throws (\S+Error) (.*);',
r'assert_throws(new \1(), function() { \2; });',
r'assert_throws_js(\1, function() { \2; });',
code)
code = re.sub(r'@assert (.*) === (.*);',

View File

@ -36,7 +36,7 @@ function readBlobAsPromise(blob) {
0,
{}
].forEach(value => test(t => {
assert_throws(new TypeError(), () => new Blob([], {endings: value}),
assert_throws_js(TypeError, () => new Blob([], {endings: value}),
'Blob constructor should throw');
}, `Invalid "endings" value: ${JSON.stringify(value)}`));

View File

@ -25,7 +25,7 @@ test(function() {
assert_equals(blob.type, "");
}, "Blob constructor with no arguments");
test(function() {
assert_throws(new TypeError(), function() { var blob = Blob(); });
assert_throws_js(TypeError, function() { var blob = Blob(); });
}, "Blob constructor with no arguments, without 'new'");
test(function() {
var blob = new Blob;
@ -59,7 +59,7 @@ test(function() {
window,
];
args.forEach(function(arg) {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new Blob(arg);
}, "Should throw for argument " + format_value(arg) + ".");
});
@ -226,7 +226,7 @@ test(function() {
valueOf: function() { assert_unreached("Should not call valueOf if toString is present."); }
}]);
}, "Throwing toString and valueOf");
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new Blob([{toString: null, valueOf: null}]);
}, "Null toString and valueOf");
}, "ToString should be called on elements of the blobParts array and any exceptions should be propagated.");
@ -464,7 +464,7 @@ test(function() {
'abc'
].forEach(arg => {
test(t => {
assert_throws(new TypeError(), () => new Blob([], arg),
assert_throws_js(TypeError, () => new Blob([], arg),
'Blob constructor should throw with invalid property bag');
}, `Passing ${JSON.stringify(arg)} for options should throw`);
});

View File

@ -36,7 +36,7 @@ function readBlobAsPromise(blob) {
0,
{}
].forEach(value => test(t => {
assert_throws(new TypeError(), () => new File([], "name", {endings: value}),
assert_throws_js(TypeError, () => new File([], "name", {endings: value}),
'File constructor should throw');
}, `Invalid "endings" value: ${JSON.stringify(value)}`));

View File

@ -14,9 +14,9 @@ test(function() {
}, "File interface object exists");
test(t => {
assert_throws(new TypeError(), () => new File(),
assert_throws_js(TypeError, () => new File(),
'Bits argument is required');
assert_throws(new TypeError(), () => new File([]),
assert_throws_js(TypeError, () => new File([]),
'Name argument is required');
}, 'Required arguments');
@ -64,13 +64,13 @@ test_first_argument({[Symbol.iterator]() {
null
].forEach(arg => {
test(t => {
assert_throws(new TypeError(), () => new File(arg, 'world.html'),
assert_throws_js(TypeError, () => new File(arg, 'world.html'),
'Constructor should throw for invalid bits argument');
}, `Invalid bits argument: ${JSON.stringify(arg)}`);
});
test(t => {
assert_throws(new Error(), () => new File([to_string_throws], 'name.txt'),
assert_throws_js(Error, () => new File([to_string_throws], 'name.txt'),
'Constructor should propagate exceptions');
}, 'Bits argument: object that throws');
@ -131,7 +131,7 @@ test(function() {
'abc'
].forEach(arg => {
test(t => {
assert_throws(new TypeError(), () => new File(['bits'], 'name.txt', arg),
assert_throws_js(TypeError, () => new File(['bits'], 'name.txt', arg),
'Constructor should throw for invalid property bag type');
}, `Invalid property bag: ${JSON.stringify(arg)}`);
});
@ -150,7 +150,7 @@ test(function() {
});
test(t => {
assert_throws(new Error(),
assert_throws_js(Error,
() => new File(['bits'], 'name.txt', {type: to_string_throws}),
'Constructor should propagate exceptions');
}, 'Property bag propagates exceptions');

View File

@ -35,7 +35,7 @@
var cursor = e.target.result;
assert_true(cursor != null, "cursor exist");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { cursor.advance(document); });
t.done();

View File

@ -35,7 +35,7 @@
var cursor = e.target.result;
assert_true(cursor != null, "cursor exist");
assert_throws(new TypeError(),
assert_throws_js(TypeError,
function() { cursor.advance(-1); });
t.done();

View File

@ -26,7 +26,7 @@
var cursor = event.target.result;
assert_true(cursor instanceof IDBCursor);
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
cursor.advance(0);
}, "Calling advance() with count argument 0 should throw TypeError.");

View File

@ -29,7 +29,7 @@
var cursor = event.target.result;
assert_true(cursor instanceof IDBCursor);
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
cursor.advance(0);
}, "Calling advance() with count argument 0 should throw TypeError.");

View File

@ -33,7 +33,7 @@
var cursor = e.target.result;
assert_true(cursor instanceof IDBCursor);
assert_throws(new TypeError(), function() { cursor.update(); });
assert_throws_js(TypeError, function() { cursor.update(); });
t.done();
});
}

View File

@ -31,7 +31,7 @@
var cursor = e.target.result;
assert_true(cursor instanceof IDBCursor);
assert_throws(new TypeError(), function() { cursor.update(); });
assert_throws_js(TypeError, function() { cursor.update(); });
t.done();
});
}

View File

@ -9,7 +9,7 @@
<div id=log></div>
<script>
test( function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
indexedDB.cmp();
});
}, "IDBFactory.cmp() - no argument");

View File

@ -9,7 +9,7 @@ function should_throw(val, name) {
name = ((typeof val == "object" && val) ? "object" : format_value(val))
}
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
window.indexedDB.open('test', val);
});
}, "Calling open() with version argument " + name + " should throw TypeError.")

View File

@ -16,7 +16,7 @@
// TypeError: bound requires more than 0 arguments
test( function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
IDBKeyRange.bound();
});
}, "IDBKeyRange.bound() - bound requires more than 0 arguments.");
@ -67,10 +67,10 @@
// ReferenceError: the variable is not defined
test( function() {
var goodVariable = 1;
assert_throws(new ReferenceError(), function() {
assert_throws_js(ReferenceError, function() {
IDBKeyRange.bound(noExistingVariable, 1);
});
assert_throws(new ReferenceError(), function() {
assert_throws_js(ReferenceError, function() {
IDBKeyRange.bound(goodVariable, noExistingVariable);
});
}, "IDBKeyRange.bound(noExistingVariable, 1 / goodVariable, noExistingVariable) - noExistingVariable is not defined.");

View File

@ -46,7 +46,7 @@ promise_test(async testCase => {
createBooksStore(testCase, db);
});
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
db.transaction(['books'], 'readwrite', { durability: 'invalid' });
});
db.close();

View File

@ -1,7 +1,7 @@
"use strict";
test(() => {
assert_throws(new TypeError(), () => DOMException());
assert_throws_js(TypeError, () => DOMException());
}, "Cannot construct without new");
test(() => {
@ -26,7 +26,7 @@ test(() => {
test(() => {
const getter = Object.getOwnPropertyDescriptor(DOMException.prototype, "message").get;
assert_throws(new TypeError(), () => getter.apply({}));
assert_throws_js(TypeError, () => getter.apply({}));
}, "message getter performs brand checks (i.e. is not [LenientThis]");
test(() => {
@ -43,7 +43,7 @@ test(() => {
test(() => {
const getter = Object.getOwnPropertyDescriptor(DOMException.prototype, "name").get;
assert_throws(new TypeError(), () => getter.apply({}));
assert_throws_js(TypeError, () => getter.apply({}));
}, "name getter performs brand checks (i.e. is not [LenientThis]");
test(() => {
@ -60,7 +60,7 @@ test(() => {
test(() => {
const getter = Object.getOwnPropertyDescriptor(DOMException.prototype, "code").get;
assert_throws(new TypeError(), () => getter.apply({}));
assert_throws_js(TypeError, () => getter.apply({}));
}, "code getter performs brand checks (i.e. is not [LenientThis]");
test(() => {
@ -98,7 +98,7 @@ test(() => {
}, "toString() behavior from Error.prototype applies as expected");
test(() => {
assert_throws(new TypeError(), () => DOMException.prototype.toString());
assert_throws_js(TypeError, () => DOMException.prototype.toString());
}, "DOMException.prototype.toString() applied to DOMException.prototype throws because of name/message brand checks");
test(() => {

View File

@ -10,7 +10,7 @@ setup(() => {
test(() => {
for (const object of objects) {
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
Object.setPrototypeOf(object, {});
});
}

View File

@ -23,16 +23,16 @@ test(() => {
const usp = new URLSearchParams();
const iteratorProto = Object.getPrototypeOf(usp.entries());
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
iteratorProto.next();
});
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
iteratorProto.next.call(undefined);
});
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
iteratorProto.next.call(42);
});
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
iteratorProto.next.call(new Headers().entries());
});
}, "next() throws TypeError when called on ineligible receiver");

View File

@ -23,8 +23,8 @@ test(() => {
}, "Must have the correct property descriptor");
test(() => {
assert_throws(new TypeError(), () => NodeFilter(), "call");
assert_throws(new TypeError(), () => new NodeFilter(), "construct");
assert_throws_js(TypeError, () => NodeFilter(), "call");
assert_throws_js(TypeError, () => new NodeFilter(), "construct");
}, "Must throw a TypeError when called or constructed")
test(() => {
@ -59,10 +59,10 @@ test(() => {
// OrdinaryHasInstance throws a TypeError if the right-hand-side doesn't have a .prototype object,
// which is the case for callback interfaces.
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
(function () { }) instanceof NodeFilter;
});
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
({ }) instanceof NodeFilter;
});
}, "instanceof must throw but only when we don't bail out early");

View File

@ -121,17 +121,17 @@ test(function() {
configurable: true});
assert_prop_desc_equals(domTokenList, "1", undefined);
// Actual test
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(domTokenList, "0", {value: true, writable: true}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(domTokenList, "1", {value: true, writable: true}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(domTokenList, "0", {get: () => {}}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(domTokenList, "0", {set: () => {}}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(domTokenList, "1", {get: () => {}}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(domTokenList, "1", {set: () => {}}));
assert_equals(domTokenList[0], "foo");
assert_equals(domTokenList[1], undefined);
@ -139,11 +139,11 @@ test(function() {
domTokenList[1] = "bar";
assert_equals(domTokenList[0], "foo");
assert_equals(domTokenList[1], undefined);
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
"use strict";
domTokenList[0] = "bar";
});
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
"use strict";
domTokenList[1] = "bar";
});
@ -164,9 +164,9 @@ test(function() {
assert_equals(select.length, 0);
assert_prop_desc_equals(select, "0", undefined);
// Try to define an accessor property with non supported property index.
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(select, "0", {get: () => {}}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(select, "0", {set: () => {}}));
assert_prop_desc_equals(select, "0", undefined);
// writable, enumerable, configurable will be ignored.
@ -180,9 +180,9 @@ test(function() {
{value: option1, writable: true, enumerable: true,
configurable: true});
// Try to define an accessor property with a supported property index.
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(select, "0", {get: () => {}}));
assert_throws(new TypeError(), () =>
assert_throws_js(TypeError, () =>
Object.defineProperty(select, "0", {set: () => {}}));
assert_prop_desc_equals(select, "0",
{value: option0, writable: true, enumerable: true,

View File

@ -77,7 +77,7 @@ test(() => {
set: descriptor.set
});
assert_throws(new SyntaxError(), () => {
assert_throws_js(SyntaxError, () => {
element.style = "color: green";
});
}, "Exception propagation from getter of [PutForwards] attribute");
@ -94,7 +94,7 @@ test(() => {
}
});
assert_throws(new SyntaxError(), () => {
assert_throws_js(SyntaxError, () => {
element.style = "color: green";
});
}, "Exception propagation from setter of [PutForwards] target attribute");
@ -110,7 +110,7 @@ test(() => {
set: descriptor.set
});
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
element.style = "color: green";
});
}, "TypeError when getter of [PutForwards] attribute returns non-object");

View File

@ -151,7 +151,7 @@ test(t => {
test(t => {
// Should fail rather than falling back to record
assert_throws(new TypeError(), function() { new URLSearchParams(["key", "value"]); });
assert_throws_js(TypeError, function() { new URLSearchParams(["key", "value"]); });
}, "A string array in sequence<sequence> or record");
</script>

View File

@ -13,13 +13,13 @@ test(function() {
test(function() {
var invalidUrl = "http://invalid:url";
assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); },
assert_throws_js(TypeError, function() { navigator.sendBeacon(invalidUrl, smallPayload); },
`calling 'navigator.sendBeacon()' with an invalid URL '${invalidUrl}' must throw a TypeError`);
}, "Verify calling 'navigator.sendBeacon()' with an invalid URL throws an exception.");
test(function() {
var invalidUrl = "nothttp://invalid.url";
assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); },
assert_throws_js(TypeError, function() { navigator.sendBeacon(invalidUrl, smallPayload); },
`calling 'navigator.sendBeacon()' with a non-http(s) URL '${invalidUrl}' must throw a TypeError`);
}, "Verify calling 'navigator.sendBeacon()' with a URL that is not a http(s) scheme throws an exception.");

View File

@ -1,3 +1,3 @@
test(() => {
assert_throws(new TypeError(), () => navigator.sendBeacon("...", new ReadableStream()));
assert_throws_js(TypeError, () => navigator.sendBeacon("...", new ReadableStream()));
}, "sendBeacon() with a stream does not work due to the keepalive flag being set");

View File

@ -7,11 +7,11 @@
const test_desc = 'Bluetooth IDL test';
test(() => {
assert_throws(
new TypeError(), () => new Bluetooth(),
assert_throws_js(
TypeError, () => new Bluetooth(),
'the constructor should not be callable with "new"');
assert_throws(
new TypeError(), () => Bluetooth(),
assert_throws_js(
TypeError, () => Bluetooth(),
'the constructor should not be callable');
// Bluetooth implements BluetoothDiscovery;

View File

@ -9,11 +9,11 @@
const test_desc_idl = 'BluetoothDevice IDL test.';
test(() => {
assert_throws(
new TypeError(), () => new BluetoothDevice(),
assert_throws_js(
TypeError, () => new BluetoothDevice(),
'the constructor should not be callable with "new"');
assert_throws(
new TypeError(), () => BluetoothDevice(),
assert_throws_js(
TypeError, () => BluetoothDevice(),
'the constructor should not be callable');
}, test_desc_idl);
@ -23,11 +23,11 @@ bluetooth_test(
() => getConnectedHealthThermometerDevice().then(({device}) => {
assert_equals(device.constructor.name, 'BluetoothDevice');
var old_device_id = device.id;
assert_throws(
new TypeError(), () => device.id = 'overwritten',
assert_throws_js(
TypeError, () => device.id = 'overwritten',
'the device id should not be writable');
assert_throws(
new TypeError(), () => device.name = 'overwritten',
assert_throws_js(
TypeError, () => device.name = 'overwritten',
'the device name should not be writable');
assert_equals(device.id, old_device_id);
assert_equals(device.name, 'Health Thermometer');

View File

@ -19,19 +19,19 @@ test(() => {
}, "ClipboardItem() succeeds with empty options");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem({});});
assert_throws_js(TypeError, () => {new ClipboardItem({});});
}, "ClipboardItem({}) fails with empty dictionary input");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem(blob);});
assert_throws_js(TypeError, () => {new ClipboardItem(blob);});
}, "ClipboardItem(Blob) fails");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem(null);});
assert_throws_js(TypeError, () => {new ClipboardItem(null);});
}, "ClipboardItem() fails with null input");
test(() => {
assert_throws(new TypeError(), () => {new ClipboardItem();});
assert_throws_js(TypeError, () => {new ClipboardItem();});
}, "ClipboardItem() fails with no input");
test(() => {

View File

@ -3,7 +3,7 @@ function test_stringifier_attribute(aObject, aAttribute, aIsUnforgeable) {
// Step 1.
test(function() {
[null, undefined].forEach(function(v) {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
aObject.toString.call(v);
});
});
@ -15,7 +15,7 @@ function test_stringifier_attribute(aObject, aAttribute, aIsUnforgeable) {
test(function() {
assert_false("Window" in window && aObject instanceof window.Window);
[{}, window].forEach(function(v) {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
aObject.toString.call(v)
});
});

View File

@ -33,7 +33,7 @@ async function compressArrayBuffer(input, format) {
}
test(() => {
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
const transformer = new CompressionStream("nonvalid");
}, "non supported format should throw");
}, "CompressionStream constructor should throw on invalid format");

View File

@ -3,13 +3,13 @@
'use strict';
test(t => {
assert_throws(new TypeError(), () => new DecompressionStream('a'), 'constructor should throw');
assert_throws_js(TypeError, () => new DecompressionStream('a'), 'constructor should throw');
}, '"a" should cause the constructor to throw');
test(t => {
assert_throws(new TypeError(), () => new DecompressionStream(), 'constructor should throw');
assert_throws_js(TypeError, () => new DecompressionStream(), 'constructor should throw');
}, 'no input should cause the constructor to throw');
test(t => {
assert_throws(new Error(), () => new DecompressionStream({ toString() { throw Error(); } }), 'constructor should throw');
assert_throws_js(Error, () => new DecompressionStream({ toString() { throw Error(); } }), 'constructor should throw');
}, 'non-string input should cause the constructor to throw');

View File

@ -19,7 +19,7 @@
var evalRan = false;
test(function() {assert_throws(new EvalError(), function() { eval('evalRan = true;') })}, "eval() should throw without 'unsafe-eval' keyword source in script-src directive.");
test(function() {assert_throws_js(EvalError, function() { eval('evalRan = true;') })}, "eval() should throw without 'unsafe-eval' keyword source in script-src directive.");
test(function() {assert_false(evalRan);})

View File

@ -19,8 +19,8 @@
test(function() {
assert_throws(
new EvalError(),
assert_throws_js(
EvalError,
function() {
var funq = new Function('');
funq();

View File

@ -22,7 +22,7 @@
assert_equals(e.effectiveDirective, 'script-src');
}));
assert_throws(new Error(),
assert_throws_js(Error,
function() {
try {
eval("evalScriptRan = true;");

View File

@ -22,7 +22,7 @@
assert_equals(e.effectiveDirective, 'script-src');
}));
assert_throws(new Error(),
assert_throws_js(Error,
function() {
try {
new Function('newFunctionScriptRan = true;')();

View File

@ -10,7 +10,7 @@
}, "the event inherts from Event");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent();
}, 'First argument is required, so was expecting a TypeError.');
}, 'Missing type argument');
@ -176,37 +176,37 @@
}, "elapsedTime set to an object with a valueOf function");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent("test", {elapsedTime: NaN});
}, 'elapsedTime cannot be NaN so was expecting a TypeError');
}, "elapsedTime cannot be set to NaN");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent("test", {elapsedTime: Infinity});
}, 'elapsedTime cannot be Infinity so was expecting a TypeError');
}, "elapsedTime cannot be set to Infinity");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent("test", {elapsedTime: -Infinity});
}, 'elapsedTime cannot be -Infinity so was expecting a TypeError');
}, "elapsedTime cannot be set to -Infinity");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent("test", {elapsedTime: "sample"});
}, 'elapsedTime cannot be a string so was expecting a TypeError');
}, "elapsedTime cannot be set to 'sample'");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent("test", {elapsedTime: [0.5, 1.0]});
}, 'elapsedTime cannot be a multi-element array so was expecting a TypeError');
}, "elapsedTime cannot be set to [0.5, 1.0]");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new AnimationEvent("test", {elapsedTime: { sample: 0.5}});
}, 'elapsedTime cannot be an object so was expecting a TypeError');
}, "elapsedTime cannot be set to an object");

View File

@ -200,7 +200,7 @@
test(function(){
var style_rule = document.styleSheets[0].cssRules[0].cssRules[1];
assert_throws(new TypeError(), function() { style_rule.insertRule("@supports (width: 0) { ol { width: 0; } }", 0);} );
assert_throws_js(TypeError, function() { style_rule.insertRule("@supports (width: 0) { ol { width: 0; } }", 0);} );
}, "Inserting an @supports inside a style rule should fail");
test(function(){

View File

@ -33,9 +33,9 @@ test(function(){
}, 'Generated properties respect inherits flag');
test(function(){
assert_throws(new Error(), () => generate_property({syntax: '<length>', foo: 1}));
assert_throws(new Error(), () => generate_property({syntax: '<length>', inherited: false}));
assert_throws(new Error(), () => generate_property({syntax: '<length>', initial: '10px'}));
assert_throws_js(Error, () => generate_property({syntax: '<length>', foo: 1}));
assert_throws_js(Error, () => generate_property({syntax: '<length>', inherited: false}));
assert_throws_js(Error, () => generate_property({syntax: '<length>', initial: '10px'}));
}, 'Can\'t generate property with unknown fields');
</script>

View File

@ -44,14 +44,14 @@ function verify_map_set(map, name, value) {
// Verifies that the specified value is NOT accepted by set().
function verify_map_not_set(map, name, value) {
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
map.set(name, value);
});
}
// Verifies that the specified value is NOT accepted by append().
function verify_map_no_append(map, name, value) {
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
map.append(name, value);
});
}

View File

@ -19,7 +19,7 @@ test(function() {
}, "the event inherts from Event");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent();
}, 'First argument is required, so was expecting a TypeError.');
}, 'Missing type argument');
@ -185,37 +185,37 @@ test(function() {
}, "elapsedTime set to an object with a valueOf function");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent("test", {elapsedTime: NaN});
}, 'elapsedTime cannot be NaN so was expecting a TypeError');
}, "elapsedTime cannot be set to NaN");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent("test", {elapsedTime: Infinity});
}, 'elapsedTime cannot be Infinity so was expecting a TypeError');
}, "elapsedTime cannot be set to Infinity");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent("test", {elapsedTime: -Infinity});
}, 'elapsedTime cannot be -Infinity so was expecting a TypeError');
}, "elapsedTime cannot be set to -Infinity");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent("test", {elapsedTime: "sample"});
}, 'elapsedTime cannot be a string so was expecting a TypeError');
}, "elapsedTime cannot be set to 'sample'");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent("test", {elapsedTime: [0.5, 1.0]});
}, 'elapsedTime cannot be a multi-element array so was expecting a TypeError');
}, "elapsedTime cannot be set to [0.5, 1.0]");
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
new TransitionEvent("test", {elapsedTime: { sample: 0.5}});
}, 'elapsedTime cannot be an object so was expecting a TypeError');
}, "elapsedTime cannot be set to an object");

View File

@ -11,23 +11,23 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parse('', 'auto'));
assert_throws_js(TypeError, () => CSSStyleValue.parse('', 'auto'));
}, 'CSSStyleValue.parse() with empty property name throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parse('lemon', 'auto'));
assert_throws_js(TypeError, () => CSSStyleValue.parse('lemon', 'auto'));
}, 'CSSStyleValue.parse() with unsupported property name throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parse('width', '10deg'));
assert_throws_js(TypeError, () => CSSStyleValue.parse('width', '10deg'));
}, 'CSSStyleValue.parse() with invalid value for valid property throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parse('margin', '10deg'));
assert_throws_js(TypeError, () => CSSStyleValue.parse('margin', '10deg'));
}, 'CSSStyleValue.parse() with invalid value for shorthand property throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parse('--foo', ''));
assert_throws_js(TypeError, () => CSSStyleValue.parse('--foo', ''));
}, 'CSSStyleValue.parse() with invalid value for custom property throws TypeError');
</script>

View File

@ -11,23 +11,23 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parseAll('', 'auto'));
assert_throws_js(TypeError, () => CSSStyleValue.parseAll('', 'auto'));
}, 'CSSStyleValue.parseAll() with empty property name throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parseAll('lemon', 'auto'));
assert_throws_js(TypeError, () => CSSStyleValue.parseAll('lemon', 'auto'));
}, 'CSSStyleValue.parseAll() with unsupported property name throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parseAll('width', '10deg'));
assert_throws_js(TypeError, () => CSSStyleValue.parseAll('width', '10deg'));
}, 'CSSStyleValue.parseAll() with invalid value for valid property throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parseAll('margin', '10deg'));
assert_throws_js(TypeError, () => CSSStyleValue.parseAll('margin', '10deg'));
}, 'CSSStyleValue.parseAll() with invalid value for shorthand property throws TypeError');
test(() => {
assert_throws(new TypeError(), () => CSSStyleValue.parseAll('--foo', ''));
assert_throws_js(TypeError, () => CSSStyleValue.parseAll('--foo', ''));
}, 'CSSStyleValue.parseAll() with invalid value for custom property throws TypeError');
</script>

View File

@ -11,7 +11,7 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => new CSSKeywordValue(''));
assert_throws_js(TypeError, () => new CSSKeywordValue(''));
}, 'Constructing CSSKeywordValue with an empty string throws a TypeError');
</script>

View File

@ -27,7 +27,7 @@ for (const args of gTestArguments) {
test(() => {
let result = new CSSKeywordValue('lemon');
assert_throws(new TypeError(), () => result.value = '');
assert_throws_js(TypeError, () => result.value = '');
assert_equals(result.value, 'lemon', 'value does not change');
}, 'Updating CSSKeywordValue.value with an empty string throws a TypeError');

View File

@ -20,14 +20,14 @@ const gInvalidTestCases = [
for (const {length, desc} of gInvalidTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSPerspective(length));
assert_throws_js(TypeError, () => new CSSPerspective(length));
}, 'Constructing a CSSPerspective with ' + desc + ' throws a TypeError');
}
for (const {length, desc} of gInvalidTestCases) {
test(() => {
let perspective = new CSSPerspective(CSS.px(0));
assert_throws(new TypeError(), () => perspective.length = length);
assert_throws_js(TypeError, () => perspective.length = length);
assert_style_value_equals(perspective.length, CSS.px(0));
}, 'Updating CSSPerspective.length with ' + desc + ' throws a TypeError');
}

View File

@ -43,13 +43,13 @@ const gTestArguments = [
for (const {value, description} of gTestArguments) {
test(() => {
assert_throws(new TypeError(), () => new CSSPositionValue(value, CSS.px(0)));
assert_throws(new TypeError(), () => new CSSPositionValue(CSS.px(0), value));
assert_throws_js(TypeError, () => new CSSPositionValue(value, CSS.px(0)));
assert_throws_js(TypeError, () => new CSSPositionValue(CSS.px(0), value));
}, `Constructing a CSSPositionValue with ${description} throws a TypeError`);
test(() => {
let position = new CSSPositionValue(CSS.px(0), CSS.px(0));
assert_throws(new TypeError(), () => position.x = value);
assert_throws_js(TypeError, () => position.x = value);
assert_equals(position.x.value, 0,
'X member should not have changed');
@ -57,7 +57,7 @@ for (const {value, description} of gTestArguments) {
test(() => {
let position = new CSSPositionValue(CSS.px(0), CSS.px(0));
assert_throws(new TypeError(), () => position.y = value);
assert_throws_js(TypeError, () => position.y = value);
assert_equals(position.y.value, 0,
'Y member should not have changed');

View File

@ -20,16 +20,16 @@ const gInvalidCoordTestCases = [
for (const {angle, desc} of gInvalidAngleTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSRotate(angle));
assert_throws(new TypeError(), () => new CSSRotate(0, 0, 0, angle));
assert_throws_js(TypeError, () => new CSSRotate(angle));
assert_throws_js(TypeError, () => new CSSRotate(0, 0, 0, angle));
}, 'Constructing a CSSRotate with ' + desc + ' for the angle throws a TypeError');
}
for (const {coord, desc} of gInvalidCoordTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSRotate(coord, 0, 0, CSS.deg(0)));
assert_throws(new TypeError(), () => new CSSRotate(0, coord, 0, CSS.deg(0)));
assert_throws(new TypeError(), () => new CSSRotate(0, 0, coord, CSS.deg(0)));
assert_throws_js(TypeError, () => new CSSRotate(coord, 0, 0, CSS.deg(0)));
assert_throws_js(TypeError, () => new CSSRotate(0, coord, 0, CSS.deg(0)));
assert_throws_js(TypeError, () => new CSSRotate(0, 0, coord, CSS.deg(0)));
}, 'Constructing a CSSRotate with ' + desc + ' for the coordinates throws a TypeError');
}
@ -37,7 +37,7 @@ for (const attr of ['x', 'y', 'z']) {
for (const {value, desc} of gInvalidCoordTestCases) {
test(() => {
let result = new CSSRotate(0, 0, 0, CSS.deg(0));
assert_throws(new TypeError(), () => result[attr] = value);
assert_throws_js(TypeError, () => result[attr] = value);
assert_style_value_equals(result[attr], CSS.number(0));
}, 'Updating CSSRotate.' + attr + ' to ' + desc + ' throws a TypeError');
}
@ -46,7 +46,7 @@ for (const attr of ['x', 'y', 'z']) {
for (const {angle, desc} of gInvalidAngleTestCases) {
test(() => {
let result = new CSSRotate(CSS.deg(0));
assert_throws(new TypeError(), () => result.angle = angle);
assert_throws_js(TypeError, () => result.angle = angle);
assert_style_value_equals(result.angle, CSS.deg(0));
}, 'Updating CSSRotate.angle to ' + desc + ' throws a TypeError');
}

View File

@ -15,11 +15,11 @@ const gInvalidCoordTestCases = [
for (const {coord, desc} of gInvalidCoordTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSScale(coord, 0));
assert_throws(new TypeError(), () => new CSSScale(0, coord));
assert_throws(new TypeError(), () => new CSSScale(coord, 0, 0));
assert_throws(new TypeError(), () => new CSSScale(0, coord, 0));
assert_throws(new TypeError(), () => new CSSScale(0, 0, coord));
assert_throws_js(TypeError, () => new CSSScale(coord, 0));
assert_throws_js(TypeError, () => new CSSScale(0, coord));
assert_throws_js(TypeError, () => new CSSScale(coord, 0, 0));
assert_throws_js(TypeError, () => new CSSScale(0, coord, 0));
assert_throws_js(TypeError, () => new CSSScale(0, 0, coord));
}, 'Constructing a CSSScale with ' + desc + ' for the coordinates throws a TypeError');
}
@ -27,7 +27,7 @@ for (const attr of ['x', 'y', 'z']) {
for (const {value, desc} of gInvalidCoordTestCases) {
test(() => {
let result = new CSSScale(0, 0, 0);
assert_throws(new TypeError(), () => result[attr] = value);
assert_throws_js(TypeError, () => result[attr] = value);
assert_style_value_equals(result[attr], CSS.number(0));
}, 'Updating CSSScale.' + attr + ' to ' + desc + ' throws a TypeError');
}

View File

@ -20,8 +20,8 @@ const gInvalidTestCases = [
for (const {value, desc} of gInvalidTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSSkew(value, CSS.deg(0)));
assert_throws(new TypeError(), () => new CSSSkew(CSS.deg(0), value));
assert_throws_js(TypeError, () => new CSSSkew(value, CSS.deg(0)));
assert_throws_js(TypeError, () => new CSSSkew(CSS.deg(0), value));
}, 'Constructing a CSSSkew with ' + desc + ' throws a TypeError');
}
@ -29,7 +29,7 @@ for (const attr of ['ax', 'ay']) {
for (const {value, desc} of gInvalidTestCases) {
test(() => {
let skew = new CSSSkew(CSS.deg(0), CSS.deg(0));
assert_throws(new TypeError(), () => skew[attr] = value);
assert_throws_js(TypeError, () => skew[attr] = value);
assert_style_value_equals(skew[attr], CSS.deg(0));
}, 'Updating CSSSkew.' + attr + ' with ' + desc + ' throws a TypeError');
}

View File

@ -20,14 +20,14 @@ const gInvalidTestCases = [
for (const {value, desc} of gInvalidTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSSkewX(value));
assert_throws_js(TypeError, () => new CSSSkewX(value));
}, 'Constructing a CSSSkewX with ' + desc + ' throws a TypeError');
}
for (const {value, desc} of gInvalidTestCases) {
test(() => {
let skewX = new CSSSkewX(CSS.deg(0));
assert_throws(new TypeError(), () => skewX.ax = value);
assert_throws_js(TypeError, () => skewX.ax = value);
assert_style_value_equals(skewX.ax, CSS.deg(0));
}, 'Updating CSSSkewX.ax with ' + desc + ' throws a TypeError');
}

View File

@ -20,14 +20,14 @@ const gInvalidTestCases = [
for (const {value, desc} of gInvalidTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSSkewY(value));
assert_throws_js(TypeError, () => new CSSSkewY(value));
}, 'Constructing a CSSSkewY with ' + desc + ' throws a TypeError');
}
for (const {value, desc} of gInvalidTestCases) {
test(() => {
let skewY = new CSSSkewY(CSS.deg(0));
assert_throws(new TypeError(), () => skewY.ay = value);
assert_throws_js(TypeError, () => skewY.ay = value);
assert_style_value_equals(skewY.ay, CSS.deg(0));
}, 'Updating CSSSkewY.ay with ' + desc + ' throws a TypeError');
}

View File

@ -10,7 +10,7 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
return new CSSTranslate(
new CSSUnitValue(1, 'px'),
new CSSUnitValue(1, 'em')
@ -19,7 +19,7 @@ test(() => {
}, 'CSSTranslate.toMatrix() containing relative units throws TypeError');
test(() => {
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
return new CSSPerspective(new CSSUnitValue(1, 'em')).toMatrix();
});
}, 'CSSPerspective.toMatrix() containing relative units throws TypeError');

View File

@ -10,8 +10,8 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => new CSSTransformValue());
assert_throws(new TypeError(), () => new CSSTransformValue([]));
assert_throws_js(TypeError, () => new CSSTransformValue());
assert_throws_js(TypeError, () => new CSSTransformValue([]));
}, 'Constructing a CSSTransformValue with no components throws TypeError');
test(() => {
@ -78,7 +78,7 @@ test(() => {
test(() => {
let transform = new CSSTransformValue([new CSSScale(1, 2)]);
assert_throws(new TypeError(), () => transform.is2D = false);
assert_throws_js(TypeError, () => transform.is2D = false);
assert_equals(transform.is2D, true);
}, 'CSSTransformValue.is2D is readonly');

View File

@ -15,21 +15,21 @@ const gInvalidCoordTestCases = [
for (const {coord, desc} of gInvalidCoordTestCases) {
test(() => {
assert_throws(new TypeError(), () => new CSSTranslate(coord, CSS.px(0), CSS.px(0)));
assert_throws(new TypeError(), () => new CSSTranslate(CSS.px(0), coord, CSS.px(0)));
assert_throws(new TypeError(), () => new CSSTranslate(CSS.px(0), CSS.px(0), coord));
assert_throws_js(TypeError, () => new CSSTranslate(coord, CSS.px(0), CSS.px(0)));
assert_throws_js(TypeError, () => new CSSTranslate(CSS.px(0), coord, CSS.px(0)));
assert_throws_js(TypeError, () => new CSSTranslate(CSS.px(0), CSS.px(0), coord));
}, 'Constructing a CSSTranslate with ' + desc + ' for the coordinates throws a TypeError');
}
test(() => {
assert_throws(new TypeError(), () => new CSSTranslate(CSS.px(0), CSS.px(0), CSS.percent(0)));
assert_throws_js(TypeError, () => new CSSTranslate(CSS.px(0), CSS.px(0), CSS.percent(0)));
}, 'Constructing a CSSTranslate with a percent for the Z coordinate throws a TypeError');
for (const attr of ['x', 'y', 'z']) {
for (const {value, desc} of gInvalidCoordTestCases) {
test(() => {
let result = new CSSTranslate(CSS.px(0), CSS.px(0), CSS.px(0));
assert_throws(new TypeError(), () => result[attr] = value);
assert_throws_js(TypeError, () => result[attr] = value);
assert_style_value_equals(result[attr], CSS.px(0));
}, 'Updating CSSTranslate.' + attr + ' to ' + desc + ' throws a TypeError');
}
@ -37,7 +37,7 @@ for (const attr of ['x', 'y', 'z']) {
test(() => {
let result = new CSSTranslate(CSS.px(0), CSS.px(0), CSS.px(0));
assert_throws(new TypeError(), () => result.z = CSS.percent(0));
assert_throws_js(TypeError, () => result.z = CSS.percent(0));
assert_style_value_equals(result.z, CSS.px(0));
}, 'Updating CSSTranslate.z to a percent throws a TypeError');

View File

@ -47,7 +47,7 @@ test(() => {
test(() => {
let result = new CSSUnparsedValue(['foo', 'bar']);
assert_throws(new RangeError(), () => result[3] = 'foo');
assert_throws_js(RangeError, () => result[3] = 'foo');
assert_equals(result[3], undefined, 'fragment does not change');
}, 'Setting out of range index in CSSUnparsedValue throws RangeError');

View File

@ -11,12 +11,12 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => new CSSVariableReferenceValue(''));
assert_throws_js(TypeError, () => new CSSVariableReferenceValue(''));
}, 'Constructing a CSSVariableReferenceValue with an empty variable name ' +
'throws a TypeError');
test(() => {
assert_throws(new TypeError(), () => new CSSVariableReferenceValue('bar'));
assert_throws_js(TypeError, () => new CSSVariableReferenceValue('bar'));
}, 'Constructing a CSSVariableReferenceValue with an invalid variable name ' +
'throws SyntaxError');

View File

@ -18,14 +18,14 @@ test(() => {
test(() => {
let result = new CSSVariableReferenceValue('--foo');
assert_throws(new TypeError(), () => result.variable = '');
assert_throws_js(TypeError, () => result.variable = '');
assert_equals(result.variable, '--foo', 'variable does not change');
}, 'Updating CSSVariableReferenceValue.variable to the empty string ' +
'throws TypeError');
test(() => {
let result = new CSSVariableReferenceValue('--foo');
assert_throws(new TypeError(), () => result.variable = 'bar');
assert_throws_js(TypeError, () => result.variable = 'bar');
assert_equals(result.variable, '--foo', 'variable does not change');
}, 'Updating CSSVariableReferenceValue.variable to an invalid custom ' +
'property name throws TypeError');

View File

@ -13,7 +13,7 @@
test(() => {
const a = new CSSUnitValue(0, 'number');
const b = new CSSUnitValue(0, 'px');
assert_throws(new TypeError(), () => new CSSMathSum(a, b));
assert_throws_js(TypeError, () => new CSSMathSum(a, b));
}, 'Adding two types with different non-null percent hints throws TypeError');
test(() => {
@ -40,7 +40,7 @@ test(() => {
test(() => {
const a = new CSSMathProduct(new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'px'));
const b = new CSSUnitValue(0, 'percent');
assert_throws(new TypeError(), () => new CSSMathSum(a, b));
assert_throws_js(TypeError, () => new CSSMathSum(a, b));
}, 'Adding a type with percent 2 returns type with percent hint throws TypeError');
test(() => {

View File

@ -62,7 +62,7 @@ for (const {methodName, mathType} of gArithmeticOps) {
}, 'Calling ' + mathType.name + '.' + methodName + ' with number CSSUnitValues simplifies to a CSSUnitValue');
test(() => {
assert_throws(new TypeError(), () => new CSS.px(0)[methodName](CSS.px(1), CSS.s(2)));
assert_throws_js(TypeError, () => new CSS.px(0)[methodName](CSS.px(1), CSS.s(2)));
}, 'Calling CSSNumericValue.' + methodName + ' with incompatible types throws TypeError');
}
@ -145,9 +145,9 @@ test(() => {
}, 'Calling CSSNumericValue.div inverts all argument values');
test(() => {
assert_throws(new RangeError(), () => CSS.number(2).div(CSS.number(0)));
assert_throws(new RangeError(), () => CSS.number(3).div(CSS.px(10) ,CSS.number(0)));
assert_throws(new RangeError(), () => CSS.number(2).div(CSS.number(0), CSS.number(0)));
assert_throws_js(RangeError, () => CSS.number(2).div(CSS.number(0)));
assert_throws_js(RangeError, () => CSS.number(3).div(CSS.px(10) ,CSS.number(0)));
assert_throws_js(RangeError, () => CSS.number(2).div(CSS.number(0), CSS.number(0)));
}, 'Can not divide with CSSUnitValue which has zero value and number type');
</script>

View File

@ -11,11 +11,11 @@
'use strict';
test(() => {
assert_throws(new TypeError(), () => new CSSUnitValue(0, 'lemon'));
assert_throws_js(TypeError, () => new CSSUnitValue(0, 'lemon'));
}, 'Constructing CSSUnitValue with an unknown unit throws a TypeError');
test(() => {
assert_throws(new TypeError(), () => new CSSUnitValue(0, ''));
assert_throws_js(TypeError, () => new CSSUnitValue(0, ''));
}, 'Constructing CSSUnitValue with a empty string unit throws a TypeError');
for (const unit of gValidUnits) {

View File

@ -13,7 +13,7 @@
test(() => {
const a = new CSSMathSum(new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'percent'));
const b = new CSSMathSum(new CSSUnitValue(0, 's'), new CSSUnitValue(0, 'percent'));
assert_throws(new TypeError(), () => new CSSMathProduct(a, b));
assert_throws_js(TypeError, () => new CSSMathProduct(a, b));
}, 'Multiplying two types with different non-null percent hints throws TypeError');
test(() => {

View File

@ -12,7 +12,7 @@
test(t => {
const styleMap = createComputedStyleMap(t);
assert_throws(new TypeError(), () => styleMap.get('lemon'));
assert_throws_js(TypeError, () => styleMap.get('lemon'));
}, 'Calling StylePropertyMap.get with an unsupported property throws a TypeError');
</script>

View File

@ -11,7 +11,7 @@
test(t => {
const styleMap = createComputedStyleMap(t);
assert_throws(new TypeError(), () => styleMap.getAll('lemon'));
assert_throws_js(TypeError, () => styleMap.getAll('lemon'));
}, 'Calling StylePropertyMap.getAll with an unsupported property throws a TypeError');
test(t => {

View File

@ -11,7 +11,7 @@
test(t => {
const styleMap = createComputedStyleMap(t);
assert_throws(new TypeError(), () => styleMap.has('lemon'));
assert_throws_js(TypeError, () => styleMap.has('lemon'));
}, 'Calling StylePropertyMap.has with an unsupported property throws a TypeError');
const gTestCases = [

View File

@ -24,7 +24,7 @@ const gInvalidTestCases = [
for (const {property, values, desc} of gInvalidTestCases) {
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.append(property, ...values));
assert_throws_js(TypeError, () => styleMap.append(property, ...values));
}, 'Calling StylePropertyMap.append with ' + desc + ' throws TypeError');
}

View File

@ -12,7 +12,7 @@
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.delete('lemon'));
assert_throws_js(TypeError, () => styleMap.delete('lemon'));
}, 'Deleting an unsupported property name throws a TypeError');
</script>

View File

@ -12,7 +12,7 @@
test(t => {
const styleMap = createDeclaredStyleMap(t);
assert_throws(new TypeError(), () => styleMap.get('lemon'));
assert_throws_js(TypeError, () => styleMap.get('lemon'));
}, 'Calling StylePropertyMap.get with an unsupported property throws a TypeError');
</script>

View File

@ -11,7 +11,7 @@
test(t => {
const styleMap = createDeclaredStyleMap(t);
assert_throws(new TypeError(), () => styleMap.getAll('lemon'));
assert_throws_js(TypeError, () => styleMap.getAll('lemon'));
}, 'Calling StylePropertyMap.getAll with an unsupported property throws a TypeError');
test(t => {

View File

@ -11,7 +11,7 @@
test(t => {
const styleMap = createDeclaredStyleMap(t);
assert_throws(new TypeError(), () => styleMap.has('lemon'));
assert_throws_js(TypeError, () => styleMap.has('lemon'));
}, 'Calling StylePropertyMap.has with an unsupported property throws a TypeError');
const gTestCases = [

View File

@ -17,7 +17,7 @@ const gInvalidTestCases = [
for (const {property, values, desc} of gInvalidTestCases) {
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set(property, ...values));
assert_throws_js(TypeError, () => styleMap.set(property, ...values));
}, 'Setting a shorthand with ' + desc + ' on css rule throws TypeError');
}

View File

@ -19,23 +19,23 @@ const gInvalidTestCases = [
for (const {property, values, desc} of gInvalidTestCases) {
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set(property, ...values));
assert_throws_js(TypeError, () => styleMap.set(property, ...values));
}, 'Setting a StylePropertyMap with ' + desc + ' throws TypeError');
}
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set('width', CSS.px(10), CSS.px(10)));
assert_throws_js(TypeError, () => styleMap.set('width', CSS.px(10), CSS.px(10)));
}, 'Setting a non list-valued property with multiple arguments throws TypeError');
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set('width', '1s, 2s'));
assert_throws_js(TypeError, () => styleMap.set('width', '1s, 2s'));
}, 'Setting a non list-valued property with list-valued string throws TypeError');
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
styleMap.set('transition-duration', '1s', new CSSUnparsedValue([]));
});
}, 'Setting a list-valued property with a CSSUnparsedValue and other ' +
@ -43,7 +43,7 @@ test(t => {
test(t => {
let styleMap = createDeclaredStyleMap(t, '');
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
styleMap.set('transition-duration', '1s', 'var(--A)');
});
}, 'Setting a list-valued property with a var ref() and other values ' +

View File

@ -24,7 +24,7 @@ const gInvalidTestCases = [
for (const {property, values, desc} of gInvalidTestCases) {
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.append(property, ...values));
assert_throws_js(TypeError, () => styleMap.append(property, ...values));
}, 'Calling StylePropertyMap.append with ' + desc + ' throws TypeError');
}

View File

@ -12,7 +12,7 @@
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.delete('lemon'));
assert_throws_js(TypeError, () => styleMap.delete('lemon'));
}, 'Deleting an unsupported property name throws a TypeError');
</script>

View File

@ -12,7 +12,7 @@
test(t => {
const styleMap = createInlineStyleMap(t);
assert_throws(new TypeError(), () => styleMap.get('lemon'));
assert_throws_js(TypeError, () => styleMap.get('lemon'));
}, 'Calling StylePropertyMap.get with an unsupported property throws a TypeError');
</script>

View File

@ -11,7 +11,7 @@
test(t => {
const styleMap = createInlineStyleMap(t);
assert_throws(new TypeError(), () => styleMap.getAll('lemon'));
assert_throws_js(TypeError, () => styleMap.getAll('lemon'));
}, 'Calling StylePropertyMap.getAll with an unsupported property throws a TypeError');
test(t => {

View File

@ -11,7 +11,7 @@
test(t => {
const styleMap = createInlineStyleMap(t);
assert_throws(new TypeError(), () => styleMap.has('lemon'));
assert_throws_js(TypeError, () => styleMap.has('lemon'));
}, 'Calling StylePropertyMap.has with an unsupported property throws a TypeError');
const gTestCases = [

View File

@ -17,7 +17,7 @@ const gInvalidTestCases = [
for (const {property, values, desc} of gInvalidTestCases) {
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set(property, ...values));
assert_throws_js(TypeError, () => styleMap.set(property, ...values));
}, 'Setting a shorthand with ' + desc + ' on inline style throws TypeError');
}

View File

@ -19,23 +19,23 @@ const gInvalidTestCases = [
for (const {property, values, desc} of gInvalidTestCases) {
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set(property, ...values));
assert_throws_js(TypeError, () => styleMap.set(property, ...values));
}, 'Setting a StylePropertyMap with ' + desc + ' throws TypeError');
}
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set('width', CSS.px(10), CSS.px(10)));
assert_throws_js(TypeError, () => styleMap.set('width', CSS.px(10), CSS.px(10)));
}, 'Setting a non list-valued property with multiple arguments throws TypeError');
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => styleMap.set('width', '1s, 2s'));
assert_throws_js(TypeError, () => styleMap.set('width', '1s, 2s'));
}, 'Setting a non list-valued property with list-valued string throws TypeError');
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
styleMap.set('transition-duration', '1s', new CSSUnparsedValue([]));
});
}, 'Setting a list-valued property with a CSSUnparsedValue and other ' +
@ -43,7 +43,7 @@ test(t => {
test(t => {
let styleMap = createInlineStyleMap(t, '');
assert_throws(new TypeError(), () => {
assert_throws_js(TypeError, () => {
styleMap.set('transition-duration', '1s', 'var(--A)');
});
}, 'Setting a list-valued property with a var ref() and other values ' +

View File

@ -357,7 +357,7 @@ function testPropertyInvalid(propertyName, examples, description) {
test(t => {
let styleMap = createInlineStyleMap(t);
for (const example of examples) {
assert_throws(new TypeError(), () => styleMap.set(propertyName, example.input));
assert_throws_js(TypeError, () => styleMap.set(propertyName, example.input));
}
}, `Setting '${propertyName}' to ${description} throws TypeError`);
}

View File

@ -7,10 +7,10 @@ document.elementsFromPoint() are mandatory and of type double.</title>
<script>
function validate_function_parameter_count(testFunc, funcName) {
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
testFunc();
}, "Called with no parameter");
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
testFunc(0);
}, "Called with 1 parameter");
}, funcName + ": Parameters are mandatory.");
@ -18,16 +18,16 @@ function validate_function_parameter_count(testFunc, funcName) {
function validate_function_parameter_type(testFunc, funcName) {
test(function() {
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
testFunc(0, Infinity);
}, "Passing Infinity as second parameter throws");
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
testFunc(Infinity, 0);
}, "Passing Infinity as first parameter throws");
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
testFunc(0, NaN);
}, "Passing NaN as second parameter throws");
assert_throws(new TypeError(), function() {
assert_throws_js(TypeError, function() {
testFunc(NaN, 0);
}, "Passing NaN as first parameter throws");
}, funcName + ": Parameters should be finite floating point values.");

View File

@ -8,7 +8,7 @@
<script>
test(function() {
assert_equals(CSS.escape.length, 1);
assert_throws(new TypeError(), function() { CSS.escape(); });
assert_throws_js(TypeError, function() { CSS.escape(); });
}, "Number of arguments");
test(function() {

View File

@ -138,7 +138,7 @@ test(function() {
}, "Dynamically change to display: contents on pseudo-elements");
test(function() {
var div = document.getElementById('test');
assert_throws(new TypeError(), () => getComputedStyle(div, "totallynotapseudo"),
assert_throws_js(TypeError, () => getComputedStyle(div, "totallynotapseudo"),
"getComputedStyle with an unknown pseudo-element throws");
}, "Unknown pseudo-elements throw");
</script>

View File

@ -57,15 +57,15 @@ test(function() {
assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN);
assert_equals(element.getAttribute('mode'), "lighten");
assert_throws(new TypeError(), function() { element.mode.baseVal = 17; });
assert_throws_js(TypeError, function() { element.mode.baseVal = 17; });
assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN);
assert_equals(element.getAttribute('mode'), "lighten");
assert_throws(new TypeError(), function() { element.mode.baseVal = -1; });
assert_throws_js(TypeError, function() { element.mode.baseVal = -1; });
assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN);
assert_equals(element.getAttribute('mode'), "lighten");
assert_throws(new TypeError(), function() { element.mode.baseVal = 0; });
assert_throws_js(TypeError, function() { element.mode.baseVal = 0; });
assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN);
assert_equals(element.getAttribute('mode'), "lighten");
}, document.title + ", setter, invalid value");

Some files were not shown because too many files have changed in this diff Show More