blob: 374b679094e4f13ac37fb804d1c02ba3c39253ea [file] [log] [blame]
<head><meta charset="iso-8859-1"></head>
<body>
<p>Test how URLs are encoded.</p>
<ol id=result></ol>
<script>
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
document.getElementById("result").appendChild(item);
}
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
<!-- Firefox 3 encodes query part of XMLHttpRequest requests as UTF-8, but WebKit doesn't special case these. -->
var req = new XMLHttpRequest;
req.open("GET", "/xmlhttprequest/resources/print-query.cgi?Zürich", false);
req.send();
log("abs-path: " + (req.responseText == "Z%FCrich" ? "PASS" : "FAIL (" + req.responseText + ")"));
req.open("GET", "resources/print-query.cgi?Zürich", false);
req.send();
log("rel-path: " + (req.responseText == "Z%FCrich" ? "PASS" : "FAIL (" + req.responseText + ")"));
req.open("GET", document.URL.replace(/encode-request-url-2\.html/, "") + "resources/print-query.cgi?Zürich", false);
req.send();
log("absolute: " + (req.responseText == "Z%FCrich" ? "PASS" : "FAIL (" + req.responseText + ")"));
var framesLoaded = 0;
function frameLoaded()
{
++framesLoaded;
if (framesLoaded == 2) {
log("Frame, abs-path: " + (frames[0].document.documentElement.textContent == "Z%FCrich" ? "PASS" : "FAIL (" + frames[0].document.documentElement.textContent + ")"));
log("Frame, rel-path: " + (frames[1].document.documentElement.textContent == "Z%FCrich" ? "PASS" : "FAIL (" + frames[0].document.documentElement.textContent + ")"));
if (window.testRunner)
testRunner.notifyDone();
}
}
</script>
<iframe src="/xmlhttprequest/resources/print-query.cgi?Zürich" onload="frameLoaded()"></iframe>
<iframe src="resources/print-query.cgi?Zürich" onload="frameLoaded()"></iframe>
</body>