1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 add_task(async function() {
6 // Passing an Error with JSErrorReport to Cu.reportError should preserve
15 messagePattern: /unexpected token/,
21 throwError() { // line = 21
24 messagePattern: /is not defined/,
30 for (const test of tests) {
31 const { promise, resolve } = Promise.withResolvers();
34 if (msg instanceof Ci.nsIScriptError) {
41 Services.console.registerListener(listener);
49 const msg = await promise;
50 Assert.stringMatches(msg.errorMessage, test.messagePattern);
51 Assert.equal(msg.lineNumber, test.lineNumber);
52 Assert.equal(msg.columnNumber, test.columnNumber);
54 Services.console.unregisterListener(listener);