blob: 74fd338bfd8025ef843146fd79f34bb0c2b5c9ea [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 history object's functions which have custom overrides. The" +
" desired behavior is for the targetWindow to return the builtin function, not the override -----\n");
// Overriden using window.history.back = function() { return "new back" }
shouldBeTrue("canGet('targetWindow.history.back')");
shouldBe("toString('targetWindow.history.back')", "toString('window.history.back')");
// Overriden using window.history.__proto__.forward = function() { return "new forward;" }
shouldBeTrue("canGet('targetWindow.history.forward')");
shouldBe("toString('targetWindow.history.forward')", "toString('window.history.forward')");
// Overriden using window.history.go = "new go"
shouldBeTrue("canGet('targetWindow.history.go')");
shouldBe("toString('targetWindow.history.go')", "toString('window.history.go')");
}
</script>
</head>
<body>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-history-get-override-test.html"></iframe>
<pre id="console"></pre>
</body>
</html>