Use late-bound noop function when disabling console#10110
Merged
Conversation
The `disable-console` script introduced in #10040 used an arrow- function no-op function to replace `console.log` and `console.info`. This replacement function was early-bound to the `this` context of the `disable-console` script, because that's how arrow functions work. This violates an assumption baked into Sentry, which also replaces the `console` functions. It wraps them in a function it uses to track console logs as breadcrumbs. This wrapper function blows up for some reason if the "original" `console` function is early-bound to a `this` value of `undefined`. This resulted in various UI freezes. One example is during onboarding, when using Firefox with Enhanced Tracking Protection set in "strict" mode. After submitting a password in the 'Create wallet' flow, the Sentry `console` wrapper would throw and leave the user stuck on the loading screen. By replacing the no-op arrow function with a no-op function declaration, the problem has been resolved. Relates to #10097
392c8f4 to
0e676b3
Compare
Collaborator
Builds ready [0e676b3]
Page Load Metrics (508 ± 44 ms)
|
brad-decker
approved these changes
Dec 19, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
disable-consolescript introduced in #10040 used an arrow-function no-op function to replaceconsole.logandconsole.info. This replacement function was early-bound to thethiscontext of thedisable-consolescript, because that's how arrow functions work.This violates an assumption baked into Sentry, which also replaces the
consolefunctions. It wraps them in a function it uses to track console logs as breadcrumbs. This wrapper function blows up for some reason if the "original"consolefunction is early-bound to athisvalue ofundefined.This resulted in various UI freezes. One example is during onboarding, when using Firefox with Enhanced Tracking Protection set in "strict" mode. After submitting a password in the 'Create wallet' flow, the Sentry
consolewrapper would throw and leave the user stuck on the loading screen.By replacing the no-op arrow function with a no-op function declaration, the problem has been resolved.
Relates to #10097