Skip to content

Commit

Permalink
Merge pull request #605 from bugsnag/try-catch-handle-event
Browse files Browse the repository at this point in the history
fix(plugin-inline-script-content): Swallow errors from selenium
  • Loading branch information
bengourley committed Aug 12, 2019
2 parents b08c936 + 4784bc1 commit 911451e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ module.exports = {
// this is required for removeEventListener to remove anything added with
// addEventListener before the functions started being wrapped by Bugsnag
const args = Array.prototype.slice.call(arguments)
const cba = callbackAccessor(args)
const cb = cba.get()
if (alsoCallOriginal) fn.apply(this, args)
if (typeof cb !== 'function') return fn.apply(this, args)
try {
const cba = callbackAccessor(args)
const cb = cba.get()
if (alsoCallOriginal) fn.apply(this, args)
if (typeof cb !== 'function') return fn.apply(this, args)
if (cb.__trace__) {
cba.replace(cb.__trace__)
} else {
Expand All @@ -145,6 +145,7 @@ module.exports = {
} catch (e) {
// swallow these errors on Selenium:
// Permission denied to access property '__trace__'
// WebDriverException: Message: Permission denied to access property "handleEvent"
}
// IE8 doesn't let you call .apply() on setTimeout/setInterval
if (fn.apply) return fn.apply(this, args)
Expand Down

0 comments on commit 911451e

Please sign in to comment.