blob: 1b24e9d44c571af87c6641e10046600d9d4ba440 [file] [log] [blame]
<html>
<head>
<script src="resources/cross-frame-access.js"></script>
</head>
<body>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-get-test.html" style=""></iframe>
<pre id="console"></pre>
<script>
window.targetWindow = frames[0];
window.onload = function()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
log("\n----- tests for getting/setting window.location and its properties -----\n");
shouldBeTrue("canGet('targetWindow.location')");
shouldBe("toString('targetWindow.location', '')", "''");
log("Firefox allows access to 'location.toString' but throws an exception when you call it.");
shouldBeFalse("canGet('targetWindow.location.toString')");
shouldBeFalse("canSet('targetWindow.location.toString')");
shouldBeFalse("canGet('targetWindow.location.href')");
shouldBeFalse("canGet('targetWindow.location.hash')");
shouldBeFalse("canGet('targetWindow.location.host')");
shouldBeFalse("canGet('targetWindow.location.hostname')");
shouldBeFalse("canGet('targetWindow.location.pathname')");
shouldBeFalse("canGet('targetWindow.location.port')");
shouldBeFalse("canGet('targetWindow.location.protocol')");
shouldBeFalse("canGet('targetWindow.location.search')");
// FIXME -- not sure these settable tests actually test anything (because you can't read the results)
shouldBeFalse("canSet('targetWindow.location')");
shouldBeFalse("canSet('targetWindow.location.href')");
shouldBeFalse("canSet('targetWindow.location.hash')");
shouldBeFalse("canSet('targetWindow.location.host')");
shouldBeFalse("canSet('targetWindow.location.hostname')");
shouldBeFalse("canSet('targetWindow.location.pathname')");
shouldBeFalse("canSet('targetWindow.location.port')");
shouldBeFalse("canSet('targetWindow.location.protocol')");
shouldBeFalse("canSet('targetWindow.location.search')");
shouldBeTrue("canGet('targetWindow.location.assign')");
shouldBeTrue("canGet('targetWindow.location.reload')");
shouldBeTrue("canGet('targetWindow.location.replace')");
log("Firefox allows calling the 'location' functions exception, bizzarely, 'assign'");
shouldBeTrue("canCall('targetWindow.location.assign', 'data:text/html,<p>in ur location object</p>')");
shouldBeTrue("canCall('targetWindow.location.reload')");
shouldBeTrue("canCall('targetWindow.location.replace', 'data:text/html,<p>in ur location object</p>')");
// Work around DRT bug that causes subsequent tests to fail.
window.stop();
}
</script>
</body>
</html>