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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/ajax/offline/updatingIframe.sjs	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +ver1iframe =
     1.5 +  "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
     1.6 +  "<head>\n" +
     1.7 +  "<title>Update iframe</title>\n" +
     1.8 +  "</head>\n" +
     1.9 +  "<body onload=\"parent.frameLoad(1)\">\n" +
    1.10 +  "First version of updating iframe.\n" +
    1.11 +  "</body>\n" +
    1.12 +  "</html>\n";
    1.13 +
    1.14 +ver2iframe =
    1.15 +  "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
    1.16 +  "<head>\n" +
    1.17 +  "<title>Update iframe</title>\n" +
    1.18 +  "</head>\n" +
    1.19 +  "<body onload=\"parent.frameLoad(2)\">\n" +
    1.20 +  "Second version of updating iframe.\n" +
    1.21 +  "</body>\n" +
    1.22 +  "</html>\n";
    1.23 +
    1.24 +function handleRequest(request, response)
    1.25 +{
    1.26 +  var match = request.queryString.match(/^state=(.*)$/);
    1.27 +  if (match)
    1.28 +  {
    1.29 +    response.setStatusLine(request.httpVersion, 204, "No content");
    1.30 +    setState("offline.updatingIframe", match[1]);
    1.31 +  }
    1.32 +
    1.33 +  if (request.queryString == "")
    1.34 +  {
    1.35 +    response.setStatusLine(request.httpVersion, 200, "Ok");
    1.36 +    response.setHeader("Content-Type", "text/html");
    1.37 +    response.setHeader("Cache-Control", "no-cache");
    1.38 +    switch (getState("offline.updatingIframe"))
    1.39 +    {
    1.40 +      case "": // The default value
    1.41 +        response.write(ver1iframe);
    1.42 +        break;
    1.43 +      case "second":
    1.44 +        response.write(ver2iframe);
    1.45 +        break;
    1.46 +    }
    1.47 +  }
    1.48 +}

mercurial