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

Reactivate background on popup open #41

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

luciopaiva
Copy link
Owner

This is a fix for issue #35.

@luciopaiva
Copy link
Owner Author

The main issue is fixed, but there's one small outstanding problem: the list of currently loaded scripts per tab id is lost when the background script is unloaded by Chrome. Even when the new popup logic reloads the background script, it doesn't remember the scripts it has loaded for the current tab (or for any other tab, for that matter).

image

I can see three possible ways of fixing this:

  • save the map of script names by tab ids in the local storage
  • save the map in the curren tab page itself (not sure if viable)
  • lookup the scripts all over again, but just the names so we can fill in the popup window

@mjuksel
Copy link

mjuksel commented Feb 26, 2022

I'd probably go with adding <script> element into the page, with an id:witchcraftscripts to check. (could use a shorter value I guess, but w/e)
Maybe use JSON.stringify(), or just CSV style (script1,script2,css1,etc2) and set it as the textContent.

/edit: maybe a template element with the popup's inside workings might be a good idea?
This way you can just retrieve that completely instead of having to create it in the popup.

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

Successfully merging this pull request may close these issues.

None yet

2 participants