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 | const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); |
michael@0 | 8 | const { require } = devtools; |
michael@0 | 9 | |
michael@0 | 10 | this.sourceMap = require("source-map"); |
michael@0 | 11 | this.acorn = require("acorn/acorn"); |
michael@0 | 12 | this.prettyFast = require("devtools/pretty-fast"); |
michael@0 | 13 | const { console } = Cu.import("resource://gre/modules/devtools/Console.jsm", {}); |
michael@0 | 14 | |
michael@0 | 15 | // Register a console listener, so console messages don't just disappear |
michael@0 | 16 | // into the ether. |
michael@0 | 17 | let errorCount = 0; |
michael@0 | 18 | let listener = { |
michael@0 | 19 | observe: function (aMessage) { |
michael@0 | 20 | errorCount++; |
michael@0 | 21 | try { |
michael@0 | 22 | // If we've been given an nsIScriptError, then we can print out |
michael@0 | 23 | // something nicely formatted, for tools like Emacs to pick up. |
michael@0 | 24 | var scriptError = aMessage.QueryInterface(Ci.nsIScriptError); |
michael@0 | 25 | dump(aMessage.sourceName + ":" + aMessage.lineNumber + ": " + |
michael@0 | 26 | scriptErrorFlagsToKind(aMessage.flags) + ": " + |
michael@0 | 27 | aMessage.errorMessage + "\n"); |
michael@0 | 28 | var string = aMessage.errorMessage; |
michael@0 | 29 | } catch (x) { |
michael@0 | 30 | // Be a little paranoid with message, as the whole goal here is to lose |
michael@0 | 31 | // no information. |
michael@0 | 32 | try { |
michael@0 | 33 | var string = "" + aMessage.message; |
michael@0 | 34 | } catch (x) { |
michael@0 | 35 | var string = "<error converting error message to string>"; |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | do_throw("head_pretty-fast.js got console message: " + string + "\n"); |
michael@0 | 40 | } |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | let consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService); |
michael@0 | 44 | consoleService.registerListener(listener); |
michael@0 | 45 |