| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <meta charset="utf-8"/> | |
| 3 <title>HTML Test: window.frameElement</title> | |
| 4 <link rel="author" title="Intel" href="http://www.intel.com/" /> | |
| 5 <script src="../../../../../../resources/testharness.js"></script> | |
| 6 <script src="../../../../../../resources/testharnessreport.js"></script> | |
| 7 <script> | |
| 8 | |
| 9 var t1 = async_test("The window's frameElement attribute must return its contain
er element if it is a nested browsing context"); | |
| 10 var t2 = async_test("The SecurityError must be thrown if the container's documen
t does not have the same effective script origin"); | |
| 11 | |
| 12 function on_load() { | |
| 13 t1.step(function () { | |
| 14 assert_equals(frames[0].frameElement, document.getElementById("fr1"), | |
| 15 "The frameElement attribute should be the first iframe element
."); | |
| 16 assert_equals(window["win2"].frameElement, document.getElementById("obj"), | |
| 17 "The frameElement attribute should be the object element."); | |
| 18 assert_equals(window["win3"].frameElement, document.getElementById("emb"), | |
| 19 "The frameElement attribute should be the embed element."); | |
| 20 assert_equals(document.getElementById("fr3").contentWindow[0].frameElement, | |
| 21 document.getElementById("fr3").contentDocument.getElementById(
"f1"), | |
| 22 "The frameElement attribute should be the frame element in 'tes
t.html'."); | |
| 23 }); | |
| 24 t1.done(); | |
| 25 | |
| 26 t2.step(function () { | |
| 27 assert_throws("SecurityError", function () { frames[1].frameElement; }, | |
| 28 "The SecurityError exception should be thrown."); | |
| 29 }); | |
| 30 t2.done(); | |
| 31 } | |
| 32 | |
| 33 </script> | |
| 34 <body onload="on_load()"> | |
| 35 <div id="log"></div> | |
| 36 <iframe id="fr1"></iframe> | |
| 37 <iframe id="fr2" src="test.html"></iframe> | |
| 38 <iframe id="fr3" src="" style="display:none"></iframe> | |
| 39 <object id="obj" name="win2" type="text/html" data="about:blank"></object> | |
| 40 <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" /> | |
| 41 <script> | |
| 42 | |
| 43 setup(function () { | |
| 44 var src = "http://{{domains[www1]}}:{{ports[http][0]}}"; | |
| 45 src += document.location.pathname.substring(0, document.location.pathname.la
stIndexOf("/") + 1); | |
| 46 src += "test.html"; | |
| 47 document.getElementById("fr2").src = src; | |
| 48 }); | |
| 49 | |
| 50 test(function () { | |
| 51 assert_equals(window.frameElement, null, | |
| 52 "The frameElement attribute should be null."); | |
| 53 }, "The window's frameElement attribute must return null if it is not a nested
browsing context"); | |
| 54 | |
| 55 </script> | |
| 56 </body> | |
| OLD | NEW |