Class WebExtension.Port

Object
org.mozilla.geckoview.WebExtension.Port
Enclosing class:
WebExtension

@UiThread public static class WebExtension.Port extends Object
Port object that can be used for bidirectional communication with a WebExtension.

See also: WebExtensions/API/runtime/Port .

See Also:
  • Field Details

  • Constructor Details

    • Port

      protected Port()
      Override for tests.
  • Method Details

    • postMessage

      public void postMessage(@NonNull JSONObject message)
      Post a message to the WebExtension connected to this WebExtension.Port instance.
      Parameters:
      message - JSONObject that will be sent to the WebExtension.
    • disconnect

      public void disconnect()
      Disconnects this port and notifies the other end.
    • setDelegate

      public void setDelegate(@Nullable WebExtension.PortDelegate delegate)
      Set a delegate for incoming messages through this WebExtension.Port.
      Parameters:
      delegate - Delegate that will receive messages sent through this WebExtension.Port.