|
|
|
Lines 34-51
function ok_wrapper(result, desc) {
|
Link Here
|
|---|
|
| 34 |
ok(result, desc); |
34 |
ok(result, desc); |
| 35 |
|
35 |
|
| 36 |
completedTests++; |
36 |
completedTests++; |
| 37 |
|
37 |
|
| 38 |
if (result) { |
38 |
if (result) { |
| 39 |
passedTests++; |
39 |
passedTests++; |
| 40 |
} |
40 |
} |
| 41 |
|
41 |
|
| 42 |
if (completedTests == 6) { |
42 |
if (completedTests == 13) { |
| 43 |
is(passedTests, 6, "there should be 6 passed inheritance tests"); |
43 |
is(passedTests, completedTests, "there should be " + completedTests + " passed inheritance tests"); |
| 44 |
SimpleTest.finish(); |
44 |
SimpleTest.finish(); |
| 45 |
} |
45 |
} |
| 46 |
} |
46 |
} |
| 47 |
|
47 |
|
| 48 |
function doTest() { |
48 |
function doTest() { |
| 49 |
// fails if bad |
49 |
// fails if bad |
| 50 |
// 1) an iframe with no sandbox attribute inside an iframe that has sandbox = "" |
50 |
// 1) an iframe with no sandbox attribute inside an iframe that has sandbox = "" |
| 51 |
// should not be able to execute scripts (cannot ever loosen permissions) |
51 |
// should not be able to execute scripts (cannot ever loosen permissions) |
|
Lines 97-118
function doTest() {
|
Link Here
|
|---|
|
| 97 |
// 10) a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
97 |
// 10) a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
| 98 |
// origin with this document |
98 |
// origin with this document |
| 99 |
// done by file_iframe_sandbox_a_if11.html which is contained with file_iframe_sandbox_a_if10.html |
99 |
// done by file_iframe_sandbox_a_if11.html which is contained with file_iframe_sandbox_a_if10.html |
| 100 |
|
100 |
|
| 101 |
// passes if good |
101 |
// passes if good |
| 102 |
// 11) a <frame> inside a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
102 |
// 11) a <frame> inside a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
| 103 |
// origin with its parent frame or this document |
103 |
// origin with its parent frame or this document |
| 104 |
// done by file_iframe_sandbox_a_if12.html which is contained with file_iframe_sandbox_a_if11.html |
104 |
// done by file_iframe_sandbox_a_if12.html which is contained with file_iframe_sandbox_a_if11.html |
|
|
105 |
|
| 106 |
// passes if good, fails if bad |
| 107 |
// 12) An <object> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
| 108 |
// origin with this document |
| 109 |
// Done by file_iframe_sandbox_a_if14.html which is contained within file_iframe_sandbox_a_if13.html |
| 110 |
|
| 111 |
// passes if good, fails if bad |
| 112 |
// 13) An <object> inside an <object> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
| 113 |
// origin with its parent frame or this document |
| 114 |
// Done by file_iframe_sandbox_a_if15.html which is contained within file_iframe_sandbox_a_if14.html |
| 115 |
|
| 116 |
// passes if good, fails if bad |
| 117 |
// 14) An <object> inside a <frame> inside an <iframe> sandboxed with 'allow-scripts' should not be same |
| 118 |
// origin with its parent frame or this document |
| 119 |
// Done by file_iframe_sandbox_a_if15.html which is contained within file_iframe_sandbox_a_if16.html |
| 120 |
// which is contained within file_iframe_sandbox_a_if10.html |
| 121 |
|
| 122 |
// passes if good |
| 123 |
// 15) An <object> inside an <object> inside an <iframe> sandboxed with 'allow-scripts allow-forms' |
| 124 |
// should be able to submit forms. |
| 125 |
// Done by file_iframe_sandbox_a_if15.html which is contained within file_iframe_sandbox_a_if14.html |
| 126 |
|
| 127 |
// passes if good |
| 128 |
// 16) An <object> inside a <frame> inside an <iframe> sandboxed with 'allow-scripts allow-forms' |
| 129 |
// should be able to submit forms. |
| 130 |
// Done by file_iframe_sandbox_a_if15.html which is contained within file_iframe_sandbox_a_if16.html |
| 131 |
// which is contained within file_iframe_sandbox_a_if10.html |
| 132 |
|
| 133 |
// fails if bad |
| 134 |
// 17) An <object> inside an <iframe> sandboxed with 'allow-same-origin' |
| 135 |
// should not be able to run scripts. |
| 136 |
// Done by iframe "if_no_scripts" using a data: load. |
| 137 |
|
| 138 |
// passes if good |
| 139 |
// 18) An <object> inside an <iframe> sandboxed with 'allow-scripts allow-same-origin' |
| 140 |
// should be able to run scripts and be same origin with this document. |
| 141 |
// Done by iframe "if_scripts" using a data: load. |
| 142 |
|
| 143 |
// passes if good, fails if bad |
| 144 |
// 19) Make sure that the parent's document's sandboxing flags are copied when |
| 145 |
// changing the sandbox flags on an iframe inside an iframe. |
| 146 |
// Done in file_iframe_sandbox_a_if17.html and file_iframe_sandbox_a_if18.html |
| 105 |
} |
147 |
} |
| 106 |
|
148 |
|
| 107 |
addLoadEvent(doTest); |
149 |
addLoadEvent(doTest); |
| 108 |
</script> |
150 |
</script> |
| 109 |
<body> |
151 |
<body> |
| 110 |
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=341604">Mozilla Bug 341604</a> - Implement HTML5 sandbox attribute for IFRAMEs |
152 |
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=341604">Mozilla Bug 341604</a> - Implement HTML5 sandbox attribute for IFRAMEs |
| 111 |
<p id="display"></p> |
153 |
<p id="display"></p> |
| 112 |
<div id="content"> |
154 |
<div id="content"> |
| 113 |
<iframe sandbox="" id="if_1" src="file_iframe_sandbox_a_if1.html" height="10" width="10"></iframe> |
155 |
<iframe sandbox="" id="if_1" src="file_iframe_sandbox_a_if1.html" height="10" width="10"></iframe> |
| 114 |
<iframe sandbox="allow-scripts" id="if_3" src="file_iframe_sandbox_a_if3.html" height="10" width="10"></iframe> |
156 |
<iframe sandbox="allow-scripts" id="if_3" src="file_iframe_sandbox_a_if3.html" height="10" width="10"></iframe> |
| 115 |
<iframe sandbox="allow-scripts allow-same-origin" id="if_5" src="file_iframe_sandbox_a_if5.html" height="10" width="10"></iframe> |
157 |
<iframe sandbox="allow-scripts allow-same-origin" id="if_5" src="file_iframe_sandbox_a_if5.html" height="10" width="10"></iframe> |
| 116 |
<iframe sandbox="allow-scripts allow-same-origin" id="if_8" src="file_iframe_sandbox_a_if8.html" height="10" width="10"></iframe> |
158 |
<iframe sandbox="allow-scripts allow-same-origin" id="if_8" src="file_iframe_sandbox_a_if8.html" height="10" width="10"></iframe> |
| 117 |
<iframe sandbox="allow-scripts" id="if_10" src="file_iframe_sandbox_a_if10.html" height="10" width="10"></iframe> |
159 |
<iframe sandbox="allow-scripts allow-forms" id="if_10" src="file_iframe_sandbox_a_if10.html" height="10" width="10"></iframe> |
|
|
160 |
<iframe sandbox="allow-scripts allow-forms" id="if_13" src="file_iframe_sandbox_a_if13.html" height="10" width="10"></iframe> |
| 161 |
<iframe sandbox="allow-same-origin" id="if_no_scripts" src="data:text/html,<object%20data='data:text/html,<script>parent.parent.ok_wrapper(false, "an object inside an iframe sandboxed with only allow-same-origin should not be able to run scripts")</script>'></object>" height="10" width="10"></iframe> |
| 162 |
<iframe sandbox="allow-scripts allow-same-origin" id="if_scripts" src="data:text/html,<object%20data='data:text/html,<script>parent.parent.ok_wrapper(true, "an object inside an iframe sandboxed with allow-scripts allow-same-origin should be able to run scripts and call functions in the parent of the iframe")</script>'></object>" height="10" width="10"></iframe> |
| 163 |
<iframe sandbox="allow-same-origin" id="if_19" src="data:text/html,<iframe%20data='data:text/html,<script>parent.parent.ok_wrapper(true, "an object inside an iframe sandboxed with allow-scripts allow-same-origin should be able to run scripts and call functions in the parent of the iframe")</script>'></object>" height="10" width="10"></iframe> |
| 164 |
<iframe sandbox="allow-scripts" id="if_17" src="file_iframe_sandbox_a_if17.html" height="10" width="10"></iframe> |
| 118 |
</div> |
165 |
</div> |