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

feat(external_messaging): Adds external messaging resolver #961

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

sleekslush
Copy link
Contributor

@sleekslush sleekslush commented Apr 25, 2024

Details

Introduces concept of external messaging handlers. By using the path of messages/external/, we can leverage the same messaging features, but they will be registered via chrome.runtime.onMessageExternal.addListener instead of chrome.runtime.onMessage.addListener.

This fixes an issue currently where all message handlers are being registered as internal AND external handlers, which can be unsafe.

You can either set up a message handler in background/messages/my-handler.ts , or background/messages/external/my-external-handler.ts. If you want a message handler to work in both contexts, symlink it ln -s background/messages/my-safe-handler.ts background/messages/external/my-safe-handler.ts.

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I agree to license this contribution under the MIT LICENSE
  • I checked the current PR for duplication.

Contacts

  • (OPTIONAL) Discord ID: filthytone

If your PR is accepted, we will award you with the Contributor role on Discord server.

To join the server, visit: https://www.plasmo.com/s/d

@sleekslush sleekslush changed the title Adds external messaging resolver feat(external_messaging): Adds external messaging resolver Apr 25, 2024
Copy link
Contributor

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@louisgv louisgv merged commit aea3fee into PlasmoHQ:main Apr 25, 2024
1 check passed
@ivliag
Copy link

ivliag commented May 16, 2024

The thing to notice - this actually breaks backwards compatibility, as currently registered external message handlers will stop working until moved to messages/external.

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

3 participants