mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 22:28:59 +02:00
MozReview-Commit-ID: 3HXcvTYpAkA --HG-- rename : testing/web-platform/tests/fonts/matching/README.md => testing/web-platform/tests/css-fonts/matching/README.md rename : testing/web-platform/tests/fonts/matching/fixed-stretch-style-over-weight-ref.html => testing/web-platform/tests/css-fonts/matching/fixed-stretch-style-over-weight-ref.html rename : testing/web-platform/tests/fonts/matching/fixed-stretch-style-over-weight.html => testing/web-platform/tests/css-fonts/matching/fixed-stretch-style-over-weight.html rename : testing/web-platform/tests/fonts/matching/font-matching.css => testing/web-platform/tests/css-fonts/matching/font-matching.css rename : testing/web-platform/tests/fonts/matching/resources/variabletest_matching.ttf => testing/web-platform/tests/css-fonts/matching/resources/variabletest_matching.ttf rename : testing/web-platform/tests/fonts/matching/stretch-distance-over-weight-distance-ref.html => testing/web-platform/tests/css-fonts/matching/stretch-distance-over-weight-distance-ref.html rename : testing/web-platform/tests/fonts/matching/stretch-distance-over-weight-distance.html => testing/web-platform/tests/css-fonts/matching/stretch-distance-over-weight-distance.html rename : testing/web-platform/tests/fonts/matching/style-ranges-over-weight-direction-ref.html => testing/web-platform/tests/css-fonts/matching/style-ranges-over-weight-direction-ref.html rename : testing/web-platform/tests/fonts/matching/style-ranges-over-weight-direction.html => testing/web-platform/tests/css-fonts/matching/style-ranges-over-weight-direction.html rename : testing/web-platform/tests/payment-request/OWNERS => testing/web-platform/tests/payment-method-id/OWNERS rename : testing/web-platform/tests/storage/interfaces.worker.js => testing/web-platform/tests/storage/interfaces.https.worker.js rename : testing/web-platform/tests/tools/browserutils/requirements.txt => testing/web-platform/tests/tools/wpt/requirements.txt rename : testing/web-platform/tests/tools/browserutils/utils.py => testing/web-platform/tests/tools/wpt/utils.py rename : testing/web-platform/tests/tools/wptrunner/wptrunner/executors/reftest-wait.js => testing/web-platform/tests/tools/wptrunner/wptrunner/executors/reftest-wait_marionette.js rename : testing/web-platform/tests/uievents/keyboard/key-manual.css => testing/web-platform/tests/uievents/keyboard/key.css rename : testing/web-platform/tests/uievents/keyboard/key-manual.js => testing/web-platform/tests/uievents/keyboard/key.js
78 lines
2.6 KiB
HTML
78 lines
2.6 KiB
HTML
<!doctype html>
|
|
<meta charset=utf-8>
|
|
<title>DOMException-throwing tests</title>
|
|
<link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
|
|
<div id=log></div>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script>
|
|
/**
|
|
* This file just picks one case where browsers are supposed to throw an
|
|
* exception, and tests the heck out of whether it meets the spec. In the
|
|
* future, all these checks should be in assert_throws(), but we don't want
|
|
* every browser failing every assert_throws() check until they fix every
|
|
* single bug in their exception-throwing.
|
|
*
|
|
* We don't go out of our way to test everything that's already tested by
|
|
* interfaces.html, like whether all constants are present on the object, but
|
|
* some things are duplicated.
|
|
*/
|
|
setup({explicit_done: true});
|
|
|
|
function testException(exception, global, desc) {
|
|
test(function() {
|
|
assert_equals(global.Object.getPrototypeOf(exception),
|
|
global.DOMException.prototype);
|
|
}, desc + "Object.getPrototypeOf(exception) === DOMException.prototype");
|
|
|
|
|
|
test(function() {
|
|
assert_false(exception.hasOwnProperty("name"));
|
|
}, desc + "exception.hasOwnProperty(\"name\")");
|
|
test(function() {
|
|
assert_false(exception.hasOwnProperty("message"));
|
|
}, desc + "exception.hasOwnProperty(\"message\")");
|
|
|
|
test(function() {
|
|
assert_equals(exception.name, "HierarchyRequestError");
|
|
}, desc + "exception.name === \"HierarchyRequestError\"");
|
|
|
|
test(function() {
|
|
assert_equals(exception.code, global.DOMException.HIERARCHY_REQUEST_ERR);
|
|
}, desc + "exception.code === DOMException.HIERARCHY_REQUEST_ERR");
|
|
|
|
test(function() {
|
|
assert_equals(global.Object.prototype.toString.call(exception),
|
|
"[object DOMException]");
|
|
}, desc + "Object.prototype.toString.call(exception) === \"[object DOMException]\"");
|
|
}
|
|
|
|
|
|
// Test in current window
|
|
var exception = null;
|
|
try {
|
|
// This should throw a HierarchyRequestError in every browser since the
|
|
// Stone Age, so we're really only testing exception-throwing details.
|
|
document.documentElement.appendChild(document);
|
|
} catch(e) {
|
|
exception = e;
|
|
}
|
|
testException(exception, window, "");
|
|
|
|
// Test in iframe
|
|
var iframe = document.createElement("iframe");
|
|
iframe.src = "about:blank";
|
|
iframe.onload = function() {
|
|
var exception = null;
|
|
try {
|
|
iframe.contentDocument.documentElement.appendChild(iframe.contentDocument);
|
|
} catch(e) {
|
|
exception = e;
|
|
}
|
|
testException(exception, iframe.contentWindow, "In iframe: ");
|
|
|
|
document.body.removeChild(iframe);
|
|
done();
|
|
};
|
|
document.body.appendChild(iframe);
|
|
</script>
|