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

Implement web page -> background script communication, with Firefox polyfill #6

Open
Tracked by #3509
fregante opened this issue Aug 22, 2021 · 2 comments
Open
Tracked by #3509

Comments

@fregante fregante changed the title Implement web page -> background script communication, with Firefox Implement web page -> background script communication, with Firefox polyfill Aug 22, 2021
@fregante
Copy link
Contributor Author

fregante commented Sep 13, 2021

A few notes regarding the unsafe communication in general:

  • This API will need to accept an extension ID (for externally_connectable), which could be defined in getMethod("GET_VERSION", id) (since it's static) or at the call site, so getVersion(id)
  • The unsafe context should probably not have access to arbitrary tabs or contexts, so getVersion({extensionId, tabId, frameId}) should not be supported
  • Since this is now being built as a public module, the unsafe messaging should probably always indicate which extension it's trying to talk to, even if the content script doesn't require the extension ID.

This leaves only 3 contexts accessible from the unsafe context:

  • current CS
  • background context (either via externally_connectable or via CS)
  • perhaps the current tab’s editor/devtools (either directly or via CS+background)

Since the unsafe context is special, security-wise, it should probably have its own special methods for each context anyway.

General notes also added in #5

@twschiller
Copy link
Collaborator

I agree with everything above. As you mention, the external -> devtools isn't strictly necessary because it can hop through the background page. (I don't think CS can initiate communication to the devtools in our current setup?)

Also commented in #5 (comment) about opt-in for endpoints

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

No branches or pull requests

2 participants