Fix contentscript injection failure on Firefox 56 (#10034)
On Firefox 56 and Waterfox Classic, our `runLockdown.js` script throws an error. This is fine on the HTML pages, as the next script tags still get run without issue (though they don't benefit from the SES lockdown sadly). But in the `contentscript`, an exception thrown here appears to halt the execution of subsequent scripts. To prevent the `contentscript` from crashing completely, lockdown errors are now caught and logged. They are also logged to Sentry on the pages where Sentry is setup.feature/default_network_editable
parent
98d6f71754
commit
7879481569
@ -1,8 +1,19 @@ |
|||||||
// Freezes all intrinsics
|
// Freezes all intrinsics
|
||||||
// eslint-disable-next-line no-undef,import/unambiguous
|
try { |
||||||
lockdown({ |
// eslint-disable-next-line no-undef,import/unambiguous
|
||||||
consoleTaming: 'unsafe', |
lockdown({ |
||||||
errorTaming: 'unsafe', |
consoleTaming: 'unsafe', |
||||||
mathTaming: 'unsafe', |
errorTaming: 'unsafe', |
||||||
dateTaming: '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) |
||||||
|
} |
||||||
|
} |
||||||
|
Loading…
Reference in new issue