|
Lines 1-14
a/LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp.html_sec1
|
| 1 |
<!DOCTYPE html> |
1 |
<!DOCTYPE html> |
| 2 |
<html> |
2 |
<html> |
| 3 |
<head> |
3 |
<head> |
| 4 |
<meta http-equiv="Content-Security-Policy" content="img-src 'none'"> |
4 |
<meta http-equiv="Content-Security-Policy" content="img-src 'none'; script-src 'unsafe-inline'"> |
| 5 |
<script> |
5 |
<script> |
| 6 |
if (window.testRunner) { |
6 |
if (window.testRunner) { |
| 7 |
testRunner.dumpAsText(); |
7 |
testRunner.dumpAsText(); |
| 8 |
testRunner.waitUntilDone(); |
8 |
testRunner.waitUntilDone(); |
| 9 |
} |
9 |
} |
| 10 |
|
10 |
|
| 11 |
tests = 2; |
11 |
tests = 4; |
| 12 |
window.addEventListener("message", function(message) { |
12 |
window.addEventListener("message", function(message) { |
| 13 |
tests -= 1; |
13 |
tests -= 1; |
| 14 |
test(); |
14 |
test(); |
|
Lines 29-40
a/LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp.html_sec2
|
| 29 |
img.src = "../resources/abe.png"; |
29 |
img.src = "../resources/abe.png"; |
| 30 |
} |
30 |
} |
| 31 |
|
31 |
|
|
|
32 |
function callEval(isolated) { |
| 33 |
try { |
| 34 |
eval("true"); |
| 35 |
alert('Called eval() in ' + (isolated ? "isolated world" : "main world")); |
| 36 |
window.postMessage("next", "*"); |
| 37 |
} catch (error) { |
| 38 |
console.log(error); |
| 39 |
alert('BLOCKED eval() in ' + (isolated ? "isolated world" : "main world")); |
| 40 |
window.postMessage("next", "*"); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 32 |
switch (tests) { |
44 |
switch (tests) { |
| 33 |
case 2: |
45 |
case 4: |
| 34 |
setImgSrc(false); |
46 |
setImgSrc(false); |
| 35 |
break; |
47 |
break; |
|
|
48 |
case 3: |
| 49 |
testRunner.evaluateScriptInIsolatedWorld(1, String(setImgSrc) + "\nsetImgSrc(true);"); |
| 50 |
break; |
| 51 |
case 2: |
| 52 |
callEval(false); |
| 53 |
break; |
| 36 |
case 1: |
54 |
case 1: |
| 37 |
testRunner.evaluateScriptInIsolatedWorld(1, String(eval("setImgSrc")) + "\nsetImgSrc(true);"); |
55 |
testRunner.evaluateScriptInIsolatedWorld(1, String(callEval) + "\ncallEval(true);"); |
| 38 |
break; |
56 |
break; |
| 39 |
case 0: |
57 |
case 0: |
| 40 |
testRunner.notifyDone(); |
58 |
testRunner.notifyDone(); |