-
Notifications
You must be signed in to change notification settings - Fork 5k
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
chore: Refactor offscreen creation logic #25302
Conversation
cc677f2
to
1cf397e
Compare
Builds ready [219ff99]
Page Load Metrics (173 ± 247 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #25302 +/- ##
===========================================
- Coverage 65.42% 65.41% -0.01%
===========================================
Files 1381 1381
Lines 54695 54711 +16
Branches 14340 14351 +11
===========================================
+ Hits 35779 35786 +7
- Misses 18916 18925 +9 ☔ View full report in Codecov by Sentry. |
dd14d6f
219ff99
to
dd14d6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Builds ready [bf601f7]
Page Load Metrics (51 ± 3 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Missing release label release-12.0.0 on PR. Adding release label release-12.0.0 on PR and removing other release labels(release-12.1.0), as PR was cherry-picked in branch 12.0.0. |
Description
Refactor initialization logic to defer creation of the offscreen document until the
MetaMaskController
is initialized. This adds aoffscreenPromise
to the controller that can be awaited for functionality that requires the offscreen document to be created.Additionally this PR adds a message that the offscreen document will send once initial execution of the offscreen page has finished. This is awaited in the
offscreenPromise
.We await
offscreenPromise
before unlocking the keyrings as some keyrings rely on the offscreen document to process requests, e.g. hardware wallets.There may be room for more improvements here though, that I have not tackled in this PR. As the hardware wallet logic doesn't seem to wait for iframes to fully load, so there is a chance of some missed messages.
I have tested that hardware wallet support, at least for Ledger, is still working following the changes in this PR.