blob: 018f51bec46849e2a6aa265fef8aa284ce2c7809 [file] [log] [blame]
<html>
<head>
<script>
function print(message, color)
{
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
function shouldBe(a, b)
{
var internalFrame = document.getElementById ('internal');
var evalA = eval(a);
if (evalA == b)
print("PASS: " + a + " should be " + b + " and is.", "green");
else {
print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
}
}
function checkTest1() {
var internalFrame = document.getElementById ('internal');
shouldBe('internalFrame.contentWindow.location.port == ""', true);
internalFrame.contentWindow.location.port = "";
setTimeout(checkTest2, 300);
}
function checkTest2() {
var internalFrame = document.getElementById ('internal');
shouldBe('internalFrame.contentWindow.location.port == ""', true);
internalFrame.contentWindow.location.port = 80;
setTimeout(checkTest3, 300);
}
function checkTest3() {
var internalFrame = document.getElementById ('internal');
shouldBe('internalFrame.contentWindow.location.port == ""', true);
internalFrame.contentWindow.location.port = 0;
setTimeout(checkTest4, 300);
}
function checkTest4() {
var internalFrame = document.getElementById ('internal');
shouldBe('internalFrame.contentWindow.location.host', '');
if (window.testRunner)
testRunner.notifyDone();
}
function runTests() {
if (window.testRunner) {
testRunner.clearBackForwardList();
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var internalFrame = document.getElementById ('internal');
shouldBe('internalFrame.contentWindow.location.port == ""', true);
internalFrame.contentWindow.location.port = 88;
setTimeout(checkTest1, 300);
};
</script>
</head>
<body onload="runTests();">
<p>This tests that modifying location.port works as it should</p>
<iframe id="internal" style="display: none;" src="resources/location-port-iframe.html" width="0" height="0">
</iframe>
<div id="console">
</div>
</body>
</html>