Skip to content

Web Components behaviour in content scripts #210

Description

@versusvoid

Been digging through Firefox's code trying to fix Web Components in extension content scripts (https://bugzilla.mozilla.org/show_bug.cgi?id=1492002).

I've found the core problem, it's specific for Firefox implementation, but now I'm not sure what "correct" solution should look like.

Right now Firefox's policy regarding normal JS objects looks like:

  1. content script sees page's objects only if explicitly asked (wrappedJSObject)
  2. page script sees extension's objects only if explicitly provided (exportFunction, cloneInto)

It seems reasonable to extend this policy to Web Components:

  1. content script sees page's component properties only if explicitly asked
  2. page script sees plain HTMLElement for content's components

but it may be just my narrow point of view.

Also right now window.customElements slightly breaks isolation between scripts (not sure if this is Firefox specific) since it is shared between contexts: if component was defined in page script, content script can't use the same name and vice versa.

Maybe "correct" solution would be disabling customElements in content scripts altogether?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions