1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/identity/tests/chrome/sandbox_content.sjs Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +function handleRequest(request, response) { 1.9 + response.setHeader("Cache-Control", "no-cache", false); 1.10 + 1.11 + let loadedStateKey = "sandbox_content_loaded"; 1.12 + switch(request.queryString) { 1.13 + case "reset": { 1.14 + setState(loadedStateKey, ""); 1.15 + response.write("reset"); 1.16 + break; 1.17 + } 1.18 + case "get_loaded": { 1.19 + response.setHeader("Content-Type", "text/plain", false); 1.20 + let loaded = getState(loadedStateKey); 1.21 + if (loaded) 1.22 + response.write(loaded); 1.23 + else 1.24 + response.write("NOTHING"); 1.25 + break; 1.26 + } 1.27 + default: { 1.28 + let contentType = decodeURIComponent(request.queryString); 1.29 + // set the Content-Type equal to the query string 1.30 + response.setHeader("Content-Type", contentType, false); 1.31 + // If any content is loaded, append it's content type in state 1.32 + let loaded = getState(loadedStateKey); 1.33 + if (loaded) 1.34 + loaded += ","; 1.35 + setState(loadedStateKey, loaded + contentType); 1.36 + break; 1.37 + } 1.38 + } 1.39 +}