Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Handle error when offscreen document already exists (#25138)
<!-- 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** A `try..catch` block has been added to catch errors about the Offscreen document already existing. This circumstance is not a bug, it's expected to happen sometimes due to race conditions between `hasDocument` and the creation step. The code in question is just meant to create the document if it doesn't exist, so it's OK if we get this error. The `hasDocument` call has been removed as well, since it's now redundant. This function wasn't safe to call anyway; it's an undocumented private function. See here for more information: * https://stackoverflow.com/a/7725839 * https://groups.google.com/a/chromium.org/g/chromium-extensions/c/D5Jg2ukyvUc4 [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25138?quickstart=1) ## **Related issues** Fixes #25118 ## **Manual testing steps** I do not know how to test this unfortunately. ## **Screenshots/Recordings** N/A ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension 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 - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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.
- Loading branch information