| Index: third_party/WebKit/LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror.html b/third_party/WebKit/LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..31138b6df7b4337eaa221b2988ff43d70e5a7e50
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror.html
|
| @@ -0,0 +1,56 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="/js-test-resources/js-test.js"></script>
|
| +<script>
|
| +function loadScript(url, async, onload, onerror) {
|
| + var script = document.createElement("script");
|
| + script.async = async;
|
| + script.onload = onload;
|
| + if (onerror)
|
| + script.onerror = onerror;
|
| + script.src = url;
|
| + document.head.appendChild(script);
|
| +}
|
| +</script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +description("Slow scripts that fail to load should not dispatch multiple error events");
|
| +
|
| +window.jsTestIsAsync = true;
|
| +
|
| +if (window.testRunner) {
|
| + testRunner.dumpAsText();
|
| + testRunner.waitUntilDone();
|
| +}
|
| +
|
| +var firstOnErrorHandlerHasRun = false;
|
| +function failedFirst() {
|
| + shouldBeFalse("firstOnErrorHandlerHasRun");
|
| + firstOnErrorHandlerHasRun = true;
|
| + // Issue another script load so as to have the script runner
|
| + // revisit its script queue. This should not result in this
|
| + // onerror handler running again.
|
| + loadScript("resources/success.js?1", true);
|
| +}
|
| +
|
| +var secondOnErrorHandlerHasRun = false;
|
| +function failedSecond() {
|
| + shouldBeTrue("firstOnErrorHandlerHasRun");
|
| + shouldBeFalse("secondOnErrorHandlerHasRun");
|
| + secondOnErrorHandlerHasRun = true;
|
| + loadScript("resources/success.js?2", true, finishJSTest);
|
| +}
|
| +
|
| +function unexpectedLoad() {
|
| + testFailed("Script should not have loaded");
|
| + finishJSTest();
|
| +}
|
| +
|
| +loadScript("resources/success.js?3", false);
|
| +loadScript("resources/slow-nonexisting-script.php?sleep=1", false, unexpectedLoad, failedFirst);
|
| +loadScript("resources/slow-nonexisting-script.php?sleep=2", false, unexpectedLoad, failedSecond);
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|