Skip to content

Commit 1e5c561

Browse files
committed
Update raven.js to work around IE8 shortcomings
Internet Explorer 8 chokes on an undefined or null reference passed into this function. Wrapping an if statement around the processing correctly handles this while still performing correctly.
1 parent cdc4339 commit 1e5c561

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/raven.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,14 @@ function joinRegExp(patterns) {
644644
// Be mad.
645645
var sources = [], i = patterns.length;
646646
while (i--) {
647-
sources[i] = isString(patterns[i]) ?
648-
// If it's a string, we need to escape it
649-
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
650-
patterns[i].replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") :
651-
// If it's a regexp already, we want to extract the source
652-
patterns[i].source;
647+
if (typeof patterns[i] != "undefined" && patterns[i]) {
648+
sources[i] = isString(patterns[i]) ?
649+
// If it's a string, we need to escape it
650+
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
651+
patterns[i].replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") :
652+
// If it's a regexp already, we want to extract the source
653+
patterns[i].source;
654+
}
653655
}
654656
return new RegExp(sources.join('|'), 'i');
655657
}

0 commit comments

Comments
 (0)