summaryrefslogtreecommitdiffstats
path: root/devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js')
-rw-r--r--devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js b/devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js
new file mode 100644
index 000000000..abde4b197
--- /dev/null
+++ b/devtools/shared/pretty-fast/tests/unit/head_pretty-fast.js
@@ -0,0 +1,49 @@
+"use strict";
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+var Cr = Components.results;
+
+const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
+
+this.sourceMap = require("source-map");
+this.acorn = require("acorn/acorn");
+this.prettyFast = require("devtools/shared/pretty-fast/pretty-fast");
+const { console } = Cu.import("resource://gre/modules/Console.jsm", {});
+
+// Register a console listener, so console messages don't just disappear
+// into the ether.
+var errorCount = 0;
+var listener = {
+ observe: function (aMessage) {
+ errorCount++;
+ try {
+ // If we've been given an nsIScriptError, then we can print out
+ // something nicely formatted, for tools like Emacs to pick up.
+ var scriptError = aMessage.QueryInterface(Ci.nsIScriptError);
+ dump(aMessage.sourceName + ":" + aMessage.lineNumber + ": " +
+ scriptErrorFlagsToKind(aMessage.flags) + ": " +
+ aMessage.errorMessage + "\n");
+ var string = aMessage.errorMessage;
+ } catch (x) {
+ // Be a little paranoid with message, as the whole goal here is to lose
+ // no information.
+ try {
+ var string = "" + aMessage.message;
+ } catch (x) {
+ var string = "<error converting error message to string>";
+ }
+ }
+
+ // Ignored until they are fixed in bug 1242968.
+ if (string.includes("JavaScript Warning")) {
+ return;
+ }
+
+ do_throw("head_pretty-fast.js got console message: " + string + "\n");
+ }
+};
+
+var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
+consoleService.registerListener(listener);
+