Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reset streams on prerender only for affected browser versions #24317

Merged
merged 12 commits into from
May 1, 2024

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented Apr 30, 2024

Description

The prerender regression in chromium has been resolved already. Resetting streams on prerendered pages no longer required for newer chromium versions and is actually the cause of unresponsive provider in many cases. This PR modifies the existing workaround to target only the affected chromium ranges from >=113 to <121.

My bisection of chromium for the fix landed on this range of commits: https://chromium.googlesource.com/chromium/src/+log/55b4344edfb41dda980d197743f25a2841d498a4..c13107c16780c195bd5ec003d9198d87cdcc59dd

@shanejonas and I have verified that the prerender issue has been resolved in the latest chrome stable. I have verified that the workaround is causing an issue in develop that is no longer seen in this branch that reverts it.

Open in GitHub Codespaces

Related issues

See: #19727

Manual testing steps

Using chrome, of course.
Visit chrome://settings/?search=preload and ensure it is enabled and on "standard"

  1. On develop, make a build and load it
  2. Visit https://voyager-snap.linea.build/
  3. Install the snap and connect
  4. Copy https://voyager-snap.linea.build/ to your clipboard
  5. Close all instances of https://voyager-snap.linea.build/ that may be open
  6. Rapidly, open a new tab, paste the url, hit enter, see if the page is stuck on "Loading", if not close the tab and repeat
  7. Eventually the page should be get prerendered and stuck in a broken state

Do the same steps above, but using the changes in this branch. The page should never be stuck with "Loading" if you are on a chromium version from 102 to 112, or 121 onwards.

Screenshots/Recordings

Before

Screen.Recording.2024-04-29.at.11.34.02.AM.mov

After

Screen.Recording.2024-04-29.at.11.32.27.AM.mov

Browser version targeting proof

The following screenshots show the return value for getIsBrowserPrerenderBroken() on various chromium versions

120:

Screenshot 2024-04-30 at 12 47 57 PM

119:

Screenshot 2024-04-30 at 12 50 57 PM

113:
Screenshot 2024-04-30 at 11 22 20 AM

112:
Screenshot 2024-04-30 at 11 20 43 AM

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@jiexi jiexi marked this pull request as ready for review April 30, 2024 19:56
@jiexi jiexi requested a review from a team as a code owner April 30, 2024 19:56
@jiexi jiexi mentioned this pull request Apr 30, 2024
7 tasks
@metamaskbot
Copy link
Collaborator

Builds ready [7f7b46b]
Page Load Metrics (547 ± 472 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint5610474147
domContentLoaded8281142
load462722547983472
domInteractive8281142
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 687 Bytes (0.01%)

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.32%. Comparing base (2c45770) to head (08279ef).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #24317      +/-   ##
===========================================
+ Coverage    67.31%   67.32%   +0.01%     
===========================================
  Files         1276     1276              
  Lines        49731    49739       +8     
  Branches     12921    12925       +4     
===========================================
+ Hits         33474    33482       +8     
  Misses       16257    16257              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -23,3 +23,24 @@ export const OUTDATED_BROWSER_VERSIONS = {
// See https://en.wikipedia.org/wiki/History_of_the_Opera_web_browser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we could treat Opera 99-(107?) as affected as well, but maybe not worth worrying about given the impact of the bug. We can adjust this later if we need to. Who knows what they're changing in their fork.

Gudahtt
Gudahtt previously approved these changes May 1, 2024
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

adonesky1
adonesky1 previously approved these changes May 1, 2024
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for so much great digging here @jiexi!

@jiexi jiexi dismissed stale reviews from adonesky1 and Gudahtt via f06c1ed May 1, 2024 16:30
Gudahtt
Gudahtt previously approved these changes May 1, 2024
@jiexi jiexi requested a review from adonesky1 May 1, 2024 17:10
@jiexi jiexi merged commit f2ec444 into develop May 1, 2024
70 of 71 checks passed
@jiexi jiexi deleted the jl/reset-streams-on-prerender-affected-chrome-versions branch May 1, 2024 17:57
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [08279ef]
Page Load Metrics (508 ± 537 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint56149792813
domContentLoaded8491294
load4541425081118537
domInteractive8491294
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 687 Bytes (0.01%)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants