browser/devtools/framework/test/browser_toolbox_options_disable_cache.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   /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function handleRequest(request, response) {
     5   let Etag = '"4d881ab-b03-435f0a0f9ef00"';
     6   let IfNoneMatch = request.hasHeader("If-None-Match")
     7                     ? request.getHeader("If-None-Match")
     8                     : "";
    10   let guid = 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    11     let r = Math.random() * 16 | 0;
    12     let v = c === "x" ? r : (r & 0x3 | 0x8);
    14     return v.toString(16);
    15   });
    17   let page = "<!DOCTYPE html><html><body><h1>" + guid + "</h1></body></html>";
    19   response.setHeader("Etag", Etag, false);
    21   if (IfNoneMatch === Etag) {
    22     response.setStatusLine(request.httpVersion, "304", "Not Modified");
    23   } else {
    24     response.setHeader("Content-Type", "text/html; charset=utf-8", false);
    25     response.setHeader("Content-Length", page.length + "", false);
    26     response.write(page);
    27   }
    28 }

mercurial