mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
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 <[email protected]> Co-authored-by: Stephen McGruer <[email protected]> -- wpt-commits: 2c5c3c4c27d27a419c1fdba3e9879c2d22037074 wpt-pr: 21354
52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<title>Tests that the parameters to document.elementFromPoint() and
|
|
document.elementsFromPoint() are mandatory and of type double.</title>
|
|
<link rel="help" href="https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
function validate_function_parameter_count(testFunc, funcName) {
|
|
test(function() {
|
|
assert_throws_js(TypeError, function() {
|
|
testFunc();
|
|
}, "Called with no parameter");
|
|
assert_throws_js(TypeError, function() {
|
|
testFunc(0);
|
|
}, "Called with 1 parameter");
|
|
}, funcName + ": Parameters are mandatory.");
|
|
}
|
|
|
|
function validate_function_parameter_type(testFunc, funcName) {
|
|
test(function() {
|
|
assert_throws_js(TypeError, function() {
|
|
testFunc(0, Infinity);
|
|
}, "Passing Infinity as second parameter throws");
|
|
assert_throws_js(TypeError, function() {
|
|
testFunc(Infinity, 0);
|
|
}, "Passing Infinity as first parameter throws");
|
|
assert_throws_js(TypeError, function() {
|
|
testFunc(0, NaN);
|
|
}, "Passing NaN as second parameter throws");
|
|
assert_throws_js(TypeError, function() {
|
|
testFunc(NaN, 0);
|
|
}, "Passing NaN as first parameter throws");
|
|
}, funcName + ": Parameters should be finite floating point values.");
|
|
}
|
|
|
|
validate_function_parameter_count(function(x, y) {
|
|
document.elementFromPoint(x, y);
|
|
}, "document.elementFromPoint");
|
|
|
|
validate_function_parameter_type(function(x, y) {
|
|
document.elementFromPoint(x, y);
|
|
}, "document.elementFromPoint");
|
|
|
|
validate_function_parameter_count(function(x, y) {
|
|
document.elementsFromPoint(x, y);
|
|
}, "document.elementsFromPoint");
|
|
|
|
validate_function_parameter_type(function(x, y) {
|
|
document.elementsFromPoint(x, y);
|
|
}, "document.elementsFromPoint");
|
|
</script>
|