You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## **Description**
Refactor initialization logic to defer creation of the offscreen
document until the `MetaMaskController` is initialized. This adds a
`offscreenPromise` 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.
[](https://codespaces.new/MetaMask/metamask-extension/pull/25302?quickstart=1)
0 commit comments