Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Null frame access tests</title> | 4 <title>Null frame access tests</title> |
| 5 <script src="../../../resources/js-test.js"></script> | 5 <script src="../../../resources/testharness.js"></script> |
| 6 <script src="../../../resources/testharnessreport.js"></script> | |
| 6 <script> | 7 <script> |
| 7 description("This tests access to a window with a null frame. You should see \"P ASS\" for each of the three tests below."); | 8 var t = async_test('This tests access to a window with a null frame.'); |
| 8 | 9 |
| 9 window.jsTestIsAsync = true; | 10 window.onload = t.step_func(function () { |
| 10 window.onload = function() { | 11 var childWindow = window[0]; |
| 11 if (window.testRunner) { | 12 childWindow.frameElement.remove(); |
| 12 testRunner.dumpAsText(); | 13 // Removing the owner element from the DOM should null the frame. In Blink, |
| 13 testRunner.waitUntilDone(); | 14 // this can be observed by checking childWindow.parent == null. |
| 14 } | 15 assert_equals(childWindow.parent, null); |
| 15 | 16 |
| 16 var tag = document.getElementById('subframe'); | 17 assert_equals(childWindow.test, 'abc', 'Named property should still be accessi ble.'); |
| 17 var win = tag.contentWindow; | 18 assert_equals(childWindow[20], '123', 'Indexed property should still be access ible.'); |
| 18 // remove the element so the window has a null frame | 19 // TODO(dcheng): Why does this return null? |
| 19 tag.parentNode.removeChild(tag); | 20 assert_equals(childWindow.Comment, undefined, 'Interface Object should be gone .'); |
|
dcheng
2017/03/06 06:59:46
I don't understand this, btw... but that seems to
| |
| 20 | 21 t.done(); |
| 21 // schedule to run after the frame is null | 22 }); |
| 22 asyncGC(function() { | |
| 23 debug("missing property: " + (win.test || 'PASS')) | |
| 24 debug("missing array index: " + (win[20] || 'PASS')); | |
| 25 debug("missing interface object: " + (win.Comment || 'PASS')); | |
| 26 finishJSTest(); | |
| 27 }); | |
| 28 }; | |
| 29 </script> | 23 </script> |
| 30 </head> | 24 </head> |
| 31 <body> | 25 <body> |
| 32 <iframe id="subframe" src="data:text/html,<script>window.test='FAIL ... '; window[20]='FAIL ... ';</script>" /> | 26 <iframe id="subframe" src="data:text/html,<script>window.test='abc';window [20]='123';</script>" /> |
| 33 </body> | 27 </body> |
| 34 </html> | 28 </html> |
| OLD | NEW |