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

Side by Side Diff: LayoutTests/loader/iframe-sync-loads.html

Issue 210253003: Make data: urls always parse async (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 8 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
OLDNEW
(Empty)
1 <body>
2 <pre id="log"></pre>
3 <script>
4 function log(msg) {
5 document.getElementById("log").textContent += msg + "\n";
6 }
7
8 function getText(iframe) {
9 return iframe.contentDocument.documentElement.textContent;
10 }
11
12 var testIndex = 0;
13
14 function runTest(name, testFunction) {
15 var iframe = document.createElement('iframe');
16 document.body.appendChild(iframe);
17
18 var expectedText = "foo " + testIndex;
19 iframe.onerror = function() {
20 log(name + ' error ' + getText(iframe));
21 }
22 testFunction(iframe, expectedText);
23 var resultText = getText(iframe);
24 if (resultText == expectedText) {
25 log(' sync : ' + name);
26 iframe.parentNode.removeChild(iframe);
27 nextTest();
28 } else {
29 iframe.onload = function() {
30 log('ASYNC : ' + name);
31 iframe.parentNode.removeChild(iframe);
32 nextTest();
33 }
34 }
35 }
36
37 var tests = [
38 { name: 'src = javascript:"content"', testFunction: function(iframe, expecte dText) { iframe.src = 'javascript: "' + expectedText + '"'} },
39 { name: 'src = data:text/html,content', testFunction: function(iframe, expec tedText) { iframe.src = 'data:text/html,"' + expectedText + '"'} },
40 { name: 'srcdoc = "content"', testFunction: function(iframe, expectedText) { iframe.src = 'data:text/html,"' + expectedText + '"'} },
41 ];
42
43 if (window.testRunner) {
44 testRunner.dumpAsText();
45 testRunner.waitUntilDone();
46 }
47
48 function nextTest() {
49 if (testIndex >= tests.length) {
50 log("done");
51 if (window.testRunner)
52 testRunner.notifyDone();
53 return;
54 }
55 var test = tests[testIndex++];
56 runTest(test.name, test.testFunction);
57 }
58 nextTest();
59 </script>
OLDNEW
« no previous file with comments | « LayoutTests/html5lib/resources/runner.js ('k') | LayoutTests/loader/iframe-sync-loads-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698