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.
The thing to notice - this actually breaks backwards compatibility, as currently registered external message handlers will stop working until moved to messages/external.
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 viachrome.runtime.onMessageExternal.addListener
instead ofchrome.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
, orbackground/messages/external/my-external-handler.ts
. If you want a message handler to work in both contexts, symlink itln -s background/messages/my-safe-handler.ts background/messages/external/my-safe-handler.ts
.Code of Conduct
Contacts
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