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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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