blob: 961941ed4e4e3285266bf69b8fa0d0f36b8c26cb [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="/js-test-resources/js-test-pre.js"></script>
<iframe id="crossOriginFrame" src="http://localhost:8000/security/resources/blank.html"></iframe>
<script>
description("Tests that symbols can be accessed on cross origin Window / Location objects");
jsTestIsAsync = true;
window.onload = function() {
crossOriginWindow = document.getElementById("crossOriginFrame").contentWindow;
debug("* Window");
try {
shouldBeEqualToString("(new Object).toString.call(crossOriginWindow)", "[object Object]");
} catch (e) {
testFailed("toString threw an exception: " + e);
}
try {
shouldBeFalse("crossOriginWindow instanceof Window");
} catch (e) {
testFailed("hasInstance threw an exception: " + e);
}
try {
shouldBe("Array.prototype.concat.call(crossOriginWindow, ['A'])", "[crossOriginWindow, 'A']");
} catch (e) {
testFailed("concat threw an exception: " + e);
}
shouldThrowErrorName("crossOriginWindow.toString()", "SecurityError");
shouldThrowErrorName("'' + crossOriginWindow", "SecurityError");
shouldThrowErrorName("crossOriginWindow.concat(['A'])", "SecurityError");
debug("");
debug("* Location");
try {
shouldBeEqualToString("(new Object).toString.call(crossOriginWindow.location)", "[object Object]");
} catch (e) {
testFailed("toString threw an exception: " + e);
}
try {
shouldBeFalse("crossOriginWindow.location instanceof Location");
} catch (e) {
testFailed("hasInstance threw an exception: " + e);
}
try {
shouldBe("Array.prototype.concat.call(crossOriginWindow.location, ['A'])", "[crossOriginWindow.location, 'A']");
} catch (e) {
testFailed("concat threw an exception: " + e);
}
shouldThrowErrorName("crossOriginWindow.location.toString()", "SecurityError");
shouldThrowErrorName("'' + crossOriginWindow.location", "SecurityError");
shouldThrowErrorName("crossOriginWindow.location.concat(['A'])", "SecurityError");
finishJSTest();
}
</script>
<script src="/js-test-resources/js-test-post.js"></script>
</body>
</html>