Skip to content

Commit deba38e

Browse files
committed
Initial work on fixing eval frame regexes
1 parent f162c9e commit deba38e

File tree

5 files changed

+40
-6
lines changed

5 files changed

+40
-6
lines changed

dist/sri.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"@dist/raven.js": {
33
"hashes": {
4-
"sha256": "DqjGfkHlXEUoWD0W2CirZy+/TcbA2bWYVZGM4GICEwc=",
5-
"sha512": "pEOdKiz/v/gFCOIrBNn9R/Cg/z2a+oGEnwqs5h//UGAQ3ODQxdKfKvVotG+hw0z+R57+g07af2l9oOqcjcu53g=="
4+
"sha256": "E/wI8NelG3dYEnnxU9HEJe4ewfiL/X6gLVSZD3P9oL0=",
5+
"sha512": "eUbBW3tVAkKIgYBOIf0voVKCq1kiBXb9aJtffsaeXTZEjbWxcxdcu95zz2jXqXJ3XIwcUnf1nggJLzyhQ08Y5Q=="
66
},
77
"type": null,
8-
"integrity": "sha256-DqjGfkHlXEUoWD0W2CirZy+/TcbA2bWYVZGM4GICEwc= sha512-pEOdKiz/v/gFCOIrBNn9R/Cg/z2a+oGEnwqs5h//UGAQ3ODQxdKfKvVotG+hw0z+R57+g07af2l9oOqcjcu53g==",
8+
"integrity": "sha256-E/wI8NelG3dYEnnxU9HEJe4ewfiL/X6gLVSZD3P9oL0= sha512-eUbBW3tVAkKIgYBOIf0voVKCq1kiBXb9aJtffsaeXTZEjbWxcxdcu95zz2jXqXJ3XIwcUnf1nggJLzyhQ08Y5Q==",
99
"path": "dist/raven.js"
1010
},
1111
"@dist/raven.min.js": {
1212
"hashes": {
13-
"sha256": "rQKHhUx4JZkHPhu3S2kaqiCLZEOuVBP9W6K6LZMeSPI=",
14-
"sha512": "xnf3jkR3/5vLX/GSvRlZnJJMfzP4I1oFMyINzQGq9+2esFgSywjARxwYG/ypRnCxJyNhBH3jxdNBHN0UEy/30w=="
13+
"sha256": "j2LqEVKhSw6GsWF+xY3ePCxUsR7gagPL0zc/5R1TDxs=",
14+
"sha512": "SGdvwIbE9KIsEWyE5BRG48mAxqPweyIjE+/nz7bOTAMlkBf2ZNi6C5T0VyLBiIolN7QkfSPCyy9z//mcEQJeAg=="
1515
},
1616
"type": null,
17-
"integrity": "sha256-rQKHhUx4JZkHPhu3S2kaqiCLZEOuVBP9W6K6LZMeSPI= sha512-xnf3jkR3/5vLX/GSvRlZnJJMfzP4I1oFMyINzQGq9+2esFgSywjARxwYG/ypRnCxJyNhBH3jxdNBHN0UEy/30w==",
17+
"integrity": "sha256-j2LqEVKhSw6GsWF+xY3ePCxUsR7gagPL0zc/5R1TDxs= sha512-SGdvwIbE9KIsEWyE5BRG48mAxqPweyIjE+/nz7bOTAMlkBf2ZNi6C5T0VyLBiIolN7QkfSPCyy9z//mcEQJeAg==",
1818
"path": "dist/raven.min.js"
1919
}
2020
}

example/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<button onclick="divide(1, 0)">Sourcemap breakage</button>
3434
<button onclick="derp()">window.onerror</button>
3535
<button onclick="testOptions()">test options</button>
36+
<button onclick="throwEval()">throw eval</button>
3637
<button onclick="testSynthetic()">test synthetic</button>
3738
<button onclick="throwString()">throw string</button>
3839
<button onclick="showDialog()">show dialog</button>

example/scratch.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ function throwString() {
4141
throw 'oops';
4242
}
4343

44+
function throwEval() {
45+
eval('derp();');
46+
}
47+
4448
function showDialog() {
4549
broken();
4650
Raven.showReportDialog();

test/vendor/fixtures/captured-errors.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ CapturedExceptions.CHROME_48_BLOB = {
333333
" at n.handle (blob:http%3A//localhost%3A8080/abfc40e9-4742-44ed-9dcd-af8f99a29379:7:2863)"
334334
};
335335

336+
CapturedExceptions.CHROME_56_EVAL = {
337+
message: 'fdas is not defined',
338+
name: 'ReferenceError',
339+
stack: 'ReferenceError: fdas is not defined\n' +
340+
' at derp (http://localhost:8080/example/scratch.js:31:5)\n' +
341+
' at eval (eval at throwEval (http://localhost:8080/example/scratch.js:45:5), <anonymous>:1:1)\n' +
342+
' at throwEval (http://localhost:8080/example/scratch.js:45:5)\n' +
343+
' at HTMLButtonElement.onclick (http://localhost:8080/example/:36:31)'
344+
};
345+
336346
CapturedExceptions.PHANTOMJS_1_19 = {
337347
stack: "Error: foo\n" +
338348
" at file:///path/to/file.js:878\n" +
@@ -351,6 +361,17 @@ CapturedExceptions.FIREFOX_50_RESOURCE_URL = {
351361
name: 'TypeError'
352362
};
353363

364+
CapturedExceptions.FIREFOX_51_EVAL = {
365+
stack: '@http://localhost:8080/example/scratch.js line 45 > eval:1:1\n' +
366+
'throwEval@http://localhost:8080/example/scratch.js:45:5\n' +
367+
'onclick@http://localhost:8080/example/:1:1\n',
368+
fileName: 'http://localhost:8080/example/scratch.js line 45 > eval', // this is the .fileName property
369+
lineNumber: 1,
370+
columnNumber: 1,
371+
message: 'lol is not defined',
372+
name: 'ReferenceError'
373+
}
374+
354375
CapturedExceptions.ANDROID_REACT_NATIVE = {
355376
message: 'Error: test',
356377
name: 'Error',

test/vendor/tracekit-parser.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ describe('TraceKit', function () {
216216
assert.deepEqual(stackFrames.stack.length, 3);
217217
assert.deepEqual(stackFrames.stack[0], { url: 'resource://path/data/content/bundle.js', func: 'render', args: [], line: 5529, column: 16 });
218218
});
219+
220+
it('should parse Firefox errors with eval URLs', function () {
221+
var stackFrames = TraceKit.computeStackTrace(CapturedExceptions.FIREFOX_51_EVAL);
222+
assert.ok(stackFrames);
223+
assert.deepEqual(stackFrames.stack.length, 3);
224+
assert.deepEqual(stackFrames.stack[0], { url: 'http://localhost:8080/example/scratch.js', func: '?', args: [], line: 45, column: null });
225+
});
226+
219227
it('should parse React Native errors on Android', function () {
220228
var stackFrames = TraceKit.computeStackTrace(CapturedExceptions.ANDROID_REACT_NATIVE);
221229
assert.ok(stackFrames);

0 commit comments

Comments
 (0)