@UiThread
public static interface WebExtension.MessageDelegate
Modifier and Type | Method and Description |
---|---|
default void |
onConnect(WebExtension.Port port)
Called whenever the WebExtension connects to an app using
runtime.connectNative . |
default GeckoResult<Object> |
onMessage(String nativeApp,
Object message,
WebExtension.MessageSender sender)
Called whenever the WebExtension sends a message to an app using
runtime.sendNativeMessage . |
@Nullable default GeckoResult<Object> onMessage(@NonNull String nativeApp, @NonNull Object message, @NonNull WebExtension.MessageSender sender)
runtime.sendNativeMessage
.nativeApp
- The application identifier of the MessageDelegate that
sent this message.message
- The message that was sent, either a primitive type or
a JSONObject
.sender
- The WebExtension.MessageSender
corresponding to the frame
that originated the message.
Note: all messages are to be considered untrusted and
should be checked carefully for validity.GeckoResult
that resolves with a response to the
message.@Nullable default void onConnect(@NonNull WebExtension.Port port)
runtime.connectNative
.port
- WebExtension.Port
instance that can be used to send and
receive messages from the WebExtension. Use WebExtension.Port.sender
to verify the origin of this connection
request.