blob: 2a86aa78796173c9838e437f96e2c1e5a9af38f8 [file] [log] [blame]
<html>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function startTest()
{
window.setTimeout("createFrame(0);", 0);
}
var testCodes = [301, 302, 303, 307];
function createFrame(index)
{
var h4 = document.createElement("h4");
h4.innerHTML = testCodes[index] + " redirect";
document.body.appendChild(h4);
var iframe = document.createElement("iframe");
iframe.setAttribute("testCode", testCodes[index]);
iframe.setAttribute("id", index);
iframe.setAttribute("name", index);
iframe.setAttribute("height", "90px");
document.body.appendChild(iframe);
iframe.src="resources/redirect-methods-form.html";
iframe.setAttribute("onload", "iframeLoaded(" + index + ");");
}
function iframeLoaded(frameID)
{
var iframe = document.getElementById(frameID);
if (iframe.hasAttribute("submitted")) {
if (++frameID == testCodes.length) {
if (window.testRunner) {
// Before finishing the test, we have to allow the callstack to
// unwind - this enables dumping of pending WebLocalFrameClient
// callbacks (i.e. didFinishLoad and/or didHandleOnloadEvents).
window.setTimeout(function() {
testRunner.notifyDone();
}, 0);
}
return;
}
createFrame(frameID);
} else {
submitFormForFrame(iframe);
}
}
function submitFormForFrame(iframe)
{
var testInput = iframe.contentDocument.getElementById("testFormInput");
testInput.value = iframe.getAttribute("testCode");
var testForm = iframe.contentDocument.getElementById("testForm");
iframe.setAttribute("submitted", "true");
testForm.submit();
}
</script>
</head>
<body onload="startTest();">
This test checks to see what HTTP method is used to fetch the final resource in the case where the first request results in a redirect.<br>
301, 302, 303, and 307 http redirects are all tested.<br>
</body>
</html>