Skip to content

Commit ee4a1fc

Browse files
committed
ref: Reformat computeStackTraceFromStackProp variables in TraceKit
1 parent f4a2862 commit ee4a1fc

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

vendor/TraceKit/tracekit.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -364,26 +364,28 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
364364
// ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
365365

366366
/**
367-
* Computes stack trace information from the stack property.
368-
* Chrome and Gecko use this property.
369-
* @param {Error} ex
370-
* @return {?Object.<string, *>} Stack trace information.
371-
*/
367+
* Computes stack trace information from the stack property.
368+
* Chrome and Gecko use this property.
369+
* @param {Error} ex
370+
* @return {?Object.<string, *>} Stack trace information.
371+
*/
372372
function computeStackTraceFromStackProp(ex) {
373373
if (typeof ex.stack === 'undefined' || !ex.stack) return;
374374

375-
var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
376-
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,
377-
winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
378-
// Used to additionally parse URL/line/column from eval frames
379-
geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i,
380-
chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/,
381-
lines = ex.stack.split('\n'),
382-
stack = [],
383-
submatch,
384-
parts,
385-
element,
386-
reference = /^(.*) is undefined$/.exec(ex.message);
375+
var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
376+
var winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
377+
// NOTE: blob urls are now supposed to always have an origin, therefore it's format
378+
// which is `blob:http://url/path/with-some-uuid`, is matched by `blob.*?:\/` as well
379+
var gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i;
380+
// Used to additionally parse URL/line/column from eval frames
381+
var geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
382+
var chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/;
383+
var lines = ex.stack.split('\n');
384+
var stack = [];
385+
var submatch;
386+
var parts;
387+
var element;
388+
var reference = /^(.*) is undefined$/.exec(ex.message);
387389

388390
for (var i = 0, j = lines.length; i < j; ++i) {
389391
if ((parts = chrome.exec(lines[i]))) {

0 commit comments

Comments
 (0)