| OLD | NEW |
| 1 var EXPECT_BLOCK = true; | 1 var EXPECT_BLOCK = true; |
| 2 var EXPECT_LOAD = false; | 2 var EXPECT_LOAD = false; |
| 3 | 3 |
| 4 var SAME_ORIGIN = true; |
| 5 var CROSS_ORIGIN = false; |
| 6 |
| 4 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
| 5 window.wasPostTestScriptParsed = true; | 8 window.wasPostTestScriptParsed = true; |
| 6 | 9 |
| 7 var iframe; | 10 var iframe; |
| 8 function injectFrame(url, shouldBlock) { | 11 function injectFrame(url, shouldBlock) { |
| 9 window.onload = function () { | 12 window.onload = function () { |
| 10 iframe = document.createElement('iframe'); | 13 iframe = document.createElement('iframe'); |
| 11 iframe.onload = iframeLoaded(shouldBlock); | 14 iframe.onload = iframeLoaded(shouldBlock); |
| 12 iframe.src = url; | 15 iframe.src = url; |
| 13 document.body.appendChild(iframe); | 16 document.body.appendChild(iframe); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 59 |
| 57 function injectSharedWorker(url, expectBlock) { | 60 function injectSharedWorker(url, expectBlock) { |
| 58 window.onload = function() { | 61 window.onload = function() { |
| 59 if (expectBlock == EXPECT_BLOCK) | 62 if (expectBlock == EXPECT_BLOCK) |
| 60 shouldThrow("var w = new SharedWorker('" + url + "');"); | 63 shouldThrow("var w = new SharedWorker('" + url + "');"); |
| 61 else | 64 else |
| 62 shouldNotThrow("var w = new SharedWorker('" + url + "');"); | 65 shouldNotThrow("var w = new SharedWorker('" + url + "');"); |
| 63 finishJSTest(); | 66 finishJSTest(); |
| 64 }; | 67 }; |
| 65 } | 68 } |
| 69 |
| 70 function injectFrameWithCSP(url, csp, shouldBlock, sameOrigin) { |
| 71 window.onload = function () { |
| 72 iframe = document.createElement('iframe'); |
| 73 if (shouldBlock == EXPECT_LOAD && sameOrigin == CROSS_ORIGIN) { |
| 74 window.addEventListener("message", function (e) { |
| 75 if (e.source != iframe.contentWindow) { |
| 76 return; |
| 77 } |
| 78 if (e.data != 'loaded') |
| 79 testFailed("The inner IFrame failed."); |
| 80 else |
| 81 testPassed("The inner IFrame passed."); |
| 82 |
| 83 finishJSTest(); |
| 84 }); |
| 85 } else { |
| 86 iframe.onload = iframeLoaded(shouldBlock); |
| 87 } |
| 88 iframe.src = url; |
| 89 iframe.csp = csp; |
| 90 document.body.appendChild(iframe); |
| 91 }; |
| 92 } |
| OLD | NEW |