Bug 1817567 [wpt PR 38581] - URL: correct location.href failure tests, a=testonly

Automatic update from web-platform-tests
URL: correct location.href failure tests

Tests depended on results of prior tests and the tested exception was incorrect per the HTML Standard.
--

wpt-commits: 5ff3ad864bcf03509806e1feeb3bc208f9ffae1f
wpt-pr: 38581
This commit is contained in:
Anne van Kesteren 2023-02-21 10:59:43 +00:00 committed by moz-wptsync-bot
parent ca1b92e473
commit a3ca8f5af6

View file

@ -5,7 +5,6 @@
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<iframe></iframe>
<script>
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runTests), "Loading data…")
@ -41,9 +40,11 @@ function runTests(testData) {
assert_throws_js(TypeError, () => self.navigator.sendBeacon(test.input))
}, "sendBeacon(): " + name)
self.test(() => {
assert_throws_js(self[0].TypeError, () => self[0].location = test.input)
}, "Location's href: " + name)
self.test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
t.add_cleanup(() => frame.remove());
assert_throws_dom("SyntaxError", frame.contentWindow.DOMException, () => frame.contentWindow.location = test.input);
}, "Location's href: " + name);
self.test(() => {
assert_throws_dom("SyntaxError", () => self.open(test.input).close())