Bug 1910698 - Remove nsIScriptError.sourceLine. r=smaug,devtools-reviewers,webdriver-reviewers,necko-reviewers,nchevobbe,kershaw,jdescottes,credential-management-reviewers,dimi

Afaict the source lines are not exposed anywhere in the UI.

Differential Revision: https://phabricator.services.mozilla.com/D218115
This commit is contained in:
Emilio Cobos Álvarez 2024-08-01 17:12:48 +00:00
parent 198c331213
commit e1ad6294bf
101 changed files with 341 additions and 573 deletions

View File

@ -522,7 +522,6 @@ var gXPInstallObserver = {
consoleMsg.initWithWindowID(
message,
gBrowser.currentURI.spec,
null,
0,
0,
Ci.nsIScriptError.warningFlag,

View File

@ -464,7 +464,6 @@ var FullScreen = {
consoleMsg.initWithWindowID(
message,
gBrowser.currentURI.spec,
null,
0,
0,
Ci.nsIScriptError.warningFlag,

View File

@ -706,7 +706,6 @@ class SitePermsAddonInstallRequest extends PermissionPromptForRequest {
scriptError.initWithWindowID(
errorMessage,
null,
null,
0,
0,
0,

View File

@ -1151,12 +1151,11 @@ nsresult nsScriptSecurityManager::ReportError(const char* aMessageTag,
// using category of "SOP" so we can link to MDN
if (aInnerWindowID != 0) {
rv = error->InitWithWindowID(
message, u""_ns, u""_ns, 0, 0, nsIScriptError::errorFlag, "SOP"_ns,
message, ""_ns, 0, 0, nsIScriptError::errorFlag, "SOP"_ns,
aInnerWindowID, true /* From chrome context */);
} else {
rv = error->Init(message, u""_ns, u""_ns, 0, 0, nsIScriptError::errorFlag,
"SOP"_ns, aFromPrivateWindow,
true /* From chrome context */);
rv = error->Init(message, ""_ns, 0, 0, nsIScriptError::errorFlag, "SOP"_ns,
aFromPrivateWindow, true /* From chrome context */);
}
NS_ENSURE_SUCCESS(rv, rv);
console->LogMessage(error);

View File

@ -75,9 +75,9 @@ void nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, uint32_t aLineNumber,
nsCString spec;
if (aURL) aURL->GetSpec(spec);
rv = error->Init(NS_ConvertUTF8toUTF16(formatted.get()),
NS_ConvertUTF8toUTF16(spec), u""_ns, aLineNumber, 0, flags,
"chrome registration"_ns, false /* from private window */,
rv = error->Init(NS_ConvertUTF8toUTF16(formatted.get()), spec, aLineNumber, 0,
flags, "chrome registration"_ns,
false /* from private window */,
true /* from chrome context */);
if (NS_FAILED(rv)) return;

View File

@ -181,7 +181,6 @@ async function testMessages() {
scriptErrorMessage.initWithWindowID(
"Error from Services.console.logMessage",
gBrowser.currentURI.prePath,
null,
0,
0,
Ci.nsIScriptError.warningFlag,

View File

@ -23,7 +23,6 @@ rawPackets.set(`Unknown property such-unknown-property. Declaration dropp
"errorMessage": "Unknown property such-unknown-property. Declaration dropped.",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/stub-generators/test-css-message.html",
"sourceId": null,
"lineText": "",
"lineNumber": 3,
"columnNumber": 27,
"category": "CSS Parser",
@ -38,8 +37,8 @@ rawPackets.set(`Unknown property such-unknown-property. Declaration dropp
"chromeContext": false,
"isForwardedFromContentProcess": false
},
"resourceType": "css-message",
"cssSelectors": "p",
"resourceType": "css-message",
"isAlreadyExistingResource": false
});
@ -48,7 +47,6 @@ rawPackets.set(`Error in parsing value for padding-top. Declaration dropp
"errorMessage": "Error in parsing value for padding-top. Declaration dropped.",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/stub-generators/test-css-message.html",
"sourceId": null,
"lineText": "",
"lineNumber": 3,
"columnNumber": 18,
"category": "CSS Parser",
@ -63,8 +61,8 @@ rawPackets.set(`Error in parsing value for padding-top. Declaration dropp
"chromeContext": false,
"isForwardedFromContentProcess": false
},
"resourceType": "css-message",
"cssSelectors": "p",
"resourceType": "css-message",
"isAlreadyExistingResource": false
});

View File

@ -25,7 +25,6 @@ rawPackets.set(`ReferenceError: asdf is not defined`, {
"exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child1/source22",
"lineText": "",
"lineNumber": 3,
"columnNumber": 5,
"category": "content javascript",
@ -119,7 +118,6 @@ rawPackets.set(`SyntaxError: redeclaration of let a`, {
"exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Redeclared_parameter?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": " let a, a;",
"lineNumber": 2,
"columnNumber": 10,
"category": "content javascript",
@ -204,12 +202,11 @@ rawPackets.set(`TypeError longString message`, {
"length": 110007,
"initial": "Error: Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Lon"
},
"actorID": "server0.conn0.windowGlobal15032385537/longstractor23"
"actorID": "server0.conn0.process7//longstractor24"
},
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child1/source23",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -296,7 +293,6 @@ rawPackets.set(`throw string with URL`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child2/source31",
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -354,7 +350,6 @@ rawPackets.set(`throw ""`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -412,7 +407,6 @@ rawPackets.set(`throw "tomato"`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -470,7 +464,6 @@ rawPackets.set(`throw false`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source31",
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -528,7 +521,6 @@ rawPackets.set(`throw 0`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source31",
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -586,7 +578,6 @@ rawPackets.set(`throw null`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source31",
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -646,7 +637,6 @@ rawPackets.set(`throw undefined`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source31",
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -706,7 +696,6 @@ rawPackets.set(`throw Symbol`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source27",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -768,7 +757,6 @@ rawPackets.set(`throw Object`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source31",
"lineText": "",
"lineNumber": 1,
"columnNumber": 1,
"category": "content javascript",
@ -850,7 +838,6 @@ rawPackets.set(`throw Error Object`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source41",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -929,7 +916,6 @@ rawPackets.set(`throw Error Object with custom name`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source43",
"lineText": "",
"lineNumber": 2,
"columnNumber": 15,
"category": "content javascript",
@ -1008,7 +994,6 @@ rawPackets.set(`throw Error Object with error cause`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source45",
"lineText": "",
"lineNumber": 3,
"columnNumber": 15,
"category": "content javascript",
@ -1106,7 +1091,6 @@ rawPackets.set(`throw Error Object with cause chain`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source48",
"lineText": "",
"lineNumber": 5,
"columnNumber": 13,
"category": "content javascript",
@ -1242,7 +1226,6 @@ rawPackets.set(`throw Error Object with cyclical cause chain`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source53",
"lineText": "",
"lineNumber": 3,
"columnNumber": 13,
"category": "content javascript",
@ -1378,7 +1361,6 @@ rawPackets.set(`throw Error Object with falsy cause`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source58",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -1460,7 +1442,6 @@ rawPackets.set(`throw Error Object with number cause`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source60",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -1540,7 +1521,6 @@ rawPackets.set(`throw Error Object with string cause`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source62",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -1620,7 +1600,6 @@ rawPackets.set(`throw Error Object with object cause`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source64",
"lineText": "",
"lineNumber": 1,
"columnNumber": 7,
"category": "content javascript",
@ -1709,7 +1688,6 @@ rawPackets.set(`Promise reject ""`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -1767,7 +1745,6 @@ rawPackets.set(`Promise reject "tomato"`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -1825,7 +1802,6 @@ rawPackets.set(`Promise reject false`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -1883,7 +1859,6 @@ rawPackets.set(`Promise reject 0`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -1941,7 +1916,6 @@ rawPackets.set(`Promise reject null`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -2001,7 +1975,6 @@ rawPackets.set(`Promise reject undefined`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -2061,7 +2034,6 @@ rawPackets.set(`Promise reject Symbol`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -2123,7 +2095,6 @@ rawPackets.set(`Promise reject Object`, {
"errorMessageName": "JSMSG_UNCAUGHT_EXCEPTION",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": null,
"lineText": "",
"lineNumber": 1,
"columnNumber": 9,
"category": "content javascript",
@ -2205,7 +2176,6 @@ rawPackets.set(`Promise reject Error Object`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source55",
"lineText": "",
"lineNumber": 1,
"columnNumber": 16,
"category": "content javascript",
@ -2284,7 +2254,6 @@ rawPackets.set(`Promise reject Error Object with custom name`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn4.child2/source57",
"lineText": "",
"lineNumber": 2,
"columnNumber": 15,
"category": "content javascript",
@ -2363,7 +2332,6 @@ rawPackets.set(`Promise reject Error Object with error cause`, {
"errorMessageName": "",
"sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html",
"sourceId": "server0.conn0.child4/source81",
"lineText": "",
"lineNumber": 5,
"columnNumber": 15,
"category": "content javascript",

View File

@ -5,9 +5,6 @@
"use strict";
const nsIConsoleListenerWatcher = require("resource://devtools/server/actors/resources/utils/nsi-console-listener-watcher.js");
const {
DevToolsServer,
} = require("resource://devtools/server/devtools-server.js");
const {
createStringGrip,
} = require("resource://devtools/server/actors/object/utils.js");
@ -90,14 +87,6 @@ class CSSMessageWatcher extends nsIConsoleListenerWatcher {
*/
buildResource(targetActor, error) {
const stack = this.prepareStackForRemote(targetActor, error.stack);
let lineText = error.sourceLine;
if (
lineText &&
lineText.length > DevToolsServer.LONG_STRING_INITIAL_LENGTH
) {
lineText = lineText.substr(0, DevToolsServer.LONG_STRING_INITIAL_LENGTH);
}
const notesArray = this.prepareNotesForRemote(targetActor, error.notes);
// If there is no location information in the error but we have a stack,
@ -114,7 +103,6 @@ class CSSMessageWatcher extends nsIConsoleListenerWatcher {
errorMessage: createStringGrip(targetActor, error.errorMessage),
sourceName,
sourceId: getActorIdForInternalSourceId(targetActor, sourceId),
lineText,
lineNumber,
columnNumber,
category: error.category,

View File

@ -5,9 +5,6 @@
"use strict";
const nsIConsoleListenerWatcher = require("resource://devtools/server/actors/resources/utils/nsi-console-listener-watcher.js");
const {
DevToolsServer,
} = require("resource://devtools/server/devtools-server.js");
const ErrorDocs = require("resource://devtools/server/actors/errordocs.js");
const {
createStringGrip,
@ -124,13 +121,6 @@ class ErrorMessageWatcher extends nsIConsoleListenerWatcher {
*/
buildResource(targetActor, error) {
const stack = this.prepareStackForRemote(targetActor, error.stack);
let lineText = error.sourceLine;
if (
lineText &&
lineText.length > DevToolsServer.LONG_STRING_INITIAL_LENGTH
) {
lineText = lineText.substr(0, DevToolsServer.LONG_STRING_INITIAL_LENGTH);
}
const notesArray = this.prepareNotesForRemote(targetActor, error.notes);
@ -150,7 +140,6 @@ class ErrorMessageWatcher extends nsIConsoleListenerWatcher {
exceptionDocURL: ErrorDocs.GetURL(error),
sourceName,
sourceId: getActorIdForInternalSourceId(targetActor, sourceId),
lineText,
lineNumber,
columnNumber,
category: error.category,

View File

@ -993,7 +993,6 @@ class WindowGlobalTargetActor extends BaseTargetActor {
scriptError.initWithWindowID(
text,
null,
null,
0,
0,
flags,

View File

@ -355,12 +355,11 @@ exports.customFormatterBody = customFormatterBody;
function logCustomFormatterError(window, errorMsg, script) {
const scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
const scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
const { url, source, startLine, startColumn } = script ?? {};
const { url, startLine, startColumn } = script ?? {};
scriptError.initWithWindowID(
`Custom formatter failed: ${errorMsg}`,
url,
source,
startLine,
startColumn,
Ci.nsIScriptError.errorFlag,

View File

@ -11,9 +11,6 @@ const {
webconsoleSpec,
} = require("resource://devtools/shared/specs/webconsole.js");
const {
DevToolsServer,
} = require("resource://devtools/server/devtools-server.js");
const { ThreadActor } = require("resource://devtools/server/actors/thread.js");
const { ObjectActor } = require("resource://devtools/server/actors/object.js");
const {
@ -1414,14 +1411,6 @@ class WebConsoleActor extends Actor {
*/
preparePageErrorForRemote(pageError) {
const stack = this.prepareStackForRemote(pageError.stack);
let lineText = pageError.sourceLine;
if (
lineText &&
lineText.length > DevToolsServer.LONG_STRING_INITIAL_LENGTH
) {
lineText = lineText.substr(0, DevToolsServer.LONG_STRING_INITIAL_LENGTH);
}
let notesArray = null;
const notes = pageError.notes;
if (notes?.length) {
@ -1458,7 +1447,6 @@ class WebConsoleActor extends Actor {
exceptionDocURL: ErrorDocs.GetURL(pageError),
sourceName,
sourceId: this.getActorIdForInternalSourceId(sourceId),
lineText,
lineNumber,
columnNumber,
category: pageError.category,

View File

@ -223,7 +223,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -256,7 +255,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl("docs/Web/JavaScript/Reference/Errors/Bad_radix"),
@ -287,7 +285,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl("docs/Web/JavaScript/Reference/Errors/Read-only"),
@ -318,7 +315,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -351,7 +347,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -391,7 +386,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -431,7 +425,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -465,7 +458,6 @@ const expectedPageErrors = new Map([
warning: true,
info: false,
sourceId: null,
lineText: "function a() { return; 1 + 1; }",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -492,7 +484,6 @@ const expectedPageErrors = new Map([
warning: false,
info: false,
sourceId: null,
lineText: "{let a, a;}",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: mdnUrl(
@ -528,7 +519,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: undefined,
@ -559,7 +549,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: undefined,
@ -597,7 +586,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
exceptionDocURL: undefined,
@ -640,7 +628,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
innerWindowID: NUMBER_REGEX,
@ -685,7 +672,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
innerWindowID: NUMBER_REGEX,
@ -738,7 +724,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
innerWindowID: NUMBER_REGEX,
@ -776,7 +761,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
innerWindowID: NUMBER_REGEX,
@ -814,7 +798,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
innerWindowID: NUMBER_REGEX,
@ -850,7 +833,6 @@ const expectedPageErrors = new Map([
error: true,
warning: false,
info: false,
lineText: "",
lineNumber: NUMBER_REGEX,
columnNumber: NUMBER_REGEX,
innerWindowID: NUMBER_REGEX,

View File

@ -6342,10 +6342,12 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
DisplayLoadError(aStatus, url, nullptr, aChannel);
}
} else if (skippedUnknownProtocolNavigation) {
nsAutoCString sanitized;
nsTArray<nsString> params;
if (NS_FAILED(
NS_GetSanitizedURIStringFromURI(url, *params.AppendElement()))) {
params.LastElement().AssignLiteral(u"(unknown uri)");
if (NS_SUCCEEDED(NS_GetSanitizedURIStringFromURI(url, sanitized))) {
params.AppendElement(NS_ConvertUTF8toUTF16(sanitized));
} else {
params.AppendElement(u"(unknown uri)"_ns);
}
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag, "DOM"_ns, GetExtantDocument(),

View File

@ -187,23 +187,22 @@ void ChromeUtils::ReleaseAssert(GlobalObject& aGlobal, bool aCondition,
}
// Extract the current stack from the JS runtime to embed in the crash reason.
nsAutoString filename;
nsAutoCString filename;
uint32_t lineNo = 0;
if (nsCOMPtr<nsIStackFrame> location = GetCurrentJSStack(1)) {
location->GetFilename(aGlobal.Context(), filename);
lineNo = location->GetLineNumber(aGlobal.Context());
} else {
filename.Assign(u"<unknown>"_ns);
filename.Assign("<unknown>"_ns);
}
// Convert to utf-8 for adding as the MozCrashReason.
NS_ConvertUTF16toUTF8 filenameUtf8(filename);
NS_ConvertUTF16toUTF8 messageUtf8(aMessage);
// Actually crash.
MOZ_CRASH_UNSAFE_PRINTF("Failed ChromeUtils.releaseAssert(\"%s\") @ %s:%u",
messageUtf8.get(), filenameUtf8.get(), lineNo);
messageUtf8.get(), filename.get(), lineNo);
}
/* static */

View File

@ -222,7 +222,7 @@ void Exception::GetName(nsAString& aName) {
}
}
void Exception::GetFilename(JSContext* aCx, nsAString& aFilename) {
void Exception::GetFilename(JSContext* aCx, nsACString& aFilename) {
if (mLocation) {
mLocation->GetFilename(aCx, aFilename);
return;

View File

@ -86,7 +86,7 @@ class Exception : public nsIException, public nsWrapperCache {
CreateErrorMessage(name, aRetVal);
}
void GetFilename(JSContext* aCx, nsAString& aFilename);
void GetFilename(JSContext* aCx, nsACString& aFilename);
uint32_t SourceId(JSContext* aCx) const;

View File

@ -1292,9 +1292,9 @@ nsresult EventSourceImpl::PrintErrorOnConsole(
NS_ENSURE_SUCCESS(rv, rv);
rv = errObj->InitWithWindowID(
message, NS_ConvertUTF8toUTF16(mCallingLocation.FileName()), u""_ns,
mCallingLocation.mLine, mCallingLocation.mColumn,
nsIScriptError::errorFlag, "Event Source", mInnerWindowID);
message, mCallingLocation.FileName(), mCallingLocation.mLine,
mCallingLocation.mColumn, nsIScriptError::errorFlag, "Event Source",
mInnerWindowID);
NS_ENSURE_SUCCESS(rv, rv);
// print the error message directly to the JS console

View File

@ -138,18 +138,18 @@ MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP PostMessageEvent::Run() {
NS_ENSURE_SUCCESS(rv, rv);
if (mCallerWindowID == 0) {
rv = errorObject->Init(
errorText, NS_ConvertUTF8toUTF16(mScriptLocation.value()), u""_ns,
0, 0, nsIScriptError::errorFlag, "DOM Window"_ns,
mIsFromPrivateWindow, mProvidedPrincipal->IsSystemPrincipal());
rv = errorObject->Init(errorText, mScriptLocation.value(), 0, 0,
nsIScriptError::errorFlag, "DOM Window"_ns,
mIsFromPrivateWindow,
mProvidedPrincipal->IsSystemPrincipal());
} else if (callerURI) {
rv = errorObject->InitWithSourceURI(errorText, callerURI, u""_ns, 0, 0,
rv = errorObject->InitWithSourceURI(errorText, callerURI, 0, 0,
nsIScriptError::errorFlag,
"DOM Window"_ns, mCallerWindowID);
} else {
rv = errorObject->InitWithWindowID(
errorText, NS_ConvertUTF8toUTF16(mScriptLocation.value()), u""_ns,
0, 0, nsIScriptError::errorFlag, "DOM Window"_ns, mCallerWindowID);
rv = errorObject->InitWithWindowID(errorText, mScriptLocation.value(),
0, 0, nsIScriptError::errorFlag,
"DOM Window"_ns, mCallerWindowID);
}
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -14,18 +14,12 @@ SourceLocation::SourceLocation() = default;
SourceLocation::~SourceLocation() = default;
SourceLocation::SourceLocation(nsCString&& aResource, uint32_t aLine,
uint32_t aCol, nsCString&& aSourceLine)
: mResource(std::move(aResource)),
mLine(aLine),
mColumn(aCol),
mSourceLine(std::move(aSourceLine)) {}
uint32_t aCol)
: mResource(std::move(aResource)), mLine(aLine), mColumn(aCol) {}
SourceLocation::SourceLocation(nsCOMPtr<nsIURI>&& aResource, uint32_t aLine,
uint32_t aCol, nsCString&& aSourceLine)
: mResource(std::move(aResource)),
mLine(aLine),
mColumn(aCol),
mSourceLine(std::move(aSourceLine)) {}
uint32_t aCol)
: mResource(std::move(aResource)), mLine(aLine), mColumn(aCol) {}
JSCallingLocation JSCallingLocation::Get() {
return Get(nsContentUtils::GetCurrentJSContext());

View File

@ -20,13 +20,11 @@ struct SourceLocation {
mozilla::Variant<nsCString, nsCOMPtr<nsIURI>> mResource{VoidCString()};
uint32_t mLine = 0;
uint32_t mColumn = 1;
nsCString mSourceLine;
SourceLocation();
explicit SourceLocation(nsCString&&, uint32_t aLine = 0, uint32_t aCol = 1,
nsCString&& aSourceLine = {});
explicit SourceLocation(nsCString&&, uint32_t aLine = 0, uint32_t aCol = 1);
explicit SourceLocation(nsCOMPtr<nsIURI>&&, uint32_t aLine = 0,
uint32_t aCol = 1, nsCString&& aSourceLine = {});
uint32_t aCol = 1);
~SourceLocation();

View File

@ -4531,7 +4531,7 @@ void nsContentUtils::LogSimpleConsoleError(const nsAString& aErrorText,
nsCOMPtr<nsIConsoleService> console =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (console && NS_SUCCEEDED(scriptError->Init(
aErrorText, u""_ns, u""_ns, 0, 0, aErrorFlags, aCategory,
aErrorText, ""_ns, 0, 0, aErrorFlags, aCategory,
aFromPrivateWindow, aFromChromeContext))) {
console->LogMessage(scriptError);
}
@ -4591,17 +4591,15 @@ nsresult nsContentUtils::ReportToConsoleByWindowID(
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ConvertUTF8toUTF16 sourceLine(aLocation.mSourceLine);
if (aLocation.mResource.is<nsCOMPtr<nsIURI>>()) {
nsIURI* uri = aLocation.mResource.as<nsCOMPtr<nsIURI>>();
rv = errorObject->InitWithSourceURI(aErrorText, uri, sourceLine,
aLocation.mLine, aLocation.mColumn,
aErrorFlags, aCategory, aInnerWindowID);
rv = errorObject->InitWithSourceURI(aErrorText, uri, aLocation.mLine,
aLocation.mColumn, aErrorFlags,
aCategory, aInnerWindowID);
} else {
rv = errorObject->InitWithWindowID(
aErrorText, NS_ConvertUTF8toUTF16(aLocation.mResource.as<nsCString>()),
sourceLine, aLocation.mLine, aLocation.mColumn, aErrorFlags, aCategory,
aInnerWindowID);
aErrorText, aLocation.mResource.as<nsCString>(), aLocation.mLine,
aLocation.mColumn, aErrorFlags, aCategory, aInnerWindowID);
}
NS_ENSURE_SUCCESS(rv, rv);
@ -11016,7 +11014,7 @@ bool nsContentUtils::IsOverridingWindowName(const nsAString& aName) {
template <prototypes::ID PrototypeID, class NativeType, typename T>
static Result<Ok, nsresult> ExtractExceptionValues(
JSContext* aCx, JS::Handle<JSObject*> aObj, nsAString& aSourceSpecOut,
JSContext* aCx, JS::Handle<JSObject*> aObj, nsACString& aSourceSpecOut,
uint32_t* aLineOut, uint32_t* aColumnOut, nsString& aMessageOut) {
AssertStaticUnwrapOK<PrototypeID>();
RefPtr<T> exn;
@ -11041,16 +11039,6 @@ static Result<Ok, nsresult> ExtractExceptionValues(
void nsContentUtils::ExtractErrorValues(
JSContext* aCx, JS::Handle<JS::Value> aValue, nsACString& aSourceSpecOut,
uint32_t* aLineOut, uint32_t* aColumnOut, nsString& aMessageOut) {
nsAutoString sourceSpec;
ExtractErrorValues(aCx, aValue, sourceSpec, aLineOut, aColumnOut,
aMessageOut);
CopyUTF16toUTF8(sourceSpec, aSourceSpecOut);
}
/* static */
void nsContentUtils::ExtractErrorValues(
JSContext* aCx, JS::Handle<JS::Value> aValue, nsAString& aSourceSpecOut,
uint32_t* aLineOut, uint32_t* aColumnOut, nsString& aMessageOut) {
MOZ_ASSERT(aLineOut);
MOZ_ASSERT(aColumnOut);

View File

@ -1386,13 +1386,6 @@ class nsContentUtils {
static bool PrefetchPreloadEnabled(nsIDocShell* aDocShell);
static void ExtractErrorValues(JSContext* aCx, JS::Handle<JS::Value> aValue,
nsAString& aSourceSpecOut, uint32_t* aLineOut,
uint32_t* aColumnOut, nsString& aMessageOut);
// Variant on `ExtractErrorValues` with a `nsACString`. This
// method is provided for backwards compatibility. Prefer the
// faster method above for your code.
static void ExtractErrorValues(JSContext* aCx, JS::Handle<JS::Value> aValue,
nsACString& aSourceSpecOut, uint32_t* aLineOut,
uint32_t* aColumnOut, nsString& aMessageOut);

View File

@ -461,8 +461,8 @@ bool nsFrameMessageManager::GetParamsForMessage(JSContext* aCx,
error->Init(
u"Sending message that cannot be cloned. Are "
"you trying to send an XPCOM object?"_ns,
NS_ConvertUTF8toUTF16(location.FileName()), u""_ns, location.mLine,
location.mColumn, nsIScriptError::warningFlag, "chrome javascript"_ns,
location.FileName(), location.mLine, location.mColumn,
nsIScriptError::warningFlag, "chrome javascript"_ns,
false /* from private window */, true /* from chrome context */);
console->LogMessage(error);
}
@ -805,17 +805,16 @@ void nsFrameMessageManager::ReceiveMessage(
data->Write(cx, rval, aError);
if (NS_WARN_IF(aError.Failed())) {
aRetVal->RemoveLastElement();
nsString msg =
aMessage + nsLiteralString(
u": message reply cannot be cloned. Are "
"you trying to send an XPCOM object?");
nsString msg = aMessage +
u": message reply cannot be cloned. Are "
"you trying to send an XPCOM object?"_ns;
nsCOMPtr<nsIConsoleService> console(
do_GetService(NS_CONSOLESERVICE_CONTRACTID));
if (console) {
nsCOMPtr<nsIScriptError> error(
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(msg, u""_ns, u""_ns, 0, 0, nsIScriptError::warningFlag,
error->Init(msg, ""_ns, 0, 0, nsIScriptError::warningFlag,
"chrome javascript"_ns, false /* from private window */,
true /* from chrome context */);
console->LogMessage(error);

View File

@ -226,7 +226,7 @@ class JSStackFrame final : public nsIStackFrame, public xpc::JSStackFrameBase {
nsCOMPtr<nsIStackFrame> mCaller;
nsCOMPtr<nsIStackFrame> mAsyncCaller;
nsString mFilename;
nsCString mFilename;
nsString mFunname;
nsString mAsyncCause;
int32_t mSourceId;
@ -383,12 +383,12 @@ static void GetValueIfNotCached(
}
NS_IMETHODIMP JSStackFrame::GetFilenameXPCOM(JSContext* aCx,
nsAString& aFilename) {
nsACString& aFilename) {
GetFilename(aCx, aFilename);
return NS_OK;
}
void JSStackFrame::GetFilename(JSContext* aCx, nsAString& aFilename) {
void JSStackFrame::GetFilename(JSContext* aCx, nsACString& aFilename) {
if (!mStack) {
aFilename.Truncate();
return;
@ -404,7 +404,7 @@ void JSStackFrame::GetFilename(JSContext* aCx, nsAString& aFilename) {
return;
}
nsAutoJSString str;
nsAutoJSCString str;
if (!str.init(aCx, filename)) {
JS_ClearPendingException(aCx);
aFilename.Truncate();
@ -542,11 +542,6 @@ JSStackFrame::GetColumnNumberXPCOM(JSContext* aCx, int32_t* aColumnNumber) {
return NS_OK;
}
NS_IMETHODIMP JSStackFrame::GetSourceLine(nsACString& aSourceLine) {
aSourceLine.Truncate();
return NS_OK;
}
NS_IMETHODIMP
JSStackFrame::GetAsyncCauseXPCOM(JSContext* aCx, nsAString& aAsyncCause) {
GetAsyncCause(aCx, aAsyncCause);
@ -717,7 +712,7 @@ JSStackFrame::ToStringXPCOM(JSContext* aCx, nsACString& _retval) {
void JSStackFrame::ToString(JSContext* aCx, nsACString& _retval) {
_retval.Truncate();
nsString filename;
nsCString filename;
GetFilename(aCx, filename);
if (filename.IsEmpty()) {
@ -734,7 +729,7 @@ void JSStackFrame::ToString(JSContext* aCx, nsACString& _retval) {
int32_t lineno = GetLineNumber(aCx);
static const char format[] = "JS frame :: %s :: %s :: line %d";
_retval.AppendPrintf(format, NS_ConvertUTF16toUTF8(filename).get(),
_retval.AppendPrintf(format, filename.get(),
NS_ConvertUTF16toUTF8(funname).get(), lineno);
}

View File

@ -21,7 +21,7 @@ interface nsIURI;
interface nsIScriptErrorNote : nsISupports
{
readonly attribute AString errorMessage;
readonly attribute AString sourceName;
readonly attribute ACString sourceName;
/**
* Unique identifier within the process for the script source this note is
@ -55,8 +55,7 @@ interface nsIScriptError : nsIConsoleMessage
*/
readonly attribute AString errorMessage;
readonly attribute AString sourceName;
readonly attribute AString sourceLine;
readonly attribute ACString sourceName;
/**
* Unique identifier within the process for the script source this error is
@ -129,8 +128,7 @@ interface nsIScriptError : nsIConsoleMessage
attribute AString cssSelectors;
void init(in AString message,
in AString sourceName,
in AString sourceLine,
in ACString sourceName,
in uint32_t lineNumber,
in uint32_t columnNumber,
in uint32_t flags,
@ -151,8 +149,7 @@ interface nsIScriptError : nsIConsoleMessage
* (e.g. https://USERNAME:****@example.com/some/path).
*/
void initWithWindowID(in AString message,
in AString sourceName,
in AString sourceLine,
in ACString sourceName,
in uint32_t lineNumber,
in uint32_t columnNumber,
in uint32_t flags,
@ -165,8 +162,7 @@ interface nsIScriptError : nsIConsoleMessage
* Please use it only if sourceName string is already sanitized.
*/
void initWithSanitizedSource(in AString message,
in AString sourceName,
in AString sourceLine,
in ACString sourceName,
in uint32_t lineNumber,
in uint32_t columnNumber,
in uint32_t flags,
@ -178,7 +174,6 @@ interface nsIScriptError : nsIConsoleMessage
*/
void initWithSourceURI(in AString message,
in nsIURI sourceURI,
in AString sourceLine,
in uint32_t lineNumber,
in uint32_t columnNumber,
in uint32_t flags,
@ -191,23 +186,21 @@ interface nsIScriptError : nsIConsoleMessage
%{C++
nsresult InitWithWindowID(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
const nsACString& sourceName,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const nsACString& category,
uint64_t aInnerWindowID)
{
return InitWithWindowID(message, sourceName, sourceLine, lineNumber,
return InitWithWindowID(message, sourceName, lineNumber,
columnNumber, flags, category, aInnerWindowID,
false);
}
// These overloads allow passing a literal string for category.
template<uint32_t N>
nsresult InitWithWindowID(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
const nsACString& sourceName,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
@ -216,21 +209,20 @@ interface nsIScriptError : nsIConsoleMessage
bool aFromChromeContext = false)
{
nsDependentCString category(c, N - 1);
return InitWithWindowID(message, sourceName, sourceLine, lineNumber,
return InitWithWindowID(message, sourceName, lineNumber,
columnNumber, flags, category, aInnerWindowID,
aFromChromeContext);
}
nsresult InitWithSanitizedSource(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
const nsACString& sourceName,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const nsACString& category,
uint64_t aInnerWindowID)
{
return InitWithSanitizedSource(message, sourceName, sourceLine,
return InitWithSanitizedSource(message, sourceName,
lineNumber, columnNumber, flags,
category, aInnerWindowID,
false);
@ -238,8 +230,7 @@ interface nsIScriptError : nsIConsoleMessage
template<uint32_t N>
nsresult InitWithSanitizedSource(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
const nsACString& sourceName,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
@ -248,7 +239,7 @@ interface nsIScriptError : nsIConsoleMessage
bool aFromChromeContext = false)
{
nsDependentCString category(c, N - 1);
return InitWithSanitizedSource(message, sourceName, sourceLine,
return InitWithSanitizedSource(message, sourceName,
lineNumber, columnNumber, flags,
category, aInnerWindowID,
aFromChromeContext);
@ -256,14 +247,13 @@ interface nsIScriptError : nsIConsoleMessage
nsresult InitWithSourceURI(const nsAString& message,
nsIURI* sourceURI,
const nsAString& sourceLine,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
const nsACString& category,
uint64_t aInnerWindowID)
{
return InitWithSourceURI(message, sourceURI, sourceLine,
return InitWithSourceURI(message, sourceURI,
lineNumber, columnNumber, flags,
category, aInnerWindowID, false);
}
@ -271,7 +261,6 @@ interface nsIScriptError : nsIConsoleMessage
template<uint32_t N>
nsresult InitWithSourceURI(const nsAString& message,
nsIURI* sourceURI,
const nsAString& sourceLine,
uint32_t lineNumber,
uint32_t columnNumber,
uint32_t flags,
@ -280,7 +269,7 @@ interface nsIScriptError : nsIConsoleMessage
bool aFromChromeContext = false)
{
nsDependentCString category(c, N - 1);
return InitWithSourceURI(message, sourceURI, sourceLine,
return InitWithSourceURI(message, sourceURI,
lineNumber, columnNumber, flags,
category, aInnerWindowID, aFromChromeContext);
}

View File

@ -97,7 +97,7 @@ nsScriptErrorBase::GetErrorMessage(nsAString& aResult) {
}
NS_IMETHODIMP
nsScriptErrorBase::GetSourceName(nsAString& aResult) {
nsScriptErrorBase::GetSourceName(nsACString& aResult) {
aResult.Assign(mSourceName);
return NS_OK;
}
@ -120,12 +120,6 @@ nsScriptErrorBase::GetSourceId(uint32_t* result) {
return NS_OK;
}
NS_IMETHODIMP
nsScriptErrorBase::GetSourceLine(nsAString& aResult) {
aResult.Assign(mSourceLine);
return NS_OK;
}
NS_IMETHODIMP
nsScriptErrorBase::GetLineNumber(uint32_t* result) {
*result = mLineNumber;
@ -194,9 +188,11 @@ nsScriptErrorBase::SetErrorMessageName(const nsAString& aErrorMessageName) {
return NS_OK;
}
static void AssignSourceNameHelper(nsString& aSourceNameDest,
const nsAString& aSourceNameSrc) {
if (aSourceNameSrc.IsEmpty()) return;
static void AssignSourceNameHelper(nsCString& aSourceNameDest,
const nsACString& aSourceNameSrc) {
if (aSourceNameSrc.IsEmpty()) {
return;
}
aSourceNameDest.Assign(aSourceNameSrc);
@ -209,7 +205,7 @@ static void AssignSourceNameHelper(nsString& aSourceNameDest,
}
static void AssignSourceNameHelper(nsIURI* aSourceURI,
nsString& aSourceNameDest) {
nsCString& aSourceNameDest) {
if (!aSourceURI) return;
if (NS_FAILED(NS_GetSanitizedURIStringFromURI(aSourceURI, aSourceNameDest))) {
@ -218,13 +214,12 @@ static void AssignSourceNameHelper(nsIURI* aSourceURI,
}
NS_IMETHODIMP
nsScriptErrorBase::Init(const nsAString& message, const nsAString& sourceName,
const nsAString& sourceLine, uint32_t lineNumber,
uint32_t columnNumber, uint32_t flags,
const nsACString& category, bool fromPrivateWindow,
bool fromChromeContext) {
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
category, 0 /* inner Window ID */, fromChromeContext);
nsScriptErrorBase::Init(const nsAString& message, const nsACString& sourceName,
uint32_t lineNumber, uint32_t columnNumber,
uint32_t flags, const nsACString& category,
bool fromPrivateWindow, bool fromChromeContext) {
InitializationHelper(message, lineNumber, columnNumber, flags, category,
0 /* inner Window ID */, fromChromeContext);
AssignSourceNameHelper(mSourceName, sourceName);
mIsFromPrivateWindow = fromPrivateWindow;
@ -233,12 +228,11 @@ nsScriptErrorBase::Init(const nsAString& message, const nsAString& sourceName,
}
void nsScriptErrorBase::InitializationHelper(
const nsAString& message, const nsAString& sourceLine, uint32_t lineNumber,
uint32_t columnNumber, uint32_t flags, const nsACString& category,
uint64_t aInnerWindowID, bool aFromChromeContext) {
const nsAString& message, uint32_t lineNumber, uint32_t columnNumber,
uint32_t flags, const nsACString& category, uint64_t aInnerWindowID,
bool aFromChromeContext) {
mMessage.Assign(message);
mLineNumber = lineNumber;
mSourceLine.Assign(sourceLine);
mColumnNumber = columnNumber;
mFlags = flags;
mCategory = category;
@ -249,14 +243,13 @@ void nsScriptErrorBase::InitializationHelper(
NS_IMETHODIMP
nsScriptErrorBase::InitWithWindowID(const nsAString& message,
const nsAString& sourceName,
const nsAString& sourceLine,
const nsACString& sourceName,
uint32_t lineNumber, uint32_t columnNumber,
uint32_t flags, const nsACString& category,
uint64_t aInnerWindowID,
bool aFromChromeContext) {
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
category, aInnerWindowID, aFromChromeContext);
InitializationHelper(message, lineNumber, columnNumber, flags, category,
aInnerWindowID, aFromChromeContext);
AssignSourceNameHelper(mSourceName, sourceName);
if (aInnerWindowID && NS_IsMainThread()) InitializeOnMainThread();
@ -266,12 +259,11 @@ nsScriptErrorBase::InitWithWindowID(const nsAString& message,
NS_IMETHODIMP
nsScriptErrorBase::InitWithSanitizedSource(
const nsAString& message, const nsAString& sourceName,
const nsAString& sourceLine, uint32_t lineNumber, uint32_t columnNumber,
uint32_t flags, const nsACString& category, uint64_t aInnerWindowID,
bool aFromChromeContext) {
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
category, aInnerWindowID, aFromChromeContext);
const nsAString& message, const nsACString& sourceName, uint32_t lineNumber,
uint32_t columnNumber, uint32_t flags, const nsACString& category,
uint64_t aInnerWindowID, bool aFromChromeContext) {
InitializationHelper(message, lineNumber, columnNumber, flags, category,
aInnerWindowID, aFromChromeContext);
mSourceName = sourceName;
if (aInnerWindowID && NS_IsMainThread()) InitializeOnMainThread();
@ -281,14 +273,13 @@ nsScriptErrorBase::InitWithSanitizedSource(
NS_IMETHODIMP
nsScriptErrorBase::InitWithSourceURI(const nsAString& message,
nsIURI* sourceURI,
const nsAString& sourceLine,
uint32_t lineNumber, uint32_t columnNumber,
uint32_t flags, const nsACString& category,
nsIURI* sourceURI, uint32_t lineNumber,
uint32_t columnNumber, uint32_t flags,
const nsACString& category,
uint64_t aInnerWindowID,
bool aFromChromeContext) {
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
category, aInnerWindowID, aFromChromeContext);
InitializationHelper(message, lineNumber, columnNumber, flags, category,
aInnerWindowID, aFromChromeContext);
AssignSourceNameHelper(sourceURI, mSourceName);
if (aInnerWindowID && NS_IsMainThread()) InitializeOnMainThread();
@ -297,8 +288,7 @@ nsScriptErrorBase::InitWithSourceURI(const nsAString& message,
}
static nsresult ToStringHelper(const char* aSeverity, const nsString& aMessage,
const nsString& aSourceName,
const nsString* aSourceLine,
const nsCString& aSourceName,
uint32_t aLineNumber, uint32_t aColumnNumber,
nsACString& /*UTF8*/ aResult) {
static const char format0[] =
@ -311,15 +301,15 @@ static nsresult ToStringHelper(const char* aSeverity, const nsString& aMessage,
char* tempSourceName = nullptr;
char* tempSourceLine = nullptr;
if (!aMessage.IsEmpty()) tempMessage = ToNewUTF8String(aMessage);
if (!aSourceName.IsEmpty())
if (!aMessage.IsEmpty()) {
tempMessage = ToNewUTF8String(aMessage);
}
if (!aSourceName.IsEmpty()) {
// Use at most 512 characters from mSourceName.
tempSourceName = ToNewUTF8String(StringHead(aSourceName, 512));
if (aSourceLine && !aSourceLine->IsEmpty())
// Use at most 512 characters from mSourceLine.
tempSourceLine = ToNewUTF8String(StringHead(*aSourceLine, 512));
tempSourceName = ToNewCString(StringHead(aSourceName, 512));
}
if (nullptr != tempSourceName && nullptr != tempSourceLine) {
if (tempSourceName && tempSourceLine) {
temp = JS_smprintf(format0, aSeverity, tempMessage, tempSourceName,
aLineNumber, aColumnNumber, tempSourceLine);
} else if (!aSourceName.IsEmpty()) {
@ -329,9 +319,9 @@ static nsresult ToStringHelper(const char* aSeverity, const nsString& aMessage,
temp = JS_smprintf(format2, aSeverity, tempMessage);
}
if (nullptr != tempMessage) free(tempMessage);
if (nullptr != tempSourceName) free(tempSourceName);
if (nullptr != tempSourceLine) free(tempSourceLine);
if (tempMessage) free(tempMessage);
if (tempSourceName) free(tempSourceName);
if (tempSourceLine) free(tempSourceLine);
if (!temp) return NS_ERROR_OUT_OF_MEMORY;
@ -347,8 +337,8 @@ nsScriptErrorBase::ToString(nsACString& /*UTF8*/ aResult) {
const char* severity =
!(mFlags & nsIScriptError::warningFlag) ? error : warning;
return ToStringHelper(severity, mMessage, mSourceName, &mSourceLine,
mLineNumber, mColumnNumber, aResult);
return ToStringHelper(severity, mMessage, mSourceName, mLineNumber,
mColumnNumber, aResult);
}
NS_IMETHODIMP
@ -472,7 +462,7 @@ nsScriptErrorNote::nsScriptErrorNote()
nsScriptErrorNote::~nsScriptErrorNote() = default;
void nsScriptErrorNote::Init(const nsAString& message,
const nsAString& sourceName, uint32_t sourceId,
const nsACString& sourceName, uint32_t sourceId,
uint32_t lineNumber, uint32_t columnNumber) {
mMessage.Assign(message);
AssignSourceNameHelper(mSourceName, sourceName);
@ -489,7 +479,7 @@ nsScriptErrorNote::GetErrorMessage(nsAString& aResult) {
}
NS_IMETHODIMP
nsScriptErrorNote::GetSourceName(nsAString& aResult) {
nsScriptErrorNote::GetSourceName(nsACString& aResult) {
aResult.Assign(mSourceName);
return NS_OK;
}
@ -514,8 +504,8 @@ nsScriptErrorNote::GetColumnNumber(uint32_t* result) {
NS_IMETHODIMP
nsScriptErrorNote::ToString(nsACString& /*UTF8*/ aResult) {
return ToStringHelper("JavaScript Note", mMessage, mSourceName, nullptr,
mLineNumber, mColumnNumber, aResult);
return ToStringHelper("JavaScript Note", mMessage, mSourceName, mLineNumber,
mColumnNumber, aResult);
}
NS_IMPL_ISUPPORTS(nsScriptErrorNote, nsIScriptErrorNote)

View File

@ -28,16 +28,15 @@ class nsScriptErrorNote final : public nsIScriptErrorNote {
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSISCRIPTERRORNOTE
void Init(const nsAString& message, const nsAString& sourceName,
void Init(const nsAString& message, const nsACString& sourceName,
uint32_t sourceId, uint32_t lineNumber, uint32_t columnNumber);
private:
virtual ~nsScriptErrorNote();
nsString mMessage;
nsString mSourceName;
nsCString mSourceName;
nsString mCssSelectors;
nsString mSourceLine;
uint32_t mSourceId;
uint32_t mLineNumber;
uint32_t mColumnNumber;
@ -62,8 +61,7 @@ class nsScriptErrorBase : public nsIScriptError {
void InitializeOnMainThread();
void InitializationHelper(const nsAString& message,
const nsAString& sourceLine, uint32_t lineNumber,
void InitializationHelper(const nsAString& message, uint32_t lineNumber,
uint32_t columnNumber, uint32_t flags,
const nsACString& category, uint64_t aInnerWindowID,
bool aFromChromeContext);
@ -71,11 +69,10 @@ class nsScriptErrorBase : public nsIScriptError {
nsCOMArray<nsIScriptErrorNote> mNotes;
nsString mMessage;
nsString mMessageName;
nsString mSourceName;
nsCString mSourceName;
nsString mCssSelectors;
uint32_t mSourceId;
uint32_t mLineNumber;
nsString mSourceLine;
uint32_t mColumnNumber;
uint32_t mFlags;
nsCString mCategory;

View File

@ -1223,10 +1223,7 @@ void StackFrameToStackEntry(JSContext* aCx, nsIStackFrame* aStackFrame,
ConsoleStackEntry& aStackEntry) {
MOZ_ASSERT(aStackFrame);
nsAutoString filename;
aStackFrame->GetFilename(aCx, filename);
CopyUTF16toUTF8(filename, aStackEntry.mFilename);
aStackFrame->GetFilename(aCx, aStackEntry.mFilename);
aStackEntry.mSourceId = aStackFrame->GetSourceId(aCx);
aStackEntry.mLineNumber = aStackFrame->GetLineNumber(aCx);
aStackEntry.mColumnNumber = aStackFrame->GetColumnNumber(aCx);
@ -2747,10 +2744,10 @@ void Console::MaybeExecuteDumpFunction(JSContext* aCx,
nsCOMPtr<nsIStackFrame> stack(aStack);
while (stack) {
nsAutoString filename;
nsAutoCString filename;
stack->GetFilename(aCx, filename);
message.Append(filename);
AppendUTF8toUTF16(filename, message);
message.AppendLiteral(" ");
message.AppendInt(stack->GetLineNumber(aCx));

View File

@ -116,9 +116,10 @@ nsresult JSEventHandler::HandleEvent(Event* aEvent) {
if (mTypedHandler.Type() == TypedEventHandler::eOnError) {
MOZ_ASSERT_IF(mEventName, mEventName == nsGkAtoms::onerror);
nsString errorMsg, file;
nsString errorMsg;
nsCString file;
EventOrString msgOrEvent;
Optional<nsAString> fileName;
Optional<nsACString> fileName;
Optional<uint32_t> lineNumber;
Optional<uint32_t> columnNumber;
Optional<JS::Handle<JS::Value>> error;

View File

@ -316,13 +316,12 @@ class BlobURLsReporter final : public nsIMemoryReporter {
JSContext* cx = frame ? nsContentUtils::GetCurrentJSContext() : nullptr;
while (frame) {
nsString fileNameUTF16;
frame->GetFilename(cx, fileNameUTF16);
nsCString fileName;
frame->GetFilename(cx, fileName);
int32_t lineNumber = frame->GetLineNumber(cx);
if (!fileNameUTF16.IsEmpty()) {
NS_ConvertUTF16toUTF8 fileName(fileNameUTF16);
if (!fileName.IsEmpty()) {
stack += "js(";
if (!origin.IsEmpty()) {
// Make the file name root-relative for conciseness if possible.

View File

@ -487,7 +487,8 @@ NS_IMPL_ISUPPORTS(ConsoleListener, nsIConsoleListener)
// errors in particular share the memory for long lines with
// repeated errors, but the IPC communication we're about to do
// will break that sharing, so we better truncate now.
static void TruncateString(nsAString& aString) {
template <typename CharT>
static void TruncateString(nsTSubstring<CharT>& aString) {
if (aString.Length() > 1000) {
aString.Truncate(1000);
}
@ -501,7 +502,8 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
nsCOMPtr<nsIScriptError> scriptError = do_QueryInterface(aMessage);
if (scriptError) {
nsAutoString msg, sourceName, sourceLine;
nsAutoString msg;
nsAutoCString sourceName;
nsCString category;
uint32_t lineNum, colNum, flags;
bool fromPrivateWindow, fromChromeContext;
@ -512,9 +514,6 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
rv = scriptError->GetSourceName(sourceName);
NS_ENSURE_SUCCESS(rv, rv);
TruncateString(sourceName);
rv = scriptError->GetSourceLine(sourceLine);
NS_ENSURE_SUCCESS(rv, rv);
TruncateString(sourceLine);
rv = scriptError->GetCategory(getter_Copies(category));
NS_ENSURE_SUCCESS(rv, rv);
@ -559,15 +558,15 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
return NS_ERROR_FAILURE;
}
mChild->SendScriptErrorWithStack(
msg, sourceName, sourceLine, lineNum, colNum, flags, category,
fromPrivateWindow, fromChromeContext, cloned);
mChild->SendScriptErrorWithStack(msg, sourceName, lineNum, colNum,
flags, category, fromPrivateWindow,
fromChromeContext, cloned);
return NS_OK;
}
}
mChild->SendScriptError(msg, sourceName, sourceLine, lineNum, colNum, flags,
category, fromPrivateWindow, 0, fromChromeContext);
mChild->SendScriptError(msg, sourceName, lineNum, colNum, flags, category,
fromPrivateWindow, 0, fromChromeContext);
return NS_OK;
}
@ -4234,11 +4233,11 @@ mozilla::ipc::IPCResult ContentChild::RecvDiscardWindowContext(
}
mozilla::ipc::IPCResult ContentChild::RecvScriptError(
const nsString& aMessage, const nsString& aSourceName,
const nsString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsCString& aCategory, const bool& aFromPrivateWindow,
const uint64_t& aInnerWindowId, const bool& aFromChromeContext) {
const nsString& aMessage, const nsCString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsCString& aCategory,
const bool& aFromPrivateWindow, const uint64_t& aInnerWindowId,
const bool& aFromChromeContext) {
nsresult rv = NS_OK;
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
@ -4249,8 +4248,8 @@ mozilla::ipc::IPCResult ContentChild::RecvScriptError(
NS_ENSURE_TRUE(scriptError,
IPC_FAIL(this, "Failed to construct nsIScriptError"));
scriptError->InitWithWindowID(aMessage, aSourceName, aSourceLine, aLineNumber,
aColNumber, aFlags, aCategory, aInnerWindowId,
scriptError->InitWithWindowID(aMessage, aSourceName, aLineNumber, aColNumber,
aFlags, aCategory, aInnerWindowId,
aFromChromeContext);
rv = consoleService->LogMessage(scriptError);
NS_ENSURE_SUCCESS(rv, IPC_FAIL(this, "Failed to log script error"));

View File

@ -709,11 +709,11 @@ class ContentChild final : public PContentChild,
uint64_t aContextId, DiscardWindowContextResolver&& aResolve);
mozilla::ipc::IPCResult RecvScriptError(
const nsString& aMessage, const nsString& aSourceName,
const nsString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsCString& aCategory, const bool& aFromPrivateWindow,
const uint64_t& aInnerWindowId, const bool& aFromChromeContext);
const nsString& aMessage, const nsCString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsCString& aCategory,
const bool& aFromPrivateWindow, const uint64_t& aInnerWindowId,
const bool& aFromChromeContext);
mozilla::ipc::IPCResult RecvReportFrameTimingData(
const LoadInfoArgs& loadInfoArgs, const nsString& entryName,

View File

@ -4837,33 +4837,33 @@ mozilla::ipc::IPCResult ContentParent::RecvReportFrameTimingData(
}
mozilla::ipc::IPCResult ContentParent::RecvScriptError(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsACString& aCategory, const bool& aIsFromPrivateWindow,
const uint64_t& aInnerWindowId, const bool& aIsFromChromeContext) {
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
aLineNumber, aColNumber, aFlags, aCategory,
aIsFromPrivateWindow, aIsFromChromeContext);
const nsAString& aMessage, const nsACString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsACString& aCategory,
const bool& aIsFromPrivateWindow, const uint64_t& aInnerWindowId,
const bool& aIsFromChromeContext) {
return RecvScriptErrorInternal(aMessage, aSourceName, aLineNumber, aColNumber,
aFlags, aCategory, aIsFromPrivateWindow,
aIsFromChromeContext);
}
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorWithStack(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsACString& aCategory, const bool& aIsFromPrivateWindow,
const bool& aIsFromChromeContext, const ClonedMessageData& aStack) {
return RecvScriptErrorInternal(
aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags,
aCategory, aIsFromPrivateWindow, aIsFromChromeContext, &aStack);
const nsAString& aMessage, const nsACString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsACString& aCategory,
const bool& aIsFromPrivateWindow, const bool& aIsFromChromeContext,
const ClonedMessageData& aStack) {
return RecvScriptErrorInternal(aMessage, aSourceName, aLineNumber, aColNumber,
aFlags, aCategory, aIsFromPrivateWindow,
aIsFromChromeContext, &aStack);
}
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsACString& aCategory, const bool& aIsFromPrivateWindow,
const bool& aIsFromChromeContext, const ClonedMessageData* aStack) {
const nsAString& aMessage, const nsACString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsACString& aCategory,
const bool& aIsFromPrivateWindow, const bool& aIsFromChromeContext,
const ClonedMessageData* aStack) {
nsresult rv;
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
@ -4903,8 +4903,8 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
msg = new nsScriptError();
}
rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber,
aFlags, aCategory, aIsFromPrivateWindow, aIsFromChromeContext);
rv = msg->Init(aMessage, aSourceName, aLineNumber, aColNumber, aFlags,
aCategory, aIsFromPrivateWindow, aIsFromChromeContext);
if (NS_FAILED(rv)) return IPC_OK();
msg->SetIsForwardedFromContentProcess(true);

View File

@ -1029,30 +1029,29 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvConsoleMessage(const nsAString& aMessage);
mozilla::ipc::IPCResult RecvScriptError(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsACString& aCategory, const bool& aIsFromPrivateWindow,
const uint64_t& aInnerWindowId, const bool& aIsFromChromeContext);
const nsAString& aMessage, const nsACString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsACString& aCategory,
const bool& aIsFromPrivateWindow, const uint64_t& aInnerWindowId,
const bool& aIsFromChromeContext);
mozilla::ipc::IPCResult RecvReportFrameTimingData(
const LoadInfoArgs& loadInfoArgs, const nsAString& entryName,
const nsAString& initiatorType, UniquePtr<PerformanceTimingData>&& aData);
mozilla::ipc::IPCResult RecvScriptErrorWithStack(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsACString& aCategory, const bool& aIsFromPrivateWindow,
const bool& aIsFromChromeContext, const ClonedMessageData& aStack);
const nsAString& aMessage, const nsACString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsACString& aCategory,
const bool& aIsFromPrivateWindow, const bool& aIsFromChromeContext,
const ClonedMessageData& aStack);
private:
mozilla::ipc::IPCResult RecvScriptErrorInternal(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
const nsACString& aCategory, const bool& aIsFromPrivateWindow,
const bool& aIsFromChromeContext,
const nsAString& aMessage, const nsACString& aSourceName,
const uint32_t& aLineNumber, const uint32_t& aColNumber,
const uint32_t& aFlags, const nsACString& aCategory,
const bool& aIsFromPrivateWindow, const bool& aIsFromChromeContext,
const ClonedMessageData* aStack = nullptr);
public:

View File

@ -1206,7 +1206,7 @@ parent:
async SetGeolocationHigherAccuracy(bool enable);
async ConsoleMessage(nsString message);
async ScriptErrorWithStack(nsString message, nsString sourceName, nsString sourceLine,
async ScriptErrorWithStack(nsString message, nsCString sourceName,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
nsCString category, bool isFromPrivateWindow,
bool isFromChromeContext, ClonedMessageData stack);
@ -1828,7 +1828,7 @@ parent:
[LazySend] async CleanupPendingLoadState(uint64_t aLoadIdentifier);
both:
async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
async ScriptError(nsString message, nsCString sourceName,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
nsCString category, bool isFromPrivateWindow, uint64_t innerWindowId,
bool isFromChromeContext);

View File

@ -260,7 +260,6 @@ IdpSandbox.prototype = {
scriptError.initWithWindowID(
e.message,
e.fileName,
null,
e.lineNumber,
e.columnNumber,
Ci.nsIScriptError.errorFlag,

View File

@ -30,7 +30,6 @@ function logWebRTCMsg(msg, file, line, flag, win) {
scriptError.initWithWindowID(
`WebRTC: ${msg}`,
file,
null,
line,
0,
flag,

View File

@ -52,7 +52,7 @@ struct ProcessorErrorDetails {
unsigned mLineno;
// Column number in UTF-16 code units (1-origin).
unsigned mColno;
nsString mFilename;
nsCString mFilename;
nsString mMessage;
};
@ -231,11 +231,7 @@ void WorkletNodeEngine::SendProcessorError(AudioNodeTrack* aTrack,
}
ProcessorErrorDetails details;
CopyUTF8toUTF16(
mozilla::MakeStringSpan(jsReport.report()->filename.c_str()),
details.mFilename);
details.mFilename.Assign(jsReport.report()->filename.c_str());
xpc::ErrorReport::ErrorReportToMessageString(jsReport.report(),
details.mMessage);
details.mLineno = jsReport.report()->lineno;

View File

@ -230,13 +230,13 @@ void CSP_LogMessage(const nsAString& aMessage, const nsACString& aSourceName,
nsresult rv;
if (aInnerWindowID > 0) {
rv = error->InitWithWindowID(cspMsg, NS_ConvertUTF8toUTF16(aSourceName),
aSourceLine, aLineNumber, aColumnNumber,
aFlags, category, aInnerWindowID);
rv =
error->InitWithWindowID(cspMsg, aSourceName, aLineNumber, aColumnNumber,
aFlags, category, aInnerWindowID);
} else {
rv = error->Init(cspMsg, NS_ConvertUTF8toUTF16(aSourceName), aSourceLine,
aLineNumber, aColumnNumber, aFlags, category,
aFromPrivateWindow, true /* from chrome context */);
rv = error->Init(cspMsg, aSourceName, aLineNumber, aColumnNumber, aFlags,
category, aFromPrivateWindow,
true /* from chrome context */);
}
if (NS_FAILED(rv)) {
return;

View File

@ -11,11 +11,9 @@
#include "nsIContentSecurityPolicy.h"
#include "nsILoadInfo.h"
#include "nsIURI.h"
#include "nsLiteralString.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsUnicharUtils.h"
#include "mozilla/Logging.h"
class nsIChannel;

View File

@ -794,10 +794,9 @@ void nsContentSecurityUtils::NotifyEvalUsage(bool aIsSystemPrincipal,
return;
}
rv = error->InitWithWindowID(message, fileNameA, u""_ns, aLineNumber,
aColumnNumber, nsIScriptError::errorFlag,
"BrowserEvalUsage", aWindowID,
true /* From chrome context */);
rv = error->InitWithWindowID(message, aFileName, aLineNumber, aColumnNumber,
nsIScriptError::errorFlag, "BrowserEvalUsage",
aWindowID, true /* From chrome context */);
if (NS_FAILED(rv)) {
return;
}

View File

@ -18,7 +18,6 @@ ConsoleListener.prototype = {
cssSelectors: aMsg.cssSelectors,
errorMessage: aMsg.errorMessage,
sourceName: aMsg.sourceName,
sourceLine: aMsg.sourceLine,
lineNumber: aMsg.lineNumber,
columnNumber: aMsg.columnNumber,
category: aMsg.category,

View File

@ -28,7 +28,7 @@ interface mixin ExceptionMembers
// etc.
// null indicates "no data"
readonly attribute DOMString filename;
readonly attribute UTF8String filename;
// Valid line numbers begin at '1'. '0' indicates unknown.
readonly attribute unsigned long lineNumber;
// Valid column numbers begin at 0.

View File

@ -13,7 +13,7 @@ interface ErrorEvent : Event
constructor(DOMString type, optional ErrorEventInit eventInitDict = {});
readonly attribute DOMString message;
readonly attribute DOMString filename;
readonly attribute UTF8String filename;
readonly attribute unsigned long lineno;
readonly attribute unsigned long colno;
readonly attribute any error;
@ -22,7 +22,7 @@ interface ErrorEvent : Event
dictionary ErrorEventInit : EventInit
{
DOMString message = "";
DOMString filename = "";
UTF8String filename = "";
unsigned long lineno = 0;
unsigned long colno = 0;
any error;

View File

@ -19,7 +19,7 @@ callback OnBeforeUnloadEventHandlerNonNull = DOMString? (Event event);
typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler;
[LegacyTreatNonObjectAsNull]
callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional UTF8String source, optional unsigned long lineno, optional unsigned long column, optional any error);
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
interface mixin GlobalEventHandlers {

View File

@ -420,15 +420,13 @@ void WebSocketImpl::PrintErrorOnConsole(const char* aBundleURI,
NS_ENSURE_SUCCESS_VOID(rv);
if (mInnerWindowID) {
rv = errorObject->InitWithWindowID(
message, NS_ConvertUTF8toUTF16(mScriptFile), u""_ns, mScriptLine,
mScriptColumn, nsIScriptError::errorFlag, "Web Socket"_ns,
mInnerWindowID);
rv = errorObject->InitWithWindowID(message, mScriptFile, mScriptLine,
mScriptColumn, nsIScriptError::errorFlag,
"Web Socket"_ns, mInnerWindowID);
} else {
rv =
errorObject->Init(message, NS_ConvertUTF8toUTF16(mScriptFile), u""_ns,
mScriptLine, mScriptColumn, nsIScriptError::errorFlag,
"Web Socket"_ns, mPrivateBrowsing, mIsChromeContext);
rv = errorObject->Init(message, mScriptFile, mScriptLine, mScriptColumn,
nsIScriptError::errorFlag, "Web Socket"_ns,
mPrivateBrowsing, mIsChromeContext);
}
NS_ENSURE_SUCCESS_VOID(rv);

View File

@ -146,13 +146,13 @@ class WorkerDebugger::PostDebuggerMessageRunnable final : public Runnable {
class WorkerDebugger::ReportDebuggerErrorRunnable final : public Runnable {
WorkerDebugger* mDebugger;
nsString mFilename;
nsCString mFilename;
uint32_t mLineno;
nsString mMessage;
public:
ReportDebuggerErrorRunnable(WorkerDebugger* aDebugger,
const nsAString& aFilename, uint32_t aLineno,
const nsACString& aFilename, uint32_t aLineno,
const nsAString& aMessage)
: Runnable("ReportDebuggerErrorRunnable"),
mDebugger(aDebugger),
@ -461,7 +461,7 @@ void WorkerDebugger::PostMessageToDebuggerOnMainThread(
}
}
void WorkerDebugger::ReportErrorToDebugger(const nsAString& aFilename,
void WorkerDebugger::ReportErrorToDebugger(const nsACString& aFilename,
uint32_t aLineno,
const nsAString& aMessage) {
mWorkerPrivate->AssertIsOnWorkerThread();
@ -475,7 +475,7 @@ void WorkerDebugger::ReportErrorToDebugger(const nsAString& aFilename,
}
void WorkerDebugger::ReportErrorToDebuggerOnMainThread(
const nsAString& aFilename, uint32_t aLineno, const nsAString& aMessage) {
const nsACString& aFilename, uint32_t aLineno, const nsAString& aMessage) {
AssertIsOnMainThread();
for (const auto& listener : mListeners.Clone()) {

View File

@ -39,7 +39,7 @@ class WorkerDebugger : public nsIWorkerDebugger {
void PostMessageToDebugger(const nsAString& aMessage);
void ReportErrorToDebugger(const nsAString& aFilename, uint32_t aLineno,
void ReportErrorToDebugger(const nsACString& aFilename, uint32_t aLineno,
const nsAString& aMessage);
private:
@ -47,7 +47,7 @@ class WorkerDebugger : public nsIWorkerDebugger {
void PostMessageToDebuggerOnMainThread(const nsAString& aMessage);
void ReportErrorToDebuggerOnMainThread(const nsAString& aFilename,
void ReportErrorToDebuggerOnMainThread(const nsACString& aFilename,
uint32_t aLineno,
const nsAString& aMessage);

View File

@ -201,7 +201,7 @@ class ReportGenericErrorRunnable final : public WorkerParentDebuggeeRunnable {
} // namespace
void WorkerErrorBase::AssignErrorBase(JSErrorBase* aReport) {
CopyUTF8toUTF16(MakeStringSpan(aReport->filename.c_str()), mFilename);
mFilename.Assign(aReport->filename.c_str());
mLineNumber = aReport->lineno;
mColumnNumber = aReport->column.oneOriginValue();
mErrorNumber = aReport->errorNumber;
@ -218,8 +218,6 @@ WorkerErrorReport::WorkerErrorReport()
void WorkerErrorReport::AssignErrorReport(JSErrorReport* aReport) {
WorkerErrorBase::AssignErrorBase(aReport);
xpc::ErrorReport::ErrorReportToMessageString(aReport, mMessage);
mLine.Assign(aReport->linebuf(), aReport->linebufLength());
mIsWarning = aReport->isWarning();
MOZ_ASSERT(aReport->exnType >= JSEXN_FIRST && aReport->exnType < JSEXN_LIMIT);
mExnType = JSExnType(aReport->exnType);
@ -371,7 +369,7 @@ void WorkerErrorReport::LogErrorToConsole(JSContext* aCx,
ErrorData errorData(
aReport.mIsWarning, aReport.mLineNumber, aReport.mColumnNumber,
aReport.mMessage, aReport.mFilename, aReport.mLine,
aReport.mMessage, aReport.mFilename,
TransformIntoNewArray(aReport.mNotes, [](const WorkerErrorNote& note) {
return ErrorDataNote(note.mLineNumber, note.mColumnNumber,
note.mMessage, note.mFilename);
@ -396,9 +394,8 @@ void WorkerErrorReport::LogErrorToConsole(const ErrorData& aReport,
uint32_t flags = aReport.isWarning() ? nsIScriptError::warningFlag
: nsIScriptError::errorFlag;
if (NS_FAILED(scriptError->nsIScriptError::InitWithWindowID(
aReport.message(), aReport.filename(), aReport.line(),
aReport.lineNumber(), aReport.columnNumber(), flags, category,
aInnerWindowId))) {
aReport.message(), aReport.filename(), aReport.lineNumber(),
aReport.columnNumber(), flags, category, aInnerWindowId))) {
NS_WARNING("Failed to init script error!");
scriptError = nullptr;
}
@ -429,16 +426,15 @@ void WorkerErrorReport::LogErrorToConsole(const ErrorData& aReport,
}
NS_ConvertUTF16toUTF8 msg(aReport.message());
NS_ConvertUTF16toUTF8 filename(aReport.filename());
static const char kErrorString[] = "JS error in Web Worker: %s [%s:%u]";
#ifdef ANDROID
__android_log_print(ANDROID_LOG_INFO, "Gecko", kErrorString, msg.get(),
filename.get(), aReport.lineNumber());
aReport.filename().get(), aReport.lineNumber());
#endif
fprintf(stderr, kErrorString, msg.get(), filename.get(),
fprintf(stderr, kErrorString, msg.get(), aReport.filename().get(),
aReport.lineNumber());
fflush(stderr);
}

View File

@ -21,14 +21,14 @@ class ErrorData;
class WorkerErrorBase {
public:
nsString mMessage;
nsString mFilename;
nsCString mFilename;
// Line number (1-origin).
uint32_t mLineNumber;
uint32_t mLineNumber = 0;
// Column number in UTF-16 code units (1-origin).
uint32_t mColumnNumber;
uint32_t mErrorNumber;
uint32_t mColumnNumber = 0;
uint32_t mErrorNumber = 0;
WorkerErrorBase() : mLineNumber(0), mColumnNumber(0), mErrorNumber(0) {}
WorkerErrorBase() = default;
void AssignErrorBase(JSErrorBase* aReport);
};
@ -42,7 +42,6 @@ class WorkerPrivate;
class WorkerErrorReport : public WorkerErrorBase, public SerializedStackHolder {
public:
nsString mLine;
bool mIsWarning;
JSExnType mExnType;
bool mMutedError;

View File

@ -5188,7 +5188,7 @@ void WorkerPrivate::SetDebuggerImmediate(dom::Function& aHandler,
}
}
void WorkerPrivate::ReportErrorToDebugger(const nsAString& aFilename,
void WorkerPrivate::ReportErrorToDebugger(const nsACString& aFilename,
uint32_t aLineno,
const nsAString& aMessage) {
mDebugger->ReportErrorToDebugger(aFilename, aLineno, aMessage);

View File

@ -406,7 +406,7 @@ class WorkerPrivate final
void SetDebuggerImmediate(Function& aHandler, ErrorResult& aRv);
void ReportErrorToDebugger(const nsAString& aFilename, uint32_t aLineno,
void ReportErrorToDebugger(const nsACString& aFilename, uint32_t aLineno,
const nsAString& aMessage);
bool NotifyInternal(WorkerStatus aStatus);

View File

@ -1344,11 +1344,9 @@ void WorkerDebuggerGlobalScope::SetImmediate(Function& aHandler,
void WorkerDebuggerGlobalScope::ReportError(JSContext* aCx,
const nsAString& aMessage) {
JS::AutoFilename chars;
uint32_t lineno = 0;
JS::DescribeScriptedCaller(aCx, &chars, &lineno);
nsString filename(NS_ConvertUTF8toUTF16(chars.get()));
mWorkerPrivate->ReportErrorToDebugger(filename, lineno, aMessage);
auto caller = JSCallingLocation::Get(aCx);
mWorkerPrivate->ReportErrorToDebugger(caller.FileName(), caller.mLine,
aMessage);
}
void WorkerDebuggerGlobalScope::RetrieveConsoleEvents(

View File

@ -12,7 +12,7 @@ interface nsIWorkerDebuggerListener : nsISupports
{
void onClose();
void onError(in AString filename, in unsigned long lineno,
void onError(in ACString filename, in unsigned long lineno,
in AString message);
void onMessage(in AString message);

View File

@ -593,7 +593,7 @@ void RemoteWorkerChild::ErrorPropagationOnMainThread(
if (aIsErrorEvent) {
ErrorData data(
aReport->mIsWarning, aReport->mLineNumber, aReport->mColumnNumber,
aReport->mMessage, aReport->mFilename, aReport->mLine,
aReport->mMessage, aReport->mFilename,
TransformIntoNewArray(aReport->mNotes, [](const WorkerErrorNote& note) {
return ErrorDataNote(note.mLineNumber, note.mColumnNumber,
note.mMessage, note.mFilename);

View File

@ -102,7 +102,7 @@ struct ErrorDataNote {
uint32_t lineNumber;
uint32_t columnNumber;
nsString message;
nsString filename;
nsCString filename;
};
struct ErrorData {
@ -110,8 +110,7 @@ struct ErrorData {
uint32_t lineNumber;
uint32_t columnNumber;
nsString message;
nsString filename;
nsString line;
nsCString filename;
ErrorDataNote[] notes;
};

View File

@ -1729,15 +1729,13 @@ void RasterImage::ReportDecoderError() {
if (consoleService && errorObject) {
nsAutoString msg(u"Image corrupt or truncated."_ns);
nsAutoString src;
nsAutoCString src;
if (GetURI()) {
nsAutoCString uri;
if (!GetSpecTruncatedTo1k(uri)) {
if (!GetSpecTruncatedTo1k(src)) {
msg += u" URI in this note truncated due to length."_ns;
}
CopyUTF8toUTF16(uri, src);
}
if (NS_SUCCEEDED(errorObject->InitWithWindowID(msg, src, u""_ns, 0, 0,
if (NS_SUCCEEDED(errorObject->InitWithWindowID(msg, src, 0, 0,
nsIScriptError::errorFlag,
"Image", InnerWindowID()))) {
consoleService->LogMessage(errorObject);

View File

@ -11,7 +11,7 @@ use l10nregistry::{
};
use log::warn;
use nserror::{nsresult, NS_ERROR_NOT_AVAILABLE};
use nsstring::{nsCStr, nsString};
use nsstring::{nsCStr, nsCString, nsString};
use std::fmt::{self, Write};
use unic_langid::LanguageIdentifier;
use xpcom::interfaces;
@ -55,7 +55,7 @@ impl ErrorReporter for GeckoEnvironment {
&error.to_string(),
false,
true,
Some(nsString::from(&resource_id.value)),
Some(nsCString::from(&resource_id.value)),
loc.map_or((0, 0), |(l, c)| (l as u32, c as u32)),
interfaces::nsIScriptError::errorFlag as u32,
),
@ -95,7 +95,7 @@ fn log_simple_console_error(
error: &impl fmt::Display,
from_private_window: bool,
from_chrome_context: bool,
path: Option<nsString>,
path: Option<nsCString>,
pos: (u32, u32),
error_flags: u32,
) -> Result<(), nsresult> {
@ -115,10 +115,9 @@ fn log_simple_console_error(
script_error
.Init(
&*error_str,
&*path.unwrap_or(nsString::new()), /* aSourceName */
&*nsString::new(), /* aSourceLine */
pos.0, /* aLineNumber */
pos.1, /* aColNumber */
&*path.unwrap_or_else(nsCString::new), /* aSourceName */
pos.0, /* aLineNumber */
pos.1, /* aColNumber */
error_flags,
&*category,
from_private_window,

View File

@ -2010,12 +2010,12 @@ static nsresult AssembleSandboxMemoryReporterName(JSContext* cx,
// Append the caller's location information.
if (frame) {
nsString location;
nsAutoCString location;
frame->GetFilename(cx, location);
int32_t lineNumber = frame->GetLineNumber(cx);
sandboxName.AppendLiteral(" (from: ");
sandboxName.Append(NS_ConvertUTF16toUTF8(location));
sandboxName.Append(location);
sandboxName.Append(':');
sandboxName.AppendInt(lineNumber);
sandboxName.Append(')');

View File

@ -1348,7 +1348,7 @@ nsXPCComponents_Utils::ReportError(HandleValue error, HandleValue stack,
}
}
nsString fileName;
nsCString fileName;
uint32_t lineNo = 0;
if (!scripterr) {
@ -1374,7 +1374,7 @@ nsXPCComponents_Utils::ReportError(HandleValue error, HandleValue stack,
}
RootedString source(cx);
nsAutoJSString str;
nsAutoJSCString str;
if (GetSavedFrameSource(cx, principals, stackObj, &source) ==
SavedFrameResult::Ok &&
str.init(cx, source)) {
@ -1409,22 +1409,14 @@ nsXPCComponents_Utils::ReportError(HandleValue error, HandleValue stack,
JSErrorReport* err = errorObj ? JS_ErrorFromException(cx, errorObj) : nullptr;
if (err) {
// It's a proper JS Error
nsAutoString fileUni;
CopyUTF8toUTF16(mozilla::MakeStringSpan(err->filename.c_str()), fileUni);
const char16_t* linebuf = err->linebuf();
uint32_t flags = err->isWarning() ? nsIScriptError::warningFlag
: nsIScriptError::errorFlag;
nsresult rv = scripterr->InitWithWindowID(
err->message() ? NS_ConvertUTF8toUTF16(err->message().c_str())
: EmptyString(),
fileUni,
linebuf ? nsDependentString(linebuf, err->linebufLength())
: EmptyString(),
nsDependentCString(err->filename ? err->filename.c_str() : ""),
err->lineno, err->column.oneOriginValue(), flags,
"XPConnect JavaScript", innerWindowID,
innerWindowID == 0 ? true : false);
"XPConnect JavaScript", innerWindowID, innerWindowID == 0);
NS_ENSURE_SUCCESS(rv, NS_OK);
console->LogMessage(scripterr);
@ -1442,9 +1434,9 @@ nsXPCComponents_Utils::ReportError(HandleValue error, HandleValue stack,
return NS_OK;
}
nsresult rv = scripterr->InitWithWindowID(
msg, fileName, u""_ns, lineNo, 0, 0, "XPConnect JavaScript",
innerWindowID, innerWindowID == 0 ? true : false);
nsresult rv = scripterr->InitWithWindowID(msg, fileName, lineNo, 0, 0,
"XPConnect JavaScript",
innerWindowID, innerWindowID == 0);
NS_ENSURE_SUCCESS(rv, NS_OK);
console->LogMessage(scripterr);
@ -1471,11 +1463,8 @@ nsXPCComponents_Utils::EvalInSandbox(
filename.Assign(filenameArg);
} else {
// Get the current source info.
nsCOMPtr<nsIStackFrame> frame = dom::GetCurrentJSStack();
if (frame) {
nsString frameFile;
frame->GetFilename(cx, frameFile);
CopyUTF16toUTF8(frameFile, filename);
if (nsCOMPtr<nsIStackFrame> frame = dom::GetCurrentJSStack()) {
frame->GetFilename(cx, filename);
lineNo = frame->GetLineNumber(cx);
}
}

View File

@ -1123,15 +1123,13 @@ static nsresult JSErrorToXPCException(JSContext* cx, const char* toStringResult,
bestMessage.AssignLiteral("JavaScript Error");
}
const char16_t* linebuf = report->linebuf();
uint32_t flags = report->isWarning() ? nsIScriptError::warningFlag
: nsIScriptError::errorFlag;
data = new nsScriptError();
data->nsIScriptError::InitWithWindowID(
bestMessage, NS_ConvertUTF8toUTF16(report->filename.c_str()),
linebuf ? nsDependentString(linebuf, report->linebufLength())
: EmptyString(),
bestMessage,
nsDependentCString(report->filename ? report->filename.c_str() : ""),
report->lineno, report->column.oneOriginValue(), flags,
"XPConnect JavaScript"_ns,
nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx));

View File

@ -645,7 +645,7 @@ nsresult nsXPCWrappedJS::CheckForException(XPCCallContext& ccx,
// try to get filename, lineno from the first
// stack frame location.
int32_t lineNumber = 0;
nsString sourceName;
nsAutoCString sourceName;
nsCOMPtr<nsIStackFrame> location = xpc_exception->GetLocation();
if (location) {
@ -657,8 +657,8 @@ nsresult nsXPCWrappedJS::CheckForException(XPCCallContext& ccx,
}
nsresult rv = scriptError->InitWithWindowID(
NS_ConvertUTF8toUTF16(newMessage), sourceName, u""_ns,
lineNumber, 0, 0, "XPConnect JavaScript",
NS_ConvertUTF8toUTF16(newMessage), sourceName, lineNumber, 0, 0,
"XPConnect JavaScript",
nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx));
if (NS_FAILED(rv)) {
scriptError = nullptr;

View File

@ -202,8 +202,7 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::NewInstance(
auto location = JSCallingLocation::Get(cx);
nsCOMPtr<nsIScriptError> error(
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(NS_ConvertUTF8toUTF16(errorMsg),
NS_ConvertUTF8toUTF16(location.FileName()), u""_ns,
error->Init(NS_ConvertUTF8toUTF16(errorMsg), location.FileName(),
location.mLine, location.mColumn, nsIScriptError::warningFlag,
"chrome javascript"_ns, false /* from private window */,
true /* from chrome context */);

View File

@ -189,8 +189,7 @@ void xpc::ErrorBase::Init(JSErrorBase* aReport) {
if (!aReport->filename) {
mFileName.SetIsVoid(true);
} else {
CopyUTF8toUTF16(mozilla::MakeStringSpan(aReport->filename.c_str()),
mFileName);
mFileName.Assign(aReport->filename.c_str());
}
mSourceId = aReport->sourceId;
@ -220,8 +219,6 @@ void xpc::ErrorReport::Init(JSErrorReport* aReport, const char* aToStringResult,
mErrorMsg.AssignLiteral("<unknown>");
}
mSourceLine.Assign(aReport->linebuf(), aReport->linebufLength());
if (aReport->errorMessageName) {
mErrorMsgName.AssignASCII(aReport->errorMessageName);
} else {
@ -263,7 +260,7 @@ void xpc::ErrorReport::Init(JSContext* aCx, mozilla::dom::Exception* aException,
static LazyLogModule gJSDiagnostics("JSDiagnostics");
void xpc::ErrorBase::AppendErrorDetailsTo(nsCString& error) {
AppendUTF16toUTF8(mFileName, error);
error = mFileName;
error.AppendLiteral(", line ");
error.AppendInt(mLineNumber, 10);
error.AppendLiteral(": ");
@ -324,8 +321,8 @@ void xpc::ErrorReport::LogToConsoleWithStack(
LogToStderr();
MOZ_LOG(gJSDiagnostics, IsWarning() ? LogLevel::Warning : LogLevel::Error,
("file %s, line %u\n%s", NS_ConvertUTF16toUTF8(mFileName).get(),
mLineNumber, NS_ConvertUTF16toUTF8(mErrorMsg).get()));
("file %s, line %u\n%s", mFileName.get(), mLineNumber,
NS_ConvertUTF16toUTF8(mErrorMsg).get()));
// Log to the console. We do this last so that we can simply return if
// there's no console service without affecting the other reporting
@ -341,8 +338,8 @@ void xpc::ErrorReport::LogToConsoleWithStack(
uint32_t flags =
mIsWarning ? nsIScriptError::warningFlag : nsIScriptError::errorFlag;
nsresult rv = errorObject->InitWithWindowID(
mErrorMsg, mFileName, mSourceLine, mLineNumber, mColumn, flags, mCategory,
mWindowID, mCategory.Equals("chrome javascript"_ns));
mErrorMsg, mFileName, mLineNumber, mColumn, flags, mCategory, mWindowID,
mCategory.Equals("chrome javascript"_ns));
NS_ENSURE_SUCCESS_VOID(rv);
rv = errorObject->InitSourceId(mSourceId);

View File

@ -720,7 +720,7 @@ void InitGlobalObjectOptions(JS::RealmOptions& aOptions,
class ErrorBase {
public:
nsString mErrorMsg;
nsString mFileName;
nsCString mFileName;
uint32_t mSourceId;
// Line number (1-origin).
uint32_t mLineNumber;
@ -755,7 +755,6 @@ class ErrorReport : public ErrorBase {
nsTArray<ErrorNote> mNotes;
nsCString mCategory;
nsString mSourceLine;
nsString mErrorMsgName;
uint64_t mWindowID;
bool mIsWarning;

View File

@ -270,9 +270,9 @@ bool ReportWrapperDenial(JSContext* cx, HandleId id, WrapperDenialType type,
"access from a given global object will be reported.",
NS_LossyConvertUTF16toASCII(propertyName).get());
}
nsString filenameStr(NS_ConvertASCIItoUTF16(filename.get()));
nsresult rv = errorObject->InitWithWindowID(
NS_ConvertASCIItoUTF16(errorMessage.ref()), filenameStr, u""_ns, line,
NS_ConvertASCIItoUTF16(errorMessage.ref()),
nsDependentCString(filename.get() ? filename.get() : ""), line,
column.oneOriginValue(), nsIScriptError::warningFlag, "XPConnect",
windowId);
NS_ENSURE_SUCCESS(rv, true);

View File

@ -74,11 +74,7 @@ static void logMessage(nsIContent* aContent, const nsAString& aCoordsSpec,
int32_t aFlags, const char* aMessageName) {
nsContentUtils::ReportToConsole(
aFlags, "Layout: ImageMap"_ns, aContent->OwnerDoc(),
nsContentUtils::eLAYOUT_PROPERTIES, aMessageName,
nsTArray<nsString>(), /* params */
SourceLocation(aContent->OwnerDoc()->GetDocumentURI(), 0, 1,
NS_ConvertUTF16toUTF8(u"coords=\""_ns + aCoordsSpec +
u"\""_ns))); /* source line */
nsContentUtils::eLAYOUT_PROPERTIES, aMessageName);
}
void Area::ParseCoords(const nsAString& aSpec) {

View File

@ -37,7 +37,7 @@ class ShortTermURISpecCache : public Runnable {
ShortTermURISpecCache()
: Runnable("ShortTermURISpecCache"), mPending(false) {}
nsString const& GetSpec(nsIURI* aURI) {
nsCString const& GetSpec(nsIURI* aURI) {
if (mURI != aURI) {
mURI = aURI;
@ -62,7 +62,7 @@ class ShortTermURISpecCache : public Runnable {
private:
nsCOMPtr<nsIURI> mURI;
nsString mSpec;
nsCString mSpec;
bool mPending;
};
@ -200,17 +200,9 @@ bool ErrorReporter::ShouldReportErrors(const StyleSheet* aSheet,
return false;
}
void ErrorReporter::OutputError(const nsACString& aSourceLine,
const nsACString& aSelectors,
void ErrorReporter::OutputError(const nsACString& aSelectors,
uint32_t aLineNumber, uint32_t aColNumber,
nsIURI* aURI) {
nsAutoString errorLine;
// This could be a really long string for minified CSS; just leave it empty
// if we OOM.
if (!AppendUTF8toUTF16(aSourceLine, errorLine, fallible)) {
errorLine.Truncate();
}
nsAutoString selectors;
if (!AppendUTF8toUTF16(aSelectors, selectors, fallible)) {
selectors.Truncate();
@ -220,7 +212,7 @@ void ErrorReporter::OutputError(const nsACString& aSourceLine,
return;
}
nsAutoString fileName;
nsAutoCString fileName;
if (aURI) {
if (!sSpecCache) {
sSpecCache = new ShortTermURISpecCache;
@ -239,8 +231,8 @@ void ErrorReporter::OutputError(const nsACString& aSourceLine,
// It is safe to used InitWithSanitizedSource because fileName is
// an already anonymized uri spec.
rv = errorObject->InitWithSanitizedSource(
mError, fileName, errorLine, aLineNumber, aColNumber,
nsIScriptError::warningFlag, "CSS Parser", mInnerWindowId);
mError, fileName, aLineNumber, aColNumber, nsIScriptError::warningFlag,
"CSS Parser", mInnerWindowId);
if (NS_SUCCEEDED(rv)) {
errorObject->SetCssSelectors(selectors);

View File

@ -42,8 +42,8 @@ class MOZ_STACK_CLASS ErrorReporter final {
static bool ShouldReportErrors(const StyleSheet*, const Loader*);
static uint64_t FindInnerWindowId(const StyleSheet*, const Loader*);
void OutputError(const nsACString& aSource, const nsACString& aSelectors,
uint32_t aLineNumber, uint32_t aColNumber, nsIURI* aURI);
void OutputError(const nsACString& aSelectors, uint32_t aLineNumber,
uint32_t aColNumber, nsIURI* aURI);
void ClearError();
// In all overloads of ReportUnexpected, aMessage is a stringbundle

View File

@ -637,12 +637,10 @@ nsresult FontFaceSetImpl::LogMessage(gfxUserFontEntry* aUserFontEntry,
// try to give the user an indication of where the rule came from
StyleLockedFontFaceRule* rule = FindRuleForUserFontEntry(aUserFontEntry);
nsString href;
nsAutoCString text;
nsAutoCString href;
uint32_t line = 0;
uint32_t column = 0;
if (rule) {
Servo_FontFaceRule_GetCssText(rule, &text);
Servo_FontFaceRule_GetSourceLocation(rule, &line, &column);
// FIXME We need to figure out an approach to get the style sheet
// of this raw rule. See bug 1450903.
@ -666,8 +664,7 @@ nsresult FontFaceSetImpl::LogMessage(gfxUserFontEntry* aUserFontEntry,
NS_ENSURE_SUCCESS(rv, rv);
rv = scriptError->InitWithWindowID(NS_ConvertUTF8toUTF16(message),
href, // file
NS_ConvertUTF8toUTF16(text), // src line
href, // file
line, column,
aFlags, // flags
"CSS Loader", // category (make separate?)

View File

@ -1515,12 +1515,14 @@ bool Gecko_ErrorReportingEnabled(const StyleSheet* aSheet,
return true;
}
void Gecko_ReportUnexpectedCSSError(
const uint64_t aWindowId, nsIURI* aURI, const char* message,
const char* param, uint32_t paramLen, const char* prefix,
const char* prefixParam, uint32_t prefixParamLen, const char* suffix,
const char* source, uint32_t sourceLen, const char* selectors,
uint32_t selectorsLen, uint32_t lineNumber, uint32_t colNumber) {
void Gecko_ReportUnexpectedCSSError(const uint64_t aWindowId, nsIURI* aURI,
const char* message, const char* param,
uint32_t paramLen, const char* prefix,
const char* prefixParam,
uint32_t prefixParamLen, const char* suffix,
const char* selectors,
uint32_t selectorsLen, uint32_t lineNumber,
uint32_t colNumber) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
ErrorReporter reporter(aWindowId);
@ -1548,10 +1550,8 @@ void Gecko_ReportUnexpectedCSSError(
if (suffix) {
reporter.ReportUnexpected(suffix);
}
nsDependentCSubstring sourceValue(source, sourceLen);
nsDependentCSubstring selectorsValue(selectors, selectorsLen);
reporter.OutputError(sourceValue, selectorsValue, lineNumber + 1, colNumber,
aURI);
reporter.OutputError(selectorsValue, lineNumber + 1, colNumber, aURI);
}
void Gecko_ContentList_AppendAll(nsSimpleContentList* aList,

View File

@ -536,9 +536,8 @@ bool Gecko_ErrorReportingEnabled(const mozilla::StyleSheet* sheet,
void Gecko_ReportUnexpectedCSSError(
uint64_t windowId, nsIURI* uri, const char* message, const char* param,
uint32_t paramLen, const char* prefix, const char* prefixParam,
uint32_t prefixParamLen, const char* suffix, const char* source,
uint32_t sourceLen, const char* selectors, uint32_t selectorsLen,
uint32_t lineNumber, uint32_t colNumber);
uint32_t prefixParamLen, const char* suffix, const char* selectors,
uint32_t selectorsLen, uint32_t lineNumber, uint32_t colNumber);
// DOM APIs.
void Gecko_ContentList_AppendAll(nsSimpleContentList* aContentList,

View File

@ -43,15 +43,15 @@ var tests = [
];
var results = [
[ { errorMessage: /Unknown property \u2018nosuchprop\u2019/,
lineNumber: 1, columnNumber: 16, sourceLine: "", cssSelectors: "#s1" },
lineNumber: 1, columnNumber: 16, cssSelectors: "#s1" },
{ errorMessage: /Unknown property \u2018nosuchprop\u2019/,
lineNumber: 2, columnNumber: 16, sourceLine: "", cssSelectors: "#s2" },
lineNumber: 2, columnNumber: 16, cssSelectors: "#s2" },
{ errorMessage: /Ruleset ignored due to bad selector/,
lineNumber: 2, columnNumber: 41, sourceLine: "", cssSelectors: "" } ],
lineNumber: 2, columnNumber: 41, cssSelectors: "" } ],
[ { errorMessage: /parsing value for \u2018width\u2019/,
lineNumber: 1, columnNumber: 7, sourceLine: "", cssSelectors: "" } ],
lineNumber: 1, columnNumber: 7, cssSelectors: "" } ],
[ { errorMessage: /parsing value for \u2018width\u2019/,
lineNumber: 1, columnNumber: 1, sourceLine: "", cssSelectors: "" } ],
lineNumber: 1, columnNumber: 1, cssSelectors: "" } ],
];
var curTest = -1;

View File

@ -2066,7 +2066,7 @@ nsresult NS_NewURI(nsIURI** aURI, const nsACString& aSpec,
}
nsresult NS_GetSanitizedURIStringFromURI(nsIURI* aUri,
nsAString& aSanitizedSpec) {
nsACString& aSanitizedSpec) {
aSanitizedSpec.Truncate();
nsCOMPtr<nsISensitiveInfoHiddenURI> safeUri = do_QueryInterface(aUri);
@ -2079,7 +2079,7 @@ nsresult NS_GetSanitizedURIStringFromURI(nsIURI* aUri,
}
if (NS_SUCCEEDED(rv)) {
aSanitizedSpec.Assign(NS_ConvertUTF8toUTF16(cSpec));
aSanitizedSpec.Assign(cSpec);
}
return rv;
}

View File

@ -137,7 +137,7 @@ nsresult NS_GetURIWithNewRef(nsIURI* aInput, const nsACString& aRef,
nsresult NS_GetURIWithoutRef(nsIURI* aInput, nsIURI** aOutput);
nsresult NS_GetSanitizedURIStringFromURI(nsIURI* aUri,
nsAString& aSanitizedSpec);
nsACString& aSanitizedSpec);
/*
* How to create a new Channel, using NS_NewChannel,

View File

@ -3703,9 +3703,9 @@ nsresult HttpBaseChannel::AddSecurityMessage(
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->InitWithSourceURI(
errorText, mURI, u""_ns, 0, 0, nsIScriptError::warningFlag,
NS_ConvertUTF16toUTF8(aMessageCategory), innerWindowID);
error->InitWithSourceURI(errorText, mURI, 0, 0, nsIScriptError::warningFlag,
NS_ConvertUTF16toUTF8(aMessageCategory),
innerWindowID);
console->LogMessage(error);

View File

@ -1742,18 +1742,16 @@ void nsCORSListenerProxy::LogBlockedCORSRequest(
// the error to the browser console.
if (aInnerWindowID > 0) {
rv = scriptError->InitWithSanitizedSource(aMessage,
u""_ns, // sourceName
u""_ns, // sourceLine
0, // lineNumber
0, // columnNumber
""_ns, // sourceName
0, // lineNumber
0, // columnNumber
errorFlag, aCategory,
aInnerWindowID);
} else {
rv = scriptError->Init(aMessage,
u""_ns, // sourceName
u""_ns, // sourceLine
0, // lineNumber
0, // columnNumber
""_ns, // sourceName
0, // lineNumber
0, // columnNumber
errorFlag, aCategory, aPrivateBrowsing,
aFromChromeContext); // From chrome context
}

View File

@ -8038,9 +8038,9 @@ nsresult nsHttpChannel::LogConsoleError(const char* aTag) {
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
NS_ENSURE_TRUE(error, NS_ERROR_OUT_OF_MEMORY);
rv = error->InitWithSourceURI(errorText, mURI, u""_ns, 0, 0,
nsIScriptError::errorFlag,
"Invalid HTTP Status Lines"_ns, innerWindowID);
rv =
error->InitWithSourceURI(errorText, mURI, 0, 0, nsIScriptError::errorFlag,
"Invalid HTTP Status Lines"_ns, innerWindowID);
NS_ENSURE_SUCCESS(rv, rv);
console->LogMessage(error);
return NS_OK;

View File

@ -1139,7 +1139,7 @@ nsresult nsExpatDriver::HandleError() {
nsresult rv = NS_ERROR_FAILURE;
if (serr) {
rv = serr->InitWithSourceURI(
errorText, mURIs.SafeElementAt(0), mLastLine,
errorText, mURIs.SafeElementAt(0),
lineNumber.unverified_safe_because(RLBOX_SAFE_PRINT),
colNumber.unverified_safe_because(RLBOX_SAFE_PRINT),
nsIScriptError::errorFlag, "malformed-xml", mInnerWindowID);

View File

@ -440,7 +440,6 @@ async function throwScriptError(options = {}) {
scriptError.initWithWindowID(
options.text,
options.sourceName || "sourceName",
null,
options.lineNumber || 0,
options.columnNumber || 0,
flag,

View File

@ -362,7 +362,7 @@ export class WindowRealm extends Realm {
* The JavaScript stack trace.
*/
reportError(message, stack) {
const { column, line, source: sourceLine } = stack;
const { column, line } = stack;
const scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
const scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
@ -370,7 +370,6 @@ export class WindowRealm extends Realm {
scriptError.initWithWindowID(
message,
this.#window.document.baseURI,
sourceLine,
line,
column,
Ci.nsIScriptError.errorFlag,

View File

@ -81,7 +81,6 @@ function logConsoleMessage(options = {}) {
scriptError.initWithWindowID(
_options.message,
_options.sourceName || "sourceName",
null,
_options.lineNumber || 0,
_options.columnNumber || 0,
levelToFlags[level],

View File

@ -48,7 +48,8 @@ static void SandboxLogJSStack(void) {
// using or something.
JSContext* cx = frame ? nsContentUtils::GetCurrentJSContext() : nullptr;
for (int i = 0; frame != nullptr; ++i) {
nsAutoString fileName, funName;
nsAutoCString fileName;
nsAutoString funName;
int32_t lineNumber;
// Don't stop unwinding if an attribute can't be read.
@ -62,9 +63,7 @@ static void SandboxLogJSStack(void) {
SANDBOX_LOG("JS frame %d: %s %s line %d", i,
funName.IsVoid() ? "(anonymous)"
: NS_ConvertUTF16toUTF8(funName).get(),
fileName.IsVoid() ? "(no file)"
: NS_ConvertUTF16toUTF8(fileName).get(),
lineNumber);
fileName.IsVoid() ? "(no file)" : fileName.get(), lineNumber);
}
frame = frame->GetCaller(cx);

View File

@ -476,8 +476,6 @@ impl ErrorReporter {
let pre_param = pre_param.map(|p| p.into_str());
let param_ptr = param.as_ref().map_or(ptr::null(), |p| p.as_ptr());
let pre_param_ptr = pre_param.as_ref().map_or(ptr::null(), |p| p.as_ptr());
// The CSS source text is unused and will be removed in bug 1381188.
let source = "";
unsafe {
bindings::Gecko_ReportUnexpectedCSSError(
self.window_id,
@ -489,8 +487,6 @@ impl ErrorReporter {
pre_param_ptr as *const _,
pre_param.as_ref().map_or(0, |p| p.len()) as u32,
suffix as *const _,
source.as_ptr() as *const _,
source.len() as u32,
selector_list_ptr,
desugared_selector_list
.as_ref()

View File

@ -75,7 +75,6 @@ SPConsoleListener.prototype = {
errorMessage: null,
cssSelectors: null,
sourceName: null,
sourceLine: null,
lineNumber: null,
columnNumber: null,
category: null,
@ -88,7 +87,6 @@ SPConsoleListener.prototype = {
m.errorMessage = msg.errorMessage;
m.cssSelectors = msg.cssSelectors;
m.sourceName = msg.sourceName;
m.sourceLine = msg.sourceLine;
m.lineNumber = msg.lineNumber;
m.columnNumber = msg.columnNumber;
m.category = msg.category;

View File

@ -111,9 +111,8 @@ export class CookieBannerParent extends JSWindowActorParent {
consoleMsg.initWithWindowID(
message.value,
this.manager.documentURI?.spec,
null,
null,
null,
0,
0,
Ci.nsIScriptError.warningFlag,
"cookiebannerhandling",
this.manager?.innerWindowId

View File

@ -748,7 +748,6 @@ export class BaseContext {
new ScriptError(
message,
fileName,
null,
lineNumber,
columnNumber,
Ci.nsIScriptError.errorFlag,

View File

@ -730,7 +730,6 @@ class Script {
new ScriptError(
error.toString(),
error.fileName,
null,
error.lineNumber,
error.columnNumber,
Ci.nsIScriptError.errorFlag,

View File

@ -48,7 +48,6 @@ const initializeBackgroundPage = context => {
consoleMsg.initWithWindowID(
text,
filename,
null,
lineNumber,
columnNumber,
Ci.nsIScriptError.warningFlag,

View File

@ -25,7 +25,7 @@ void LogToBrowserConsole(uint32_t aLogLevel, const nsAString& aMsg) {
}
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(aMsg, u""_ns, u""_ns, 0, 0, aLogLevel, "chrome javascript"_ns,
error->Init(aMsg, ""_ns, 0, 0, aLogLevel, "chrome javascript"_ns,
false /* from private window */, true /* from chrome context */);
console->LogMessage(error);
}

View File

@ -52,7 +52,6 @@ export const InsecurePasswordUtils = {
domDoc.location.href,
0,
0,
0,
flag,
category,
windowId

View File

@ -86,7 +86,7 @@ add_task(async function testInsecurePasswordWarning() {
let promiseConsoleMessages = new Promise(resolve => {
warningPatternHandler = function (warning, originMessage) {
Assert.ok(warning, "Handling a warning pattern");
let fullMessage = `[${warning.msg} {file: "${testURL}" line: 0 column: 0 source: "0"}]`;
let fullMessage = `[${warning.msg} {file: "${testURL}" line: 0}]`;
Assert.equal(
originMessage,
fullMessage,

View File

@ -127,7 +127,7 @@ void LogToBrowserConsole(uint32_t aLogLevel, const nsAString& aMsg) {
}
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
error->Init(aMsg, u""_ns, u""_ns, 0, 0, aLogLevel, "chrome javascript"_ns,
error->Init(aMsg, ""_ns, 0, 0, aLogLevel, "chrome javascript"_ns,
false /* from private window */, true /* from chrome context */);
console->LogMessage(error);
}

View File

@ -373,12 +373,12 @@ NS_IMETHODIMP PreloaderBase::UsageTimer::Notify(nsITimer* aTimer) {
return NS_OK;
}
nsString spec;
nsAutoCString spec;
NS_GetSanitizedURIStringFromURI(uri, spec);
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, "DOM"_ns,
mDocument, nsContentUtils::eDOM_PROPERTIES,
"UnusedLinkPreloadPending",
nsTArray<nsString>({std::move(spec)}));
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag, "DOM"_ns, mDocument,
nsContentUtils::eDOM_PROPERTIES, "UnusedLinkPreloadPending",
nsTArray<nsString>({NS_ConvertUTF8toUTF16(spec)}));
return NS_OK;
}

View File

@ -502,7 +502,7 @@ class CycleCollectedJSRuntime {
// complicated garbage-collection scenarios, e.g. a JSContext being killed
// while we still hold onto an exception thrown from it.
struct ErrorDetails {
nsString mFilename;
nsCString mFilename;
nsString mMessage;
nsString mStack;
JSExnType mType;

View File

@ -191,7 +191,8 @@ nsresult nsConsoleService::MaybeForwardScriptError(nsIConsoleMessage* aMessage,
return NS_ERROR_FAILURE;
}
nsAutoString msg, sourceName, sourceLine;
nsAutoString msg;
nsAutoCString sourceName;
nsCString category;
uint32_t lineNum, colNum, flags;
uint64_t innerWindowId;
@ -201,8 +202,6 @@ nsresult nsConsoleService::MaybeForwardScriptError(nsIConsoleMessage* aMessage,
NS_ENSURE_SUCCESS(rv, rv);
rv = scriptError->GetSourceName(sourceName);
NS_ENSURE_SUCCESS(rv, rv);
rv = scriptError->GetSourceLine(sourceLine);
NS_ENSURE_SUCCESS(rv, rv);
rv = scriptError->GetCategory(getter_Copies(category));
NS_ENSURE_SUCCESS(rv, rv);
@ -219,9 +218,9 @@ nsresult nsConsoleService::MaybeForwardScriptError(nsIConsoleMessage* aMessage,
rv = scriptError->GetInnerWindowID(&innerWindowId);
NS_ENSURE_SUCCESS(rv, rv);
*sent = contentParent->SendScriptError(
msg, sourceName, sourceLine, lineNum, colNum, flags, category,
fromPrivateWindow, innerWindowId, fromChromeContext);
*sent = contentParent->SendScriptError(msg, sourceName, lineNum, colNum,
flags, category, fromPrivateWindow,
innerWindowId, fromChromeContext);
return NS_OK;
}

View File

@ -15,7 +15,7 @@ native StackFrameRef(already_AddRefed<nsIStackFrame>);
interface nsIStackFrame : nsISupports
{
[implicit_jscontext, binaryname(FilenameXPCOM)]
readonly attribute AString filename;
readonly attribute AUTF8String filename;
[implicit_jscontext, binaryname(NameXPCOM)]
readonly attribute AString name;
// Unique identifier of the script source for the frame, or zero.
@ -26,7 +26,6 @@ interface nsIStackFrame : nsISupports
readonly attribute int32_t lineNumber;
[implicit_jscontext, binaryname(ColumnNumberXPCOM)]
readonly attribute int32_t columnNumber;
readonly attribute AUTF8String sourceLine;
[implicit_jscontext, binaryname(AsyncCauseXPCOM)]
readonly attribute AString asyncCause;
[implicit_jscontext, binaryname(AsyncCallerXPCOM)]
@ -49,7 +48,7 @@ interface nsIStackFrame : nsISupports
// Infallible things to be called from C++.
[notxpcom, nostdcall]
void getFilename(in JSContext aCx, out AString aFilename);
void getFilename(in JSContext aCx, out AUTF8String aFilename);
[notxpcom, nostdcall]
void getName(in JSContext aCx, out AString aName);
[notxpcom, nostdcall]

View File

@ -153,10 +153,9 @@ void LogMessageWithContext(FileLocation& aFile, uint32_t aLineNumber,
}
nsresult rv = error->Init(
NS_ConvertUTF8toUTF16(formatted.get()), NS_ConvertUTF8toUTF16(file),
u""_ns, aLineNumber, 0, nsIScriptError::warningFlag,
"chrome registration"_ns, false /* from private window */,
true /* from chrome context */);
NS_ConvertUTF8toUTF16(formatted.get()), file, aLineNumber, 0,
nsIScriptError::warningFlag, "chrome registration"_ns,
false /* from private window */, true /* from chrome context */);
if (NS_FAILED(rv)) {
return;
}

Some files were not shown because too many files have changed in this diff Show More