diff options
Diffstat (limited to 'dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs')
-rw-r--r-- | dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs new file mode 100644 index 000000000..1ce865a8a --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs @@ -0,0 +1,27 @@ +function handleRequest(request, response) +{ + var match = request.queryString.match(/^state=(.*)$/); + if (match) + { + response.setStatusLine(request.httpVersion, 200, "No content"); + setState("state", match[1]); + response.write("state='" + match[1] + "'"); + } + + if (request.queryString == "") + { + switch (getState("state")) + { + case "": // The default value + response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); + response.setHeader("Location", "http://example.com/non-existing-dynamic.html"); + response.setHeader("Content-Type", "text/html"); + break; + case "on": + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "text/html"); + response.write("<html><body>Dynamic page</body></html>"); + break; + } + } +} |