-
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
[Bug]: MV3 - Forcing Service Worker to stop throws error and MM stays loading app-init.js:1 Dropped attempt to register inpage content script. Error: Duplicate script ID 'inpage'
#24514
Comments
I've encountered this issue x2 more times, this case I haven't stopped the service worker manually. Just trying to open the MM popup and it stayed loading forever.The only way to recover is by clicking reload the app. With this new finding, I'm bumping this to a sev-2 and possibly we need to re-evaluate if it's an MV3 blocker loading-indef.mp4 |
I'm looking at this now. It is definitely a blocker |
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes #24514. The problem was that if the service worker is terminated, when app-init.js runs again when the service worker is to be restarted, `importAllScripts()` is not called. The solution is just to make sure it is called in the top-level scope, on every run of the script. This should be safe to do because of the `scriptsLoadInitiated` check already in the `importAllScripts` function. The PR also uses the `serviceworker.state` property to ensure that we don't attempt to import scripts before installation. (That is explained further in the code comment added in this PR) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24612?quickstart=1) ## **Related issues** Fixes: #24514 ## **Manual testing steps** 1. Start MM MV3 build 2. Go to chrome://serviceworker-internals/?devtools 3. Stop Service Worker manually with the button 4. You should be able to open MetaMask ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes #24514. The problem was that if the service worker is terminated, when app-init.js runs again when the service worker is to be restarted, `importAllScripts()` is not called. The solution is just to make sure it is called in the top-level scope, on every run of the script. This should be safe to do because of the `scriptsLoadInitiated` check already in the `importAllScripts` function. The PR also uses the `serviceworker.state` property to ensure that we don't attempt to import scripts before installation. (That is explained further in the code comment added in this PR) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24612?quickstart=1) ## **Related issues** Fixes: #24514 ## **Manual testing steps** 1. Start MM MV3 build 2. Go to chrome://serviceworker-internals/?devtools 3. Stop Service Worker manually with the button 4. You should be able to open MetaMask ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes #24514. The problem was that if the service worker is terminated, when app-init.js runs again when the service worker is to be restarted, `importAllScripts()` is not called. The solution is just to make sure it is called in the top-level scope, on every run of the script. This should be safe to do because of the `scriptsLoadInitiated` check already in the `importAllScripts` function. The PR also uses the `serviceworker.state` property to ensure that we don't attempt to import scripts before installation. (That is explained further in the code comment added in this PR) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24612?quickstart=1) ## **Related issues** Fixes: #24514 ## **Manual testing steps** 1. Start MM MV3 build 2. Go to chrome://serviceworker-internals/?devtools 3. Stop Service Worker manually with the button 4. You should be able to open MetaMask ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes #24514. The problem was that if the service worker is terminated, when app-init.js runs again when the service worker is to be restarted, `importAllScripts()` is not called. The solution is just to make sure it is called in the top-level scope, on every run of the script. This should be safe to do because of the `scriptsLoadInitiated` check already in the `importAllScripts` function. The PR also uses the `serviceworker.state` property to ensure that we don't attempt to import scripts before installation. (That is explained further in the code comment added in this PR) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24612?quickstart=1) ## **Related issues** Fixes: #24514 ## **Manual testing steps** 1. Start MM MV3 build 2. Go to chrome://serviceworker-internals/?devtools 3. Stop Service Worker manually with the button 4. You should be able to open MetaMask ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes #24514. The problem was that if the service worker is terminated, when app-init.js runs again when the service worker is to be restarted, `importAllScripts()` is not called. The solution is just to make sure it is called in the top-level scope, on every run of the script. This should be safe to do because of the `scriptsLoadInitiated` check already in the `importAllScripts` function. The PR also uses the `serviceworker.state` property to ensure that we don't attempt to import scripts before installation. (That is explained further in the code comment added in this PR) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24612?quickstart=1) ## **Related issues** Fixes: #24514 ## **Manual testing steps** 1. Start MM MV3 build 2. Go to chrome://serviceworker-internals/?devtools 3. Stop Service Worker manually with the button 4. You should be able to open MetaMask ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes #24514. The problem was that if the service worker is terminated, when app-init.js runs again when the service worker is to be restarted, `importAllScripts()` is not called. The solution is just to make sure it is called in the top-level scope, on every run of the script. This should be safe to do because of the `scriptsLoadInitiated` check already in the `importAllScripts` function. The PR also uses the `serviceworker.state` property to ensure that we don't attempt to import scripts before installation. (That is explained further in the code comment added in this PR) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24612?quickstart=1) ## **Related issues** Fixes: #24514 ## **Manual testing steps** 1. Start MM MV3 build 2. Go to chrome://serviceworker-internals/?devtools 3. Stop Service Worker manually with the button 4. You should be able to open MetaMask ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] 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](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
Missing release label release-11.16.6 on issue. Adding release label release-11.16.6 on issue, as issue is linked to PR #24612 which has this release label. |
Describe the bug
[Edit] This behaviour has been identified also in cases where I didn't stop the service worker manually (see below comment).
Whenever I force the service worker to stop manually, I see the error
app-init.js:1 Dropped attempt to register inpage content script. Error: Duplicate script ID 'inpage'
and when I try to perform any action/refresh MM, I see that the wallet stays loading indefinitely.To fix it, you need to click the Reload MM button.
Adding a Sev3 label, since I'm not sure in which situation this would happen, aside from manually stopping it.
Expected behavior
No response
Screenshots/Recordings
stop-sw-duplicate-script-id.mp4
Steps to reproduce
Error messages or log output
No response
Version
develop MV3 build
Build type
None
Browser
Chrome
Operating system
Linux
Hardware wallet
No response
Additional context
No response
Severity
No response
The text was updated successfully, but these errors were encountered: