blob: d2b9d632d38b29fb41d9d344fa94287d74292321 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<pre id="console"></pre>
<iframe id="aFrame"></iframe>
<script>
function log(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
}
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var targetWindow = frames[0];
if (!targetWindow.document)
log("FAIL: targetWindow started with no document, we won't know if the test passed or failed.");
var selection = targetWindow.getSelection();
var iframe = document.getElementById('aFrame');
targetWindow.location = "http://localhost:8000/security/resources/foreign-domain-iframe-for-selection-test.html";
setTimeout(test, 1);
setTimeout(function() {
log("FAIL: Tested timed-out.");
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 5000);
function test() {
if (targetWindow.document) {
setTimeout(test, 1);
return;
}
try {
var newDoc = selection.anchorNode.ownerDocument;
if (newDoc.baseURI == "http://localhost:8000/security/resources/foreign-domain-iframe-for-selection-test.html")
log("FAIL: Cross-site access allowed.");
} catch (e) {
log("PASS: Cross-site access denied.");
}
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
</body>
</html>