toolkit/components/social/test/browser/worker_relative.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 // Used to test XHR in the worker.
michael@0 2 onconnect = function(e) {
michael@0 3 let port = e.ports[0];
michael@0 4 let req;
michael@0 5 try {
michael@0 6 importScripts("relative_import.js");
michael@0 7 // the import should have exposed "testVar" and "testFunc" from the module.
michael@0 8 if (testVar != "oh hai" || testFunc() != "oh hai") {
michael@0 9 port.postMessage({topic: "done", result: "import worked but global is not available"});
michael@0 10 return;
michael@0 11 }
michael@0 12
michael@0 13 // causeError will cause a script error, so that we can check the
michael@0 14 // error location for importScripts'ed files is correct.
michael@0 15 try {
michael@0 16 causeError();
michael@0 17 } catch(e) {
michael@0 18 let fileName = e.fileName;
michael@0 19 if (fileName.startsWith("http") &&
michael@0 20 fileName.endsWith("/relative_import.js") &&
michael@0 21 e.lineNumber == 4)
michael@0 22 port.postMessage({topic: "done", result: "ok"});
michael@0 23 else
michael@0 24 port.postMessage({topic: "done", result: "invalid error location: " + fileName + ":" + e.lineNumber});
michael@0 25 return;
michael@0 26 }
michael@0 27 } catch(e) {
michael@0 28 port.postMessage({topic: "done", result: "FAILED to importScripts, " + e.toString() });
michael@0 29 return;
michael@0 30 }
michael@0 31 port.postMessage({topic: "done", result: "FAILED to importScripts, no exception" });
michael@0 32 }

mercurial