1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/framework/test/browser_toolbox_options_disable_cache.sjs Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 + /* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function handleRequest(request, response) { 1.8 + let Etag = '"4d881ab-b03-435f0a0f9ef00"'; 1.9 + let IfNoneMatch = request.hasHeader("If-None-Match") 1.10 + ? request.getHeader("If-None-Match") 1.11 + : ""; 1.12 + 1.13 + let guid = 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 1.14 + let r = Math.random() * 16 | 0; 1.15 + let v = c === "x" ? r : (r & 0x3 | 0x8); 1.16 + 1.17 + return v.toString(16); 1.18 + }); 1.19 + 1.20 + let page = "<!DOCTYPE html><html><body><h1>" + guid + "</h1></body></html>"; 1.21 + 1.22 + response.setHeader("Etag", Etag, false); 1.23 + 1.24 + if (IfNoneMatch === Etag) { 1.25 + response.setStatusLine(request.httpVersion, "304", "Not Modified"); 1.26 + } else { 1.27 + response.setHeader("Content-Type", "text/html; charset=utf-8", false); 1.28 + response.setHeader("Content-Length", page.length + "", false); 1.29 + response.write(page); 1.30 + } 1.31 +}