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

Do we need to check chrome.runtime.lastError when popup opens #1934

Closed
lukaw3d opened this issue May 14, 2024 · 3 comments
Closed

Do we need to check chrome.runtime.lastError when popup opens #1934

lukaw3d opened this issue May 14, 2024 · 3 comments
Assignees

Comments

@lukaw3d
Copy link
Member

lukaw3d commented May 14, 2024

If background page crashes, and user opens the popup, would it just show default redux state?

@buberdds buberdds self-assigned this May 21, 2024
@lukaw3d
Copy link
Member Author

lukaw3d commented May 30, 2024

from @buberdds:

It looks like we don't need it in new extension for now. lastError is used when extension use callback based extension API. Old extension is using checkForError only for windowType === 'dapp' which is not a case now (interaction with dapps via runtime.onMessage.addListener?)

@lukaw3d
Copy link
Member Author

lukaw3d commented May 30, 2024

So lastError wouldn't be set if background page crashed with Cannot read properties of undefined in normal code. And I didn't find another flag that would get set. Luckily we don't have asynchronous code in the background page that can fail, other than sagas that are handled by fatalError. And if synchronous code before wrapStore fails then popup doesn't initialize.

(And webext-redux and webextension-polyfill do check lastError after sendMessage
https://github.com/tshaddix/webext-redux/blob/95ff156b4afe9bfa697e55bfdb32ec116706aba3/src/store/Store.js#L161
https://github.com/tshaddix/webext-redux/blob/95ff156b4afe9bfa697e55bfdb32ec116706aba3/src/wrap-store/wrapStore.js#L169
https://github.com/mozilla/webextension-polyfill/blob/1649d84ad93c6ebb7225a3db44e96c33e6bbb4a7/src/browser-polyfill.js#L100 )

@lukaw3d lukaw3d closed this as completed May 30, 2024
@lukaw3d lukaw3d reopened this May 30, 2024
@lukaw3d lukaw3d closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
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

No branches or pull requests

2 participants