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

Error: Extension context invalidated #47

Open
lirtistan opened this issue Jun 14, 2024 · 8 comments
Open

Error: Extension context invalidated #47

lirtistan opened this issue Jun 14, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@lirtistan
Copy link
Contributor

Hi,

content.js throws errors on various sites (for whatever reason), try to reading "options" from storage.

Screenshot from 2024-06-14 08-19-44

@leonvogt
Copy link
Owner

Hi @lirtistan,

Hm I didn't noticed that till now.
Do you have by any chance a way to reproduce this?
I'm happy to look into this, but can't seem to reproduce it on my machine.

@leonvogt leonvogt added the bug Something isn't working label Jun 14, 2024
@lirtistan
Copy link
Contributor Author

lirtistan commented Jun 14, 2024

Looks like the same issue as discussed here https://stackoverflow.com/questions/53939205/how-to-avoid-extension-context-invalidated-errors-when-messaging-after-an-exte

Actually content.js is always active, maybe that should be changed/limited somehow to sites where the detail_panel is really wanted by user interaction.

@leonvogt
Copy link
Owner

Actually content.js is always active, maybe that should be changed/limited somehow to sites where the detail_panel is really wanted by user interaction.

The content.js does more than rendering the detail panel. It's also responsible for highlighting elements or logging Turbo Streams to the console. Even if the detail panel isn't shown.
Therefore the content.js always needs to be active.

If someone dislikes this behaviour, you can always manage via the browser settings on which sites this extension should and shouldn't be active.

@lirtistan
Copy link
Contributor Author

Therefore the content.js always needs to be active.

Then it needs to be refactored to be more robust, starting with surrounding await expressions with try/catch clauses, especialty if they have todo with IO operations. Do you agree with that!?

@leonvogt
Copy link
Owner

leonvogt commented Jun 14, 2024

I agree that we should make it more robust, but I would prefer to first find a reproducible way to replicate the issue before starting refactoring.
This way we know if our changes are actually fixing the issue.

@lirtistan
Copy link
Contributor Author

Strange, that error just appeared on the github pages.

Sure at some point during our last tests, i also tested on github (because UI is basically RoR), so they using hotwired stuff (at least TurboFrames, afaik).

So i went to the popup.html inspector and cleared the application context (Tab Application -> Clear site data ) and the error is gone. At least he doesn't appear anymore on the github pages.

I keep searching.

Also found a new error, see #49 for details.

@lirtistan
Copy link
Contributor Author

Ok the error showed again, seems this happens every time the extension is getting an upgrade, but still active on all sites during the upgrade process.

Happend again during testing of #50

Screenshot from 2024-06-15 12-00-20

@leonvogt
Copy link
Owner

leonvogt commented Jun 17, 2024

Ok the error showed again, seems this happens every time the extension is getting an upgrade, but still active on all sites during the upgrade process.

@lirtistan Awesome that you seem to have found the root of the error!
Maybe we can now find a reproducible way with this in mind.

@leonvogt leonvogt changed the title content.js need to be refactored, it throws a lot of errors on various sites Error: Extension context invalidated Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants