dom/tests/mochitest/ajax/offline/updatingIframe.sjs

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 ver1iframe =
michael@0 2 "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
michael@0 3 "<head>\n" +
michael@0 4 "<title>Update iframe</title>\n" +
michael@0 5 "</head>\n" +
michael@0 6 "<body onload=\"parent.frameLoad(1)\">\n" +
michael@0 7 "First version of updating iframe.\n" +
michael@0 8 "</body>\n" +
michael@0 9 "</html>\n";
michael@0 10
michael@0 11 ver2iframe =
michael@0 12 "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
michael@0 13 "<head>\n" +
michael@0 14 "<title>Update iframe</title>\n" +
michael@0 15 "</head>\n" +
michael@0 16 "<body onload=\"parent.frameLoad(2)\">\n" +
michael@0 17 "Second version of updating iframe.\n" +
michael@0 18 "</body>\n" +
michael@0 19 "</html>\n";
michael@0 20
michael@0 21 function handleRequest(request, response)
michael@0 22 {
michael@0 23 var match = request.queryString.match(/^state=(.*)$/);
michael@0 24 if (match)
michael@0 25 {
michael@0 26 response.setStatusLine(request.httpVersion, 204, "No content");
michael@0 27 setState("offline.updatingIframe", match[1]);
michael@0 28 }
michael@0 29
michael@0 30 if (request.queryString == "")
michael@0 31 {
michael@0 32 response.setStatusLine(request.httpVersion, 200, "Ok");
michael@0 33 response.setHeader("Content-Type", "text/html");
michael@0 34 response.setHeader("Cache-Control", "no-cache");
michael@0 35 switch (getState("offline.updatingIframe"))
michael@0 36 {
michael@0 37 case "": // The default value
michael@0 38 response.write(ver1iframe);
michael@0 39 break;
michael@0 40 case "second":
michael@0 41 response.write(ver2iframe);
michael@0 42 break;
michael@0 43 }
michael@0 44 }
michael@0 45 }

mercurial