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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/perl -wT 1 #!/usr/bin/perl -wT
2 use strict; 2 use strict;
3 3
4 print "Content-Type: text/html\n"; 4 print "Content-Type: text/html\n";
5 print "Access-Control-Allow-Credentials: true\n"; 5 print "Access-Control-Allow-Credentials: true\n";
6 print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n"; 6 print "Access-Control-Allow-Origin: http://127.0.0.1:8000\n\n";
7 7
8 print <<EOF 8 print <<EOF
9 <html><body> 9 <html><body>
10 <script> 10 <script>
11 var scriptListToLoad = [
12 'http://127.0.0.1:8000/htmlimports/resources/external-script.js',
13 'http://127.0.0.1:8000/htmlimports/resources/cors-js.cgi',
14 'http://127.0.0.1:8000/htmlimports/resources/cors-js-for-localhost.cgi',
15 'run-check.js'
16 ];
17
11 thisDocument = document.currentScript.ownerDocument; 18 thisDocument = document.currentScript.ownerDocument;
19 function loadTestIfReady() {
20 if (scriptListToLoad.length)
21 loadPendingScript();
22 }
23
12 function loadScriptFrom(url) { 24 function loadScriptFrom(url) {
13 var element = thisDocument.createElement("script"); 25 var element = thisDocument.createElement("script");
14 element.setAttribute("crossorigin", ""); 26 element.setAttribute("crossorigin", "");
15 element.setAttribute("src", url); 27 element.setAttribute("src", url);
28 element.onload = element.onerror = loadTestIfReady;
16 thisDocument.head.appendChild(element); 29 thisDocument.head.appendChild(element);
17 return element; 30 return element;
18 } 31 }
19 32
20 loadScriptFrom('http://127.0.0.1:8000/htmlimports/resources/external-script.js') ; 33 function loadPendingScript()
21 loadScriptFrom('http://127.0.0.1:8000/htmlimports/resources/cors-js.cgi'); 34 {
22 loadScriptFrom('http://127.0.0.1:8000/htmlimports/resources/cors-js-for-localhos t.cgi'); 35 var url = scriptListToLoad.shift();
23 window.setTimeout(function() { loadScriptFrom('run-check.js'); }, 100); 36 loadScriptFrom(url);
37 }
38
39 loadPendingScript();
24 </script> 40 </script>
25 </body></html> 41 </body></html>
26 EOF 42 EOF
OLDNEW
« 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