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

mercurial