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: init uses a timeout and other methods reattempt init #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikesposito
Copy link
Member

The LedgerBridgeIframe class gets initialized through the init method. However, if the iframe that is set up during this method call fails for some reason, the promise returned by init will never resolve/reject.

Downstream, this prevents the KeyringController mutex from being ever released, causing deadlocks at unlock time.

The solution applied in this PR is to make the iframe set up during the init call optional, and then later reattempting it whenever another method needs the iframe and finds it uninitialized

@mikesposito mikesposito requested a review from a team as a code owner January 17, 2025 17:59
Comment on lines +322 to +328
this.iframe.onerror = (): void => {
if (this.iframe) {
document.head.removeChild(this.iframe);
}
this.iframeLoaded = false;
reject(new Error('Failed to load iframe'));
};
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure that this is actually needed, since the timeout would kick in anyway, but seemed useful

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

Successfully merging this pull request may close these issues.

1 participant