Bug 1543751 Part 3 - Use stack for error location if none was specified, r=nchevobbe.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 15 Apr 2019 13:48:32 -1000
changeset 469756 e38792ce2185
parent 469755 39a877972476
child 469757 f236858f5add
push id35881
push usercbrindusan@mozilla.com
push dateWed, 17 Apr 2019 09:38:58 +0000
treeherdermozilla-central@bbca68b2af26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1543751
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1543751 Part 3 - Use stack for error location if none was specified, r=nchevobbe.
devtools/server/actors/webconsole.js
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -1510,25 +1510,40 @@ WebConsoleActor.prototype =
             sourceId: this.getActorIdForInternalSourceId(note.sourceId),
             line: note.lineNumber,
             column: note.columnNumber,
           },
         });
       }
     }
 
+    // If there is no location information in the error but we have a stack,
+    // fill in the location with the first frame on the stack.
+    let {
+      sourceName,
+      sourceId,
+      lineNumber,
+      columnNumber,
+    } = pageError;
+    if (!sourceName && !sourceId && !lineNumber && !columnNumber && stack) {
+      sourceName = stack[0].filename;
+      sourceId = stack[0].sourceId;
+      lineNumber = stack[0].lineNumber;
+      columnNumber = stack[0].columnNumber;
+    }
+
     return {
       errorMessage: this._createStringGrip(pageError.errorMessage),
       errorMessageName: pageError.errorMessageName,
       exceptionDocURL: ErrorDocs.GetURL(pageError),
-      sourceName: pageError.sourceName,
-      sourceId: this.getActorIdForInternalSourceId(pageError.sourceId),
-      lineText: lineText,
-      lineNumber: pageError.lineNumber,
-      columnNumber: pageError.columnNumber,
+      sourceName,
+      sourceId: this.getActorIdForInternalSourceId(sourceId),
+      lineText,
+      lineNumber,
+      columnNumber,
       category: pageError.category,
       innerWindowID: pageError.innerWindowID,
       timeStamp: pageError.timeStamp,
       warning: !!(pageError.flags & pageError.warningFlag),
       error: !!(pageError.flags & pageError.errorFlag),
       exception: !!(pageError.flags & pageError.exceptionFlag),
       strict: !!(pageError.flags & pageError.strictFlag),
       info: !!(pageError.flags & pageError.infoFlag),