blob: fecfca8ee0874abb11c2cfc3c6926b1a3d06daba [file] [log] [blame]
<html>
<head>
<script src="../resources/cross-frame-access.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
}
var openedWindow;
function loaded() {
var url = "data:text/html,<html>"
+ "<head>"
+ "<scr" + "ipt>"
+ "function fireSentinel() {"
+ "if (window.testRunner)"
+ "testRunner.globalFlag = true;"
+ "}"
+ "</scr" + "ipt>"
+ "</head>"
+ "<body onload=\"fireSentinel();\">"
+ "<p>Opened Frame</p>"
+ "<p id='accessMe'>PASS: Cross frame access from an opener frame was denied</p>"
+ "</body>"
+ "</html>";
openedWindow = window.open(url);
if (window.testRunner) {
setTimeout(waitForFlag, 1);
function waitForFlag() {
if (!testRunner.globalFlag) {
setTimeout(waitForFlag, 1);
return;
}
performTest();
}
} else {
log("Click the button when all the subframes have finished loading.");
}
}
function performTest() {
try {
openedWindow.document.getElementById('accessMe').innerHTML = 'FAIL: Access to a window opened with a data: URL was allowed.';
} catch (e) {
console.log(e);
}
if (window.testRunner)
closeWindowAndNotifyDone(openedWindow);
}
</script>
</head>
<body onload="loaded();">
<p>Opener Frame</p>
<button onclick="performTest()">Test</button>
<pre id="console"></pre>
</body>
</html>