Skip to content

Commit 8daff23

Browse files
committed
tracekit: onerror url patch for Firefox
1 parent c80cf02 commit 8daff23

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/browser/src/tracekit/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ TraceKit.report = (function reportModuleWrapper() {
230230
* @memberof TraceKit.report
231231
*/
232232
function traceKitWindowOnError(message, url, lineNo, columnNo, errorObj) {
233+
debugger;
233234
var stack = null;
234235
// If 'errorObj' is ErrorEvent, get real Error from inside
235236
errorObj = isErrorEvent(errorObj) ? errorObj.error : errorObj;
@@ -265,7 +266,15 @@ TraceKit.report = (function reportModuleWrapper() {
265266
name: name,
266267
message: msg,
267268
mode: 'onerror',
268-
stack: [location],
269+
stack: [
270+
{
271+
...location,
272+
// Firefox sometimes doesn't return url correctly and this is an old behavior
273+
// that I prefer to port here as well.
274+
// It can be altered only here, as previously it's using `location.url` for other things — Kamil
275+
url: location.url || getLocationHref(),
276+
},
277+
],
269278
};
270279

271280
notifyHandlers(stack, true, null);

0 commit comments

Comments
 (0)