Skip to content

Commit 6278810

Browse files
committed
Merge pull request #382 from getsentry/gh-377
Handle other cases of unintialized RegExp objects
2 parents eafbc1b + 356ee71 commit 6278810

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/raven.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ function extractContextFromFrame(frame) {
603603
function processException(type, message, fileurl, lineno, frames, options) {
604604
var stacktrace, i, fullMessage;
605605

606-
if (globalOptions.ignoreErrors.test(message)) return;
606+
if (!!globalOptions.ignoreErrors.test && globalOptions.ignoreErrors.test(message)) return;
607607

608608
message += '';
609609
message = truncate(message, globalOptions.maxMessageLength);
@@ -627,8 +627,8 @@ function processException(type, message, fileurl, lineno, frames, options) {
627627
};
628628
}
629629

630-
if (globalOptions.ignoreUrls && globalOptions.ignoreUrls.test(fileurl)) return;
631-
if (globalOptions.whitelistUrls && !globalOptions.whitelistUrls.test(fileurl)) return;
630+
if (!!globalOptions.ignoreUrls.test && globalOptions.ignoreUrls.test(fileurl)) return;
631+
if (!!globalOptions.whitelistUrls.test && !globalOptions.whitelistUrls.test(fileurl)) return;
632632

633633
// Fire away!
634634
send(

test/raven.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,14 @@ describe('globals', function() {
691691
assert.isTrue(window.send.calledOnce);
692692
});
693693

694+
it('should handle empty `ignoreErrors`', function() {
695+
this.sinon.stub(window, 'send');
696+
697+
globalOptions.ignoreErrors = [];
698+
processException('Error', 'e1', 'http://example.com', []);
699+
assert.isTrue(window.send.calledOnce);
700+
});
701+
694702
it('should respect `ignoreUrls`', function() {
695703
this.sinon.stub(window, 'send');
696704

@@ -703,6 +711,14 @@ describe('globals', function() {
703711
assert.isTrue(window.send.calledOnce);
704712
});
705713

714+
it('should handle empty `ignoreUrls`', function() {
715+
this.sinon.stub(window, 'send');
716+
717+
globalOptions.ignoreUrls = [];
718+
processException('Error', 'e1', 'http://example.com', []);
719+
assert.isTrue(window.send.calledOnce);
720+
});
721+
706722
it('should respect `whitelistUrls`', function() {
707723
this.sinon.stub(window, 'send');
708724

@@ -715,6 +731,14 @@ describe('globals', function() {
715731
assert.equal(window.send.callCount, 2);
716732
});
717733

734+
it('should handle empty `whitelistUrls`', function() {
735+
this.sinon.stub(window, 'send');
736+
737+
globalOptions.whitelistUrls = [];
738+
processException('Error', 'e1', 'http://example.com', []);
739+
assert.isTrue(window.send.calledOnce);
740+
});
741+
718742
it('should send a proper payload with frames', function() {
719743
this.sinon.stub(window, 'send');
720744

0 commit comments

Comments
 (0)