diff --git a/.eslintrc.js b/.eslintrc.js index 184f6ce89..445ee523c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -195,6 +195,7 @@ module.exports = { 'babel.config.js', 'nyc.config.js', 'stylelint.config.js', + 'app/scripts/runLockdown.js', 'development/**/*.js', 'test/e2e/**/*.js', 'test/lib/wait-until-called.js', diff --git a/app/scripts/runLockdown.js b/app/scripts/runLockdown.js index d8584c69c..210005967 100644 --- a/app/scripts/runLockdown.js +++ b/app/scripts/runLockdown.js @@ -1,8 +1,19 @@ // Freezes all intrinsics -// eslint-disable-next-line no-undef,import/unambiguous -lockdown({ - consoleTaming: 'unsafe', - errorTaming: 'unsafe', - mathTaming: 'unsafe', - dateTaming: 'unsafe', -}) +try { + // eslint-disable-next-line no-undef,import/unambiguous + lockdown({ + consoleTaming: 'unsafe', + errorTaming: 'unsafe', + mathTaming: 'unsafe', + dateTaming: 'unsafe', + }) +} catch (error) { + // If the `lockdown` call throws an exception, it interferes with the + // contentscript injection on some versions of Firefox. The error is + // caught and logged here so that the contentscript still gets injected. + // This affects Firefox v56 and Waterfox Classic + console.error('Lockdown failed:', error) + if (window.sentry && window.sentry.captureException) { + window.sentry.captureException(error) + } +}