Skip to content

Commit 377bc03

Browse files
committed
Make sure includePaths.test is a function before using
Fixes #377
1 parent f451838 commit 377bc03

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/raven.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ function normalizeFrame(frame) {
563563

564564
normalized.in_app = !( // determine if an exception came from outside of our app
565565
// first we check the global includePaths list.
566-
!globalOptions.includePaths.test(normalized.filename) ||
566+
(!!globalOptions.includePaths.test && !globalOptions.includePaths.test(normalized.filename)) ||
567567
// Now we check for fun, if the function name is Raven or TraceKit
568568
/(Raven|TraceKit)\./.test(normalized['function']) ||
569569
// finally, we do a last ditch effort and check for raven.min.js

test/raven.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,19 @@ describe('globals', function() {
596596
in_app: false
597597
});
598598
});
599+
600+
it('should not blow up if includePaths is empty, regression for #377', function() {
601+
this.sinon.stub(window, 'extractContextFromFrame').returns(undefined);
602+
var frame = {
603+
url: 'http://lol.com/path/file.js',
604+
line: 10,
605+
column: 11,
606+
func: 'TraceKit.lol'
607+
// context: [] context is stubbed
608+
};
609+
globalOptions.includePaths = [];
610+
normalizeFrame(frame);
611+
});
599612
});
600613

601614
describe('extractContextFromFrame', function() {

0 commit comments

Comments
 (0)