toolkit/devtools/tests/unit/head_devtools.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 "use strict";
michael@0 2 const Cc = Components.classes;
michael@0 3 const Ci = Components.interfaces;
michael@0 4 const Cu = Components.utils;
michael@0 5 const Cr = Components.results;
michael@0 6
michael@0 7 Cu.import("resource://gre/modules/devtools/Loader.jsm");
michael@0 8 Cu.import("resource://gre/modules/devtools/DevToolsUtils.jsm");
michael@0 9
michael@0 10 // Register a console listener, so console messages don't just disappear
michael@0 11 // into the ether.
michael@0 12 let errorCount = 0;
michael@0 13 let listener = {
michael@0 14 observe: function (aMessage) {
michael@0 15 errorCount++;
michael@0 16 try {
michael@0 17 // If we've been given an nsIScriptError, then we can print out
michael@0 18 // something nicely formatted, for tools like Emacs to pick up.
michael@0 19 var scriptError = aMessage.QueryInterface(Ci.nsIScriptError);
michael@0 20 dump(aMessage.sourceName + ":" + aMessage.lineNumber + ": " +
michael@0 21 scriptErrorFlagsToKind(aMessage.flags) + ": " +
michael@0 22 aMessage.errorMessage + "\n");
michael@0 23 var string = aMessage.errorMessage;
michael@0 24 } catch (x) {
michael@0 25 // Be a little paranoid with message, as the whole goal here is to lose
michael@0 26 // no information.
michael@0 27 try {
michael@0 28 var string = "" + aMessage.message;
michael@0 29 } catch (x) {
michael@0 30 var string = "<error converting error message to string>";
michael@0 31 }
michael@0 32 }
michael@0 33
michael@0 34 // Make sure we exit all nested event loops so that the test can finish.
michael@0 35 while (DebuggerServer.xpcInspector.eventLoopNestLevel > 0) {
michael@0 36 DebuggerServer.xpcInspector.exitNestedEventLoop();
michael@0 37 }
michael@0 38 do_throw("head_dbg.js got console message: " + string + "\n");
michael@0 39 }
michael@0 40 };
michael@0 41
michael@0 42 let consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
michael@0 43 consoleService.registerListener(listener);

mercurial