Skip to content

Commit

Permalink
Bug 1509607 [wpt PR 14218] - Add muted error tests for redirected scr…
Browse files Browse the repository at this point in the history
…ipts, a=testonly

Automatic update from web-platform-tests
Add muted error tests for redirected scripts

Helps with whatwg/fetch#737.
--

wpt-commits: 18bb80e6e1254b36db6467fdd1aa1e9e7748bb58
wpt-pr: 14218

UltraBlame original commit: d1852804c36e57cb123dc6a336c58e986e16e02f
  • Loading branch information
marco-c committed Oct 3, 2019
1 parent 1b1727e commit e54d0cd
Showing 1 changed file with 18 additions and 1 deletion.
Expand Up @@ -4,7 +4,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// https://html.spec.whatwg.org/#report-the-error
// https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error
// If script's muted errors is true, then set message to "Script error.",
// urlString to the empty string, line and col to 0, and errorValue to null.
setup({allow_uncaught_exception: true});
Expand Down Expand Up @@ -43,10 +43,27 @@
script.onload = test3.step_func_done(() => check(true));
document.body.appendChild(script);
}

var test4 = async_test("Errors for same-origin scripts redirected to a " +
"cross-origin url and redirected back to " +
"same-origin should be muted");
var check4 = test4.step_func_done(() => check(true));

var test5 = async_test("Errors for cross-origin scripts redirected to a " +
"same-origin url should be muted");
var check5 = test5.step_func_done(() => check(true));

function unreachable() { log.push("unexpected"); }
</script>
<script src="cacheable-script-throw.py" onerror="test1.unreached_func()()" onload="check1()"></script>
<script src="//{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py"
onerror="test2.unreached_func()()" onload="check2()"></script>
<iframe src="//{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/muted-errors-iframe.html"
onerror="test3.unreached_func()()" onload="step3()"></iframe>
<script src="/fetch/api/resources/redirect.py?location=
//{{domains[www2]}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=
//{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py?same-cross-same"
onerror="test4.unreached_func()()" onload="check4()"></script>
<script src="//{{domains[www2]}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=
//{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py?cross-same"
onerror="test5.unreached_func()()" onload="check5()"></script>

0 comments on commit e54d0cd

Please sign in to comment.