| <p>This test checks cross-frame access security for first-time access to the document (rdar://problem/5251309).</p> |
| <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-get-test.html" style=""></iframe> |
| <pre id="console"></pre> |
| |
| <script> |
| function log(s) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| } |
| |
| function canGet(keyPath) |
| { |
| try { |
| return eval("window." + keyPath) !== undefined; |
| } catch(e) { |
| return false; |
| } |
| } |
| |
| window.onload = function() |
| { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| } |
| |
| var doc; |
| try { |
| doc = frames[0].document; |
| } catch (e) { |
| log("PASS: Exception thrown trying to get cross-domain document: " + e); |
| } |
| |
| log("canGet(frames[0], 'document'): " + (doc !== undefined)); |
| log("canGet(frames[0].document, 'cookie'): " + canGet(doc, 'cookie')); |
| log("canGet(frames[0].document, 'body'): " + canGet(doc, 'body')); |
| log("canGet(frames[0].document, 'location'): " + canGet(doc, 'location')); |
| } |
| </script> |