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

Unified Diff: LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi

Issue 23903029: [HTML Imports] Employ load/error events to stabilize polling-based tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 years, 3 months 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
« no previous file with comments | « LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi
diff --git a/LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi b/LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi
index bbdbf1eb9992bef5ba89bfe95d8a9098cb39cf3e..c588e5bfce017bea19464d328485571a53514f34 100755
--- a/LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi
+++ b/LayoutTests/http/tests/htmlimports/resources/cors-having-crossorigin-scripts.cgi
@@ -8,19 +8,35 @@ print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n";
print <<EOF
<html><body>
<script>
+var scriptListToLoad = [
+ 'http://127.0.0.1:8000/htmlimports/resources/external-script.js',
+ 'http://127.0.0.1:8000/htmlimports/resources/cors-js.cgi',
+ 'http://127.0.0.1:8000/htmlimports/resources/cors-js-for-localhost.cgi',
+ 'run-check.js'
+];
+
thisDocument = document.currentScript.ownerDocument;
+function loadTestIfReady() {
+ if (scriptListToLoad.length)
+ loadPendingScript();
+}
+
function loadScriptFrom(url) {
var element = thisDocument.createElement("script");
element.setAttribute("crossorigin", "");
element.setAttribute("src", url);
+ element.onload = element.onerror = loadTestIfReady;
thisDocument.head.appendChild(element);
return element;
}
-loadScriptFrom('http://127.0.0.1:8000/htmlimports/resources/external-script.js');
-loadScriptFrom('http://127.0.0.1:8000/htmlimports/resources/cors-js.cgi');
-loadScriptFrom('http://127.0.0.1:8000/htmlimports/resources/cors-js-for-localhost.cgi');
-window.setTimeout(function() { loadScriptFrom('run-check.js'); }, 100);
+function loadPendingScript()
+{
+ var url = scriptListToLoad.shift();
+ loadScriptFrom(url);
+}
+
+loadPendingScript();
</script>
</body></html>
EOF
« no previous file with comments | « LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698