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 #20930 - Prevent Firefox start failure by awaiting startUISync event #20992

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3212,7 +3212,7 @@ export default class MetamaskController extends EventEmitter {
}

_startUISync() {
// Message startUISync is used in MV3 to start syncing state with UI
// Message startUISync is used to start syncing state with UI
// Sending this message after login is completed helps to ensure that incomplete state without
// account details are not flushed to UI.
this.emit('startUISync');
Expand Down
8 changes: 7 additions & 1 deletion app/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ async function start() {
extensionPort.onMessage.addListener(messageListener);
extensionPort.onDisconnect.addListener(resetExtensionStreamAndListeners);
} else {
initializeUiWithTab(activeTab);
const messageListener = async (message) => {
if (message?.data?.method === 'startUISync') {
initializeUiWithTab(activeTab);
extensionPort.onMessage.removeListener(messageListener);
}
};
extensionPort.onMessage.addListener(messageListener);
}

function initializeUiWithTab(tab) {
Expand Down