Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/misc/script-sync-slow-scripts-onerror.html

Issue 1424703007: Upon load failure, remove sync script from pending queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add release assert Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698