@highlight-run/rrweb 2.0.1 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/console-record.js +12 -655
- package/dist/plugins/console-record.min.js +12 -15
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +4 -293
- package/dist/plugins/console-replay.min.js +4 -15
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/plugins/sequential-id-record.js +1 -33
- package/dist/plugins/sequential-id-record.min.js +1 -1
- package/dist/plugins/sequential-id-record.min.js.map +1 -1
- package/dist/plugins/sequential-id-replay.js +1 -37
- package/dist/plugins/sequential-id-replay.min.js +1 -1
- package/dist/plugins/sequential-id-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.js +3 -747
- package/dist/record/rrweb-record-pack.min.js +3 -15
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +4 -3318
- package/dist/record/rrweb-record.min.js +4 -15
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.css +1 -0
- package/dist/replay/rrweb-replay-unpack.js +5 -4614
- package/dist/replay/rrweb-replay-unpack.min.js +5 -17
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.css +1 -0
- package/dist/replay/rrweb-replay.js +5 -4204
- package/dist/replay/rrweb-replay.min.js +5 -17
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.css +1 -0
- package/dist/rrweb-all.js +16 -8696
- package/dist/rrweb-all.min.js +16 -17
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.css +1 -0
- package/dist/rrweb.js +6 -7282
- package/dist/rrweb.min.js +6 -17
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
- package/es/rrweb/all.css +1 -0
- package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
- package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
- package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
- package/es/rrweb/packages/rrweb/src/index.js +6 -4
- package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
- package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
- package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
- package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
- package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
- package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
- package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
- package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
- package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
- package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
- package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
- package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
- package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
- package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
- package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
- package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
- package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
- package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
- package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
- package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
- package/es/rrweb/packages/rrweb/src/types.js +72 -72
- package/es/rrweb/packages/rrweb/src/utils.js +312 -506
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +190 -72
- package/lib/plugins/console-record.js +469 -627
- package/lib/plugins/console-replay.js +198 -268
- package/lib/plugins/sequential-id-record.js +19 -20
- package/lib/plugins/sequential-id-replay.js +25 -25
- package/lib/record/rrweb-record-pack.js +184 -139
- package/lib/record/rrweb-record.js +2467 -2425
- package/lib/replay/rrweb-replay-unpack.css +1 -0
- package/lib/replay/rrweb-replay-unpack.js +3798 -3344
- package/lib/replay/rrweb-replay.css +1 -0
- package/lib/replay/rrweb-replay.js +3743 -3289
- package/lib/rrweb-all.css +1 -0
- package/lib/rrweb-all.js +6721 -6249
- package/lib/rrweb.css +1 -0
- package/lib/rrweb.js +6151 -5632
- package/package.json +14 -13
- package/typings/packer/base.d.ts +1 -1
- package/typings/plugins/console/record/index.d.ts +1 -1
- package/typings/plugins/console/record/stringify.d.ts +1 -1
- package/typings/plugins/sequential-id/record/index.d.ts +1 -1
- package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
- package/typings/record/iframe-manager.d.ts +3 -3
- package/typings/record/index.d.ts +1 -1
- package/typings/record/mutation.d.ts +2 -1
- package/typings/record/observers/canvas/2d.d.ts +2 -1
- package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
- package/typings/record/observers/canvas/canvas.d.ts +1 -1
- package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
- package/typings/record/observers/canvas/webgl.d.ts +2 -1
- package/typings/record/shadow-dom-manager.d.ts +2 -1
- package/typings/record/stylesheet-manager.d.ts +12 -0
- package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
- package/typings/replay/canvas/2d.d.ts +3 -3
- package/typings/replay/canvas/deserialize-args.d.ts +7 -0
- package/typings/replay/canvas/index.d.ts +4 -3
- package/typings/replay/canvas/webgl.d.ts +3 -5
- package/typings/replay/index.d.ts +7 -10
- package/typings/types.d.ts +45 -17
- package/typings/utils.d.ts +17 -44
- package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
- package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
- package/typings/replay/virtual-styles.d.ts +0 -43
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import record from './record/index.js';
|
|
2
2
|
export { default as record } from './record/index.js';
|
|
3
|
-
|
|
3
|
+
import '../../rrweb-snapshot/es/rrweb-snapshot.js';
|
|
4
|
+
import '../../rrdom/es/virtual-dom.js';
|
|
5
|
+
export { EventType, IncrementalSource, MouseInteractions, ReplayerEvents } from './types.js';
|
|
4
6
|
import * as utils from './utils.js';
|
|
5
7
|
export { utils };
|
|
6
8
|
export { _mirror as mirror } from './utils.js';
|
|
7
|
-
|
|
9
|
+
import './../../../ext/base64-arraybuffer/dist/base64-arraybuffer.es5.js';
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
const { addCustomEvent } = record;
|
|
12
|
+
const { freezePage } = record;
|
|
11
13
|
|
|
12
14
|
export { addCustomEvent, freezePage };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { strFromU8, zlibSync, strToU8 } from '../../../../ext/fflate/esm/browser.js';
|
|
1
|
+
import { strFromU8, zlibSync, strToU8 } from './../../../../ext/fflate/esm/browser.js';
|
|
3
2
|
import { MARK } from './base.js';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return strFromU8(zlibSync(strToU8(JSON.stringify(_e))), true);
|
|
4
|
+
const pack = (event) => {
|
|
5
|
+
const _e = Object.assign(Object.assign({}, event), { v: MARK });
|
|
6
|
+
return strFromU8(zlibSync(strToU8(JSON.stringify(_e))), true);
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
export { pack };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { strFromU8, unzlibSync, strToU8 } from '
|
|
1
|
+
import { strFromU8, unzlibSync, strToU8 } from './../../../../ext/fflate/esm/browser.js';
|
|
2
2
|
import { MARK } from './base.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
if (typeof raw !== 'string') {
|
|
6
|
-
return raw;
|
|
7
|
-
}
|
|
8
|
-
try {
|
|
9
|
-
|
|
10
|
-
if (e.timestamp) {
|
|
11
|
-
return e;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
|
|
18
|
-
if (e.v === MARK) {
|
|
19
|
-
return e;
|
|
20
|
-
}
|
|
21
|
-
throw new Error(
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error(error);
|
|
25
|
-
throw new Error('Unknown data format.');
|
|
26
|
-
}
|
|
4
|
+
const unpack = (raw) => {
|
|
5
|
+
if (typeof raw !== 'string') {
|
|
6
|
+
return raw;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const e = JSON.parse(raw);
|
|
10
|
+
if (e.timestamp) {
|
|
11
|
+
return e;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const e = JSON.parse(strFromU8(unzlibSync(strToU8(raw, true))));
|
|
18
|
+
if (e.v === MARK) {
|
|
19
|
+
return e;
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`These events were packed with packer ${e.v} which is incompatible with current packer ${MARK}.`);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error(error);
|
|
25
|
+
throw new Error('Unknown data format.');
|
|
26
|
+
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export { unpack };
|
|
@@ -1,179 +1,178 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
this.fileName = obj.fileName || '';
|
|
4
|
-
this.functionName = obj.functionName || '';
|
|
5
|
-
this.lineNumber = obj.lineNumber;
|
|
6
|
-
this.columnNumber = obj.columnNumber;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (this.functionName) {
|
|
12
|
-
return (this.functionName +
|
|
13
|
-
' (' +
|
|
14
|
-
this.fileName +
|
|
15
|
-
':' +
|
|
16
|
-
lineNumber +
|
|
17
|
-
':' +
|
|
18
|
-
columnNumber +
|
|
19
|
-
')');
|
|
20
|
-
}
|
|
21
|
-
return this.fileName + ':' + lineNumber + ':' + columnNumber;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.replace(/eval
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
.replace(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
1
|
+
class StackFrame {
|
|
2
|
+
constructor(obj) {
|
|
3
|
+
this.fileName = obj.fileName || '';
|
|
4
|
+
this.functionName = obj.functionName || '';
|
|
5
|
+
this.lineNumber = obj.lineNumber;
|
|
6
|
+
this.columnNumber = obj.columnNumber;
|
|
7
|
+
}
|
|
8
|
+
toString() {
|
|
9
|
+
const lineNumber = this.lineNumber || '';
|
|
10
|
+
const columnNumber = this.columnNumber || '';
|
|
11
|
+
if (this.functionName) {
|
|
12
|
+
return (this.functionName +
|
|
13
|
+
' (' +
|
|
14
|
+
this.fileName +
|
|
15
|
+
':' +
|
|
16
|
+
lineNumber +
|
|
17
|
+
':' +
|
|
18
|
+
columnNumber +
|
|
19
|
+
')');
|
|
20
|
+
}
|
|
21
|
+
return this.fileName + ':' + lineNumber + ':' + columnNumber;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
25
|
+
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
26
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
27
|
+
const ErrorStackParser = {
|
|
28
|
+
parse: function (error) {
|
|
29
|
+
if (!error) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
if (typeof error.stacktrace !== 'undefined' ||
|
|
33
|
+
typeof error['opera#sourceloc'] !== 'undefined') {
|
|
34
|
+
return this.parseOpera(error);
|
|
35
|
+
}
|
|
36
|
+
else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
37
|
+
return this.parseV8OrIE(error);
|
|
38
|
+
}
|
|
39
|
+
else if (error.stack) {
|
|
40
|
+
return this.parseFFOrSafari(error);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error('Cannot parse given Error object');
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
extractLocation: function (urlLike) {
|
|
47
|
+
if (urlLike.indexOf(':') === -1) {
|
|
48
|
+
return [urlLike];
|
|
49
|
+
}
|
|
50
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
51
|
+
const parts = regExp.exec(urlLike.replace(/[()]/g, ''));
|
|
52
|
+
if (!parts)
|
|
53
|
+
throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
54
|
+
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
55
|
+
},
|
|
56
|
+
parseV8OrIE: function (error) {
|
|
57
|
+
const filtered = error.stack.split('\n').filter(function (line) {
|
|
58
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
59
|
+
}, this);
|
|
60
|
+
return filtered.map(function (line) {
|
|
61
|
+
if (line.indexOf('(eval ') > -1) {
|
|
62
|
+
line = line
|
|
63
|
+
.replace(/eval code/g, 'eval')
|
|
64
|
+
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
65
|
+
}
|
|
66
|
+
let sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
67
|
+
const location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
68
|
+
sanitizedLine = location
|
|
69
|
+
? sanitizedLine.replace(location[0], '')
|
|
70
|
+
: sanitizedLine;
|
|
71
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
72
|
+
const locationParts = this.extractLocation(location ? location[1] : tokens.pop());
|
|
73
|
+
const functionName = tokens.join(' ') || undefined;
|
|
74
|
+
const fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1
|
|
75
|
+
? undefined
|
|
76
|
+
: locationParts[0];
|
|
77
|
+
return new StackFrame({
|
|
78
|
+
functionName,
|
|
79
|
+
fileName,
|
|
80
|
+
lineNumber: locationParts[1],
|
|
81
|
+
columnNumber: locationParts[2],
|
|
82
|
+
});
|
|
83
|
+
}, this);
|
|
84
|
+
},
|
|
85
|
+
parseFFOrSafari: function (error) {
|
|
86
|
+
const filtered = error.stack.split('\n').filter(function (line) {
|
|
87
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
88
|
+
}, this);
|
|
89
|
+
return filtered.map(function (line) {
|
|
90
|
+
if (line.indexOf(' > eval') > -1) {
|
|
91
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
92
|
+
}
|
|
93
|
+
if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
|
|
94
|
+
return new StackFrame({
|
|
95
|
+
functionName: line,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
100
|
+
const matches = line.match(functionNameRegex);
|
|
101
|
+
const functionName = matches && matches[1] ? matches[1] : undefined;
|
|
102
|
+
const locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
|
|
103
|
+
return new StackFrame({
|
|
104
|
+
functionName,
|
|
105
|
+
fileName: locationParts[0],
|
|
106
|
+
lineNumber: locationParts[1],
|
|
107
|
+
columnNumber: locationParts[2],
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, this);
|
|
111
|
+
},
|
|
112
|
+
parseOpera: function (e) {
|
|
113
|
+
if (!e.stacktrace ||
|
|
114
|
+
(e.message.indexOf('\n') > -1 &&
|
|
115
|
+
e.message.split('\n').length > e.stacktrace.split('\n').length)) {
|
|
116
|
+
return this.parseOpera9(e);
|
|
117
|
+
}
|
|
118
|
+
else if (!e.stack) {
|
|
119
|
+
return this.parseOpera10(e);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return this.parseOpera11(e);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
parseOpera9: function (e) {
|
|
126
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
127
|
+
const lines = e.message.split('\n');
|
|
128
|
+
const result = [];
|
|
129
|
+
for (let i = 2, len = lines.length; i < len; i += 2) {
|
|
130
|
+
const match = lineRE.exec(lines[i]);
|
|
131
|
+
if (match) {
|
|
132
|
+
result.push(new StackFrame({
|
|
133
|
+
fileName: match[2],
|
|
134
|
+
lineNumber: parseFloat(match[1]),
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
},
|
|
140
|
+
parseOpera10: function (e) {
|
|
141
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
142
|
+
const lines = e.stacktrace.split('\n');
|
|
143
|
+
const result = [];
|
|
144
|
+
for (let i = 0, len = lines.length; i < len; i += 2) {
|
|
145
|
+
const match = lineRE.exec(lines[i]);
|
|
146
|
+
if (match) {
|
|
147
|
+
result.push(new StackFrame({
|
|
148
|
+
functionName: match[3] || undefined,
|
|
149
|
+
fileName: match[2],
|
|
150
|
+
lineNumber: parseFloat(match[1]),
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
},
|
|
156
|
+
parseOpera11: function (error) {
|
|
157
|
+
const filtered = error.stack.split('\n').filter(function (line) {
|
|
158
|
+
return (!!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
|
|
159
|
+
!line.match(/^Error created at/));
|
|
160
|
+
}, this);
|
|
161
|
+
return filtered.map(function (line) {
|
|
162
|
+
const tokens = line.split('@');
|
|
163
|
+
const locationParts = this.extractLocation(tokens.pop());
|
|
164
|
+
const functionCall = tokens.shift() || '';
|
|
165
|
+
const functionName = functionCall
|
|
166
|
+
.replace(/<anonymous function(: (\w+))?>/, '$2')
|
|
167
|
+
.replace(/\([^)]*\)/g, '') || undefined;
|
|
168
|
+
return new StackFrame({
|
|
169
|
+
functionName,
|
|
170
|
+
fileName: locationParts[0],
|
|
171
|
+
lineNumber: locationParts[1],
|
|
172
|
+
columnNumber: locationParts[2],
|
|
173
|
+
});
|
|
174
|
+
}, this);
|
|
175
|
+
},
|
|
177
176
|
};
|
|
178
177
|
|
|
179
178
|
export { ErrorStackParser, StackFrame };
|