Skip to content

Make extension-injected controllers configurable #7

@mdittmer

Description

@mdittmer

The extension deployment uses the following flow to load SMW before scripts on the page get to run:

  1. Load a content script with "run_at": "document_start"
  2. 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:

  1. Use a window.location.hash key/value pair. When the extension detects that it has a different config than the one currently loaded (perhaps via an async storage mechanism like chrome.storage) it can navigate to the same page with a modified hash.
  2. Use localStorage, which is synchronous. Unfortunately, content scripts share localStorage with 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's localStorage.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions