Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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); |