mobile/android/base/tests/robocop_404.sjs

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /**
     2  * Used with testThumbnails.
     3  * On the first visit, the page is green.
     4  * On subsequent visits, the page is red.
     5  */
     7 function handleRequest(request, response) {
     8   let type = request.queryString.match(/^type=(.*)$/)[1];
     9   let state = "thumbnails." + type;
    10   let color = "#0f0";
    11   let status = 200;
    13   if (getState(state)) {
    14     color = "#f00";
    15     if (type == "do404")
    16       status = 404;
    17   } else {
    18     setState(state, "1");
    19   }
    21   response.setStatusLine(request.httpVersion, status, null);
    22   response.setHeader("Content-Type", "text/html", false);
    23   response.setHeader("Cache-Control", "no-cache", false);
    24   response.write('<html>');
    25   response.write('<head><title>' + type + '</title> <meta charset="utf-8"> </head>');
    26   response.write('<body style="background-color: ' + color + '"></body>');
    27   response.write('</html>');
    28 }

mercurial