-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
The extension deployment uses the following flow to load SMW before scripts on the page get to run:
- Load a content script with
"run_at": "document_start" - Within the the content script, inject a script tag into the target window that boots SMW
These two steps must run synchronously to ensure that no other script runs before SMW is installed. The top-level component for booting SMW is a Controller that is passed an SMW config. It is desirable for the SMW config to be user modifiable, so the config must be persisted somewhere that can be synchronously loaded by the content script.
Some ideas include:
- Use a
window.location.hashkey/value pair. When the extension detects that it has a different config than the one currently loaded (perhaps via an async storage mechanism likechrome.storage) it can navigate to the same page with a modified hash. - Use
localStorage, which is synchronous. Unfortunately, content scripts sharelocalStoragewith the page they're attached to, not the extension's background page, so the rest of the extension will not be privy to this information and the extension will pollute the page'slocalStorage.
Reactions are currently unavailable