OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <div id="console"></div> |
| 3 <script> |
| 4 if (window.testRunner) { |
| 5 testRunner.dumpAsText(); |
| 6 testRunner.waitUntilDone(); |
| 7 } |
| 8 |
| 9 var iframe = document.body.appendChild(document.createElement("iframe")); |
| 10 var o = undefined; |
| 11 |
| 12 function test() { |
| 13 var win = iframe.contentWindow; |
| 14 function recurse() { |
| 15 try { recurse(); } catch(e) {} |
| 16 try { win.location; } catch(e) { |
| 17 o = e; |
| 18 } |
| 19 } |
| 20 recurse(); |
| 21 if (o.constructor.constructor("return location.hostname")() == "127.0.0.1")
{ |
| 22 document.getElementById("console").innerText = "PASS: non-cross-site exc
eption thrown."; |
| 23 } else { |
| 24 document.getElementById("console").innerText = "FAIL: cross-site excepti
on thrown."; |
| 25 } |
| 26 if (window.testRunner) { |
| 27 testRunner.notifyDone(); |
| 28 } |
| 29 } |
| 30 |
| 31 function waitForLoaded() { |
| 32 try { frames[0].a; } catch(e) { |
| 33 clearInterval(interval); |
| 34 test(); |
| 35 } |
| 36 } |
| 37 |
| 38 var interval = setInterval(waitForLoaded, 1); |
| 39 iframe.src = "http://localhost:8000/resources/dummy.html"; |
| 40 </script> |
OLD | NEW |