blob: 7d230139b30b6f1e24d2960e4038705ced37572d [file] [log] [blame]
<html>
<head>
<script src="resources/cross-frame-access.js"></script>
<script>
window.onload = function()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (window.testRunner) {
setTimeout(pollForTest, 1);
} else {
log("To run the test, click the button below when the opened window finishes loading.");
var button = document.createElement("button");
button.appendChild(document.createTextNode("Run Test"));
button.onclick = runTest;
document.body.appendChild(button);
}
}
pollForTest = function()
{
if (!testRunner.globalFlag) {
setTimeout(pollForTest, 1);
return;
}
runTest();
testRunner.notifyDone();
}
runTest = function()
{
window.targetWindow = frames[0];
log("----- tests for getting a targetWindow's location object's functions which have custom overrides. The" +
" desired behavior is for the targetWindow to return the builtin function, not the override -----\n");
// We should test overriding using window.location.__proto__ once the Location object has a proper prototype.
// Overriden using window.location.assign = function() { return "new assign" }
shouldBeFalse("canGet('targetWindow.location.assign')");
// Overriden using window.location.reload = "new reload"
shouldBeFalse("canGet('targetWindow.location.reload')");
// Overriden using window.location.reload = "new replace"
shouldBeTrue("canGet('targetWindow.location.replace')");
shouldBe("toString('targetWindow.location.replace')", "toString('window.location.replace')");
}
</script>
</head>
<body>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-location-get-override-test.html"></iframe>
<pre id="console"></pre>
</body>
</html>