dom/ipc/PBrowser.ipdl
author Kartikaya Gupta <kgupta@mozilla.com>
Mon, 06 May 2019 22:14:40 +0000
changeset 531641 7748746bf2feda8edd0cabfdaff88b7faf059ad5
parent 531583 3288c43195a26565edec3d59a8f8bce6018be592
child 532215 4686eebd8962db7d03d7fbca124cca28069f4a72
permissions -rw-r--r--
Bug 1548568 - Cleanup to remove unused guid parameter in callback. r=botond Differential Revision: https://phabricator.services.mozilla.com/D29688

/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PColorPicker;
include protocol PContent;
include protocol PDocAccessible;
include protocol PFilePicker;
include protocol PPluginWidget;
include protocol PRemotePrintJob;
include protocol PChildToParentStream;
include protocol PParentToChildStream;
include protocol PFileDescriptorSet;
include protocol PIPCBlobInputStream;
include protocol PPaymentRequest;
include protocol PWindowGlobal;
include protocol PBrowserBridge;

include DOMTypes;
include IPCBlob;
include IPCStream;
include JavaScriptTypes;
include URIParams;
include PPrintingTypes;
include PTabContext;

include "mozilla/GfxMessageUtils.h";
include "mozilla/layers/LayersMessageUtils.h";

using moveonly mozilla::gfx::PaintFragment from "mozilla/gfx/CrossProcessPaint.h";
using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::LayoutDevicePoint from "Units.h";
using mozilla::ScreenIntPoint from "Units.h";
using ScreenIntSize from "Units.h";
using struct mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
using struct mozilla::layers::ZoomConstraints from "mozilla/layers/ZoomConstraints.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
using mozilla::layers::MaybeZoomConstraints from "mozilla/layers/ZoomConstraints.h";
using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/GeckoContentController.h";
using ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using nscolor from "nsColor.h";
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::widget::IMENotification from "mozilla/widget/IMEData.h";
using struct mozilla::widget::IMENotificationRequests from "mozilla/widget/IMEData.h";
using struct mozilla::widget::IMEState from "mozilla/widget/IMEData.h";
using struct mozilla::widget::InputContext from "mozilla/widget/IMEData.h";
using struct mozilla::widget::InputContextAction from "mozilla/widget/IMEData.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using class mozilla::ContentCache from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetDragEvent from "ipc/nsGUIEventIPC.h";
using struct nsRect from "nsRect.h";
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetPluginEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositorOptions from "mozilla/layers/CompositorOptions.h";
using mozilla::CSSToScreenScale from "Units.h";
using mozilla::CommandInt from "mozilla/EventForwards.h";
using mozilla::WritingMode from "mozilla/WritingModes.h";
using nsIWidget::TouchPointerState from "nsIWidget.h";
using nsCursor from "nsIWidget.h";
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
using mozilla::EventMessage from "mozilla/EventForwards.h";
using nsEventStatus from "mozilla/EventForwards.h";
using mozilla::Modifiers from "mozilla/EventForwards.h";
using nsSizeMode from "nsIWidgetListener.h";
using mozilla::widget::CandidateWindowPosition from "ipc/nsGUIEventIPC.h";
using class mozilla::NativeEventData from "ipc/nsGUIEventIPC.h";
using mozilla::FontRange from "ipc/nsGUIEventIPC.h";
using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/IPCTypes.h";
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
using refcounted class mozilla::dom::BrowsingContext from "mozilla/dom/BrowsingContext.h";

namespace mozilla {
namespace dom {

struct ShowInfo
{
  nsString name;
  bool fullscreenAllowed;
  bool isPrivate;
  bool fakeShowInfo;
  bool isTransparent;
  float dpi;
  int32_t widgetRounding;
  double defaultScale;
};

struct WebProgressData
{
  bool isTopLevel;
  bool isLoadingDocument;
  uint32_t loadType;
  uint64_t outerDOMWindowID;
  uint64_t innerDOMWindowID;
};

struct RequestData
{
  nsIURI requestURI;
  nsIURI originalRequestURI;
  nsCString matchedList;
};

/**
 * A PBrowser manages a maximal locally connected subtree of BrowsingContexts
 * in a content process.
 *
 * See `dom/docs/Fission-IPC-Diagram.svg` for an overview of the DOM IPC
 * actors.
 */
nested(upto inside_cpow) sync protocol PBrowser
{
    manager PContent;

    manages PColorPicker;
    manages PDocAccessible;
    manages PFilePicker;
    manages PPluginWidget;
    manages PPaymentRequest;
    manages PWindowGlobal;
    manages PBrowserBridge;

both:
    async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
                       nsIPrincipal aPrincipal, ClonedMessageData aData);

parent:
    /**
     * Tell the parent process a new accessible document has been created.
     * aParentDoc is the accessible document it was created in if any, and
     * aParentAcc is the id of the accessible in that document the new document
     * is a child of. aMsaaID is the MSAA id for this content process, and
     * is only valid on Windows. Set to 0 on other platforms. aDocCOMProxy
     * is also Windows-specific and should be set to 0 on other platforms.
     */
    async PDocAccessible(nullable PDocAccessible aParentDoc, uint64_t aParentAcc,
                         uint32_t aMsaaID, IAccessibleHolder aDocCOMProxy);

    /*
     * Creates a new remoted nsIWidget connection for windowed plugins
     * in e10s mode. This is always initiated from the child in response
     * to windowed plugin creation.
     */
    sync PPluginWidget();

    async PPaymentRequest();

    /**
     * Construct a new WindowGlobal actor for a window global in the given
     * BrowsingContext and with the given principal.
     */
    async PWindowGlobal(WindowGlobalInit init);

    /**
     * Construct a new Remote iframe actor.
     */
    async PBrowserBridge(nsString aPresentationURL, nsString aRemoteType,
                         BrowsingContext aBrowsingContext, uint32_t aChromeFlags);

    /**
     * Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
     * widget's shareable window on the chrome side. Only used on Windows.
     */
    async SetNativeChildOfShareableWindow(uintptr_t childWindow);

    /**
     * When content moves focus from a native plugin window that's a child
     * of the native browser window we need to move native focus to the
     * browser. Otherwise the plugin window will never relinquish focus.
     */
    sync DispatchFocusToTopLevelWindow();

parent:
    /**
     * When child sends this message, parent should move focus to
     * the next or previous focusable element or document.
     */
    async MoveFocus(bool forward, bool forDocumentNavigation);

    /**
     * SizeShellTo request propagation to parent.
     *
     * aFlag            Can indicate if one of the dimensions should be ignored.
     *                  If only one dimension has changed it has to be indicated
     *                  by the nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_* flags.
     * aShellItemWidth,
     * aShellItemHeight On parent side we won't be able to decide the dimensions
     *                  of the shell item parameter in the original SizeShellTo
     *                  call so we send over its dimensions that will be used
     *                  for the actual resize.
     **/
    async SizeShellTo(uint32_t aFlag, int32_t aWidth, int32_t aHeight,
                      int32_t aShellItemWidth, int32_t aShellItemHeight);

    /**
     * Called by the child to inform the parent that links are dropped into
     * content area.
     *
     * aLinks A flat array of url, name, and type for each link
     */
    async DropLinks(nsString[] aLinks);

    async Event(RemoteDOMEvent aEvent);

    sync SyncMessage(nsString aMessage, ClonedMessageData aData,
                     CpowEntry[] aCpows, nsIPrincipal aPrincipal)
      returns (StructuredCloneData[] retval);

    nested(inside_sync) sync RpcMessage(nsString aMessage, ClonedMessageData aData,
                                        CpowEntry[] aCpows, nsIPrincipal aPrincipal)
      returns (StructuredCloneData[] retval);

    /**
     * Notifies chrome that there is a focus change involving an editable
     * object (input, textarea, document, contentEditable. etc.)
     *
     *  contentCache Cache of content
     *  notification Whole data of the notification
     *  requests     Requests of notification for IME of the native widget
     */
    nested(inside_cpow) async NotifyIMEFocus(ContentCache contentCache,
                                             IMENotification notification)
      returns (IMENotificationRequests requests);

    /**
     * Notifies chrome that there has been a change in text content
     * One call can encompass both a delete and an insert operation
     * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
     *
     *  contentCache Cache of content
     *  notification Whole data of the notification
     */
    nested(inside_cpow) async NotifyIMETextChange(ContentCache contentCache,
                                                  IMENotification notification);

    /**
     * Notifies chrome that there is a IME compostion rect updated
     *
     *  contentCache Cache of content
     */
    nested(inside_cpow) async NotifyIMECompositionUpdate(ContentCache contentCache,
                                                         IMENotification notification);

    /**
     * Notifies chrome that there has been a change in selection
     * Only called when NotifyIMEFocus returns PR_TRUE for mWantUpdates
     *
     *  contentCache Cache of content
     *  notification Whole data of the notification
     */
    nested(inside_cpow) async NotifyIMESelection(ContentCache contentCache,
                                                 IMENotification notification);

    /**
     * Notifies chrome of updating its content cache.
     * This is useful if content is modified but we don't need to notify IME.
     *
     *  contentCache Cache of content
     */
    nested(inside_cpow) async UpdateContentCache(ContentCache contentCache);

    /**
     * Notifies IME of mouse button event on a character in focused editor.
     *
     * Returns true if the mouse button event is consumed by IME.
     */
    nested(inside_cpow) sync NotifyIMEMouseButtonEvent(IMENotification notification)
      returns (bool consumedByIME);

    /**
     * Notifies chrome to position change
     *
     *  contentCache Cache of content
     */
    nested(inside_cpow) async NotifyIMEPositionChange(ContentCache contentCache,
                                                      IMENotification notification);

    /**
     * Requests chrome to commit or cancel composition of IME.
     *
     *  cancel                Set true if composition should be cancelled.
     *
     *  isCommitted           Returns true if the request causes composition
     *                        being committed synchronously.
     *  committedString       Returns committed string.  The may be non-empty
     *                        string even if cancel is true because IME may
     *                        try to restore selected string which was
     *                        replaced with the composition.
     */
    nested(inside_cpow) sync RequestIMEToCommitComposition(bool cancel)
                        returns (bool isCommitted, nsString committedString);

    /**
     * OnEventNeedingAckHandled() is called after a child process dispatches a
     * composition event or a selection event which is sent from the parent
     * process.
     *
     * message      The message value of the handled event.
     */
    nested(inside_cpow) async OnEventNeedingAckHandled(EventMessage message);

    /**
     * Tells chrome to start plugin IME.  If this results in a string getting
     * committed, the result is in aCommitted (otherwise aCommitted is empty).
     *
     * aKeyboardEvent     The event with which plugin IME is to be started
     * panelX and panelY  Location in screen coordinates of the IME input panel
     *                    (should be just under the plugin)
     * aCommitted         The string committed during IME -- otherwise empty
     */
    nested(inside_cpow) sync StartPluginIME(WidgetKeyboardEvent aKeyboardEvent,
                                            int32_t panelX, int32_t panelY)
        returns (nsString aCommitted);

    /**
     * Tells chrome (and specifically the appropriate widget) whether or not
     * a plugin (inside the widget) has the keyboard focus.  Should be sent
     * when the keyboard focus changes too or from a plugin.
     *
     * aFocused  Whether or not a plugin is focused
     */
    nested(inside_cpow) async SetPluginFocused(bool aFocused);

    /**
     * Set IME candidate window by windowless plugin if plugin has focus.
     */
    async SetCandidateWindowForPlugin(CandidateWindowPosition aPosition);

    /**
     * Enable or Disable IME by windowless plugin if plugin has focus.
     */
    async EnableIMEForPlugin(bool aEnable);

    /**
     * Notifies the parent process of native key event data received in a
     * plugin process directly.
     *
     * aKeyEventData    The native key event data.  The actual type copied into
     *                  NativeEventData depending on the caller.  Please check
     *                  PluginInstanceChild.
     */
    nested(inside_cpow) async OnWindowedPluginKeyEvent(NativeEventData aKeyEventData);

    /**
     *  When plugin event isn't consumed, call this
     */
    async DefaultProcOfPluginEvent(WidgetPluginEvent aEvent);

    /**
     * Request that the parent process move focus to the browser's frame. If
     * canRaise is true, the window can be raised if it is inactive.
     */
    async RequestFocus(bool canRaise);

    /**
     * Indicate, based on the current state, that some commands are enabled and
     * some are disabled.
     */
    async EnableDisableCommands(nsString action,
                                nsCString[] enabledCommands,
                                nsCString[] disabledCommands);

    nested(inside_cpow) sync GetInputContext() returns (IMEState state);

    nested(inside_cpow) async SetInputContext(InputContext context,
                                              InputContextAction action);

    /**
     * Set the native cursor.
     * @param value
     *   The widget cursor to set.
     * @param hasCustomCursor
     *   Whether there's any custom cursor represented by cursorData and
     *   company.
     * @param customCursorData
     *   Serialized image data.
     * @param width
     *   Width of the image.
     * @param height
     *   Height of the image.
     * @param stride
     *   Stride used in the image data.
     * @param format
     *   Image format, see gfx::SurfaceFormat for possible values.
     * @param hotspotX
     *   Horizontal hotspot of the image, as specified by the css cursor property.
     * @param hotspotY
     *   Vertical hotspot of the image, as specified by the css cursor property.
     * @param force
     *   Invalidate any locally cached cursor settings and force an
     *   update.
     */
    async SetCursor(nsCursor value,
                    bool hasCustomCursor,
                    nsCString customCursorData,
                    uint32_t width, uint32_t height,
                    uint32_t stride, SurfaceFormat format,
                    uint32_t hotspotX, uint32_t hotspotY, bool force);

    /**
     * Used to set the current text of the status tooltip.
     * Nowadays this is mainly used for link locations on hover.
     */
    async SetStatus(uint32_t type, nsString status);

    /**
     * Show/hide a tooltip when the mouse hovers over an element in the content
     * document.
     */
    async ShowTooltip(uint32_t x, uint32_t y, nsString tooltip, nsString direction);
    async HideTooltip();

    /**
     * Create an asynchronous color picker on the parent side,
     * but don't open it yet.
     */
    async PColorPicker(nsString title, nsString initialColor);

    async PFilePicker(nsString aTitle, int16_t aMode);

    /**
     * Initiates an asynchronous request for one of the special indexedDB
     * permissions for the provided principal.
     *
     * @param principal
     *   The principal of the request.
     *
     * NOTE: The principal is untrusted in the parent process. Only
     *       principals that can live in the content process should
     *       provided.
     */
    async IndexedDBPermissionRequest(nsIPrincipal aPrincipal) returns (uint32_t permission);

    /**
     * window.open from inside <iframe mozbrowser> is special.  When the child
     * process calls window.open, it creates a new PBrowser (in its own
     * process), then calls BrowserFrameOpenWindow on it.
     *
     * The parent process gets a chance to accept or reject the window.open
     * call, and windowOpened is set to true if we ended up going through with
     * the window.open.
     *
     * @param opener the PBrowser whose content called window.open.
     */
    async BrowserFrameOpenWindow(PBrowser opener,
                                 nsString aURL, nsString aName,
                                 bool aForceNoReferrer, nsString aFeatures)
        returns (CreatedWindowInfo window);

    /**
     * Tells the containing widget whether the given input block results in a
     * swipe. Should be called in response to a WidgetWheelEvent that has
     * mFlags.mCanTriggerSwipe set on it.
     */
    async RespondStartSwipeEvent(uint64_t aInputBlockId, bool aStartSwipe);

    /**
     * Brings up the auth prompt dialog.
     * Called when this is the PBrowserParent for a nested remote iframe.
     * aCallbackId corresponds to an nsIAuthPromptCallback that lives in the
     * root process.  It will be passed back to the root process with either the
     * OnAuthAvailable or OnAuthCancelled message.
     */
    async AsyncAuthPrompt(nsCString uri, nsString realm, uint64_t aCallbackId);

    /**
     * Look up dictionary by selected word for OSX
     *
     * @param aText       The word to look up
     * @param aFontRange  Text decoration of aText
     * @param aIsVertical true if vertical layout
     */
    async LookUpDictionary(nsString aText, FontRange[] aFontRangeArray,
                           bool aIsVertical, LayoutDeviceIntPoint aPoint);

    async __delete__();

    async ReplyKeyEvent(WidgetKeyboardEvent event);

    /**
     * Retrieves edit commands for the key combination represented by aEvent.
     *
     * @param aType       One of nsIWidget::NativeKeyBindingsType.
     * @param aEvent      KeyboardEvent which represents a key combination.
     *                    Note that this must be a trusted event.
     * @return            Array of edit commands which should be executed in
     *                    editor of native applications.
     */
    sync RequestNativeKeyBindings(uint32_t aType, WidgetKeyboardEvent aEvent)
        returns (CommandInt[] commands);

    async SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
                                   int32_t aNativeKeyCode,
                                   uint32_t aModifierFlags,
                                   nsString aCharacters,
                                   nsString aUnmodifiedCharacters,
                                   uint64_t aObserverId);
    async SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
                                     uint32_t aNativeMessage,
                                     uint32_t aModifierFlags,
                                     uint64_t aObserverId);
    async SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
                                    uint64_t aObserverId);
    async SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
                                           uint32_t aNativeMessage,
                                           double aDeltaX,
                                           double aDeltaY,
                                           double aDeltaZ,
                                           uint32_t aModifierFlags,
                                           uint32_t aAdditionalFlags,
                                           uint64_t aObserverId);
    async SynthesizeNativeTouchPoint(uint32_t aPointerId,
                                     TouchPointerState aPointerState,
                                     LayoutDeviceIntPoint aPoint,
                                     double aPointerPressure,
                                     uint32_t aPointerOrientation,
                                     uint64_t aObserverId);
    async SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
                                   bool aLongTap,
                                   uint64_t aObserverId);
    async ClearNativeTouchSequence(uint64_t aObserverId);

    async AccessKeyNotHandled(WidgetKeyboardEvent event);

    async SetHasBeforeUnload(bool aHasBeforeUnload);

    async RegisterProtocolHandler(nsString scheme, nsIURI handlerURI, nsString title,
                                  nsIURI documentURI);

    async OnProgressChange(WebProgressData? aWebProgressData,
                           RequestData aRequestData, int32_t aCurSelfProgress,
                           int32_t aMaxSelfProgress, int32_t aCurTotalProgress,
                           int32_t aMaxTotalProgress);

    async OnStatusChange(WebProgressData? aWebProgressData,
                         RequestData aRequestData, nsresult aStatus,
                         nsString aMessage);

    async OnContentBlockingEvent(WebProgressData? aWebProgressData,
                                 RequestData aRequestData, uint32_t aEvent);

    async SessionStoreUpdate(nsCString? aDocShellCaps,
                             bool? aPrivatedMode,
                             nsCString[] aPositions,
                             int32_t[] aPositionDescendants,
                             uint32_t aFlushId);

child:
    async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
    async FlushTabState(uint32_t aFlushId);

parent:

    /**
     * Child informs the parent that the graphics objects are ready for
     * compositing.  This is sent when all pending changes have been
     * sent to the compositor and are ready to be shown on the next composite.
     * @see PCompositor
     * @see RequestNotifyAfterRemotePaint
     */
    async RemotePaintIsReady();

    /**
     * Child informs the parent that a compositor transaction has ocurred.
     */
    async NotifyCompositorTransaction();

    /**
     * Child informs the parent that the content is ready to handle input
     * events. This is sent when the BrowserChild is created.
     */
    async RemoteIsReadyToHandleInputEvents();

    /**
     * Child informs the parent that the layer tree is already available.
     */
    async PaintWhileInterruptingJSNoOp(LayersObserverEpoch aEpoch);

    /**
     * Sent by the child to the parent to inform it that an update to the
     * dimensions has been requested, likely through win.moveTo or resizeTo
     */
    async SetDimensions(uint32_t aFlags, int32_t aX, int32_t aY, int32_t aCx, int32_t aCy);

    nested(inside_sync) sync DispatchWheelEvent(WidgetWheelEvent event);
    nested(inside_sync) sync DispatchMouseEvent(WidgetMouseEvent event);
    nested(inside_sync) sync DispatchKeyboardEvent(WidgetKeyboardEvent event);

    async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action,
                            Shmem? visualData,
                            uint32_t stride, SurfaceFormat format,
                            LayoutDeviceIntRect dragRect,
                            nsIPrincipal principal);

    // After a compositor reset, it is necessary to reconnect each layers ID to
    // the compositor of the widget that will render those layers. Note that
    // this is sync so we can ensure that messages to the window compositor
    // arrive before the BrowserChild attempts to use its cross-process compositor
    // bridge.
    sync EnsureLayersConnected() returns (CompositorOptions compositorOptions);

    /**
     * This function is used to notify the parent that it should display a
     * canvas permission prompt.
     *
     * @param aFirstPartyURI first party of the tab that is requesting access.
     */
    async ShowCanvasPermissionPrompt(nsCString aFirstPartyURI,
                                     bool aHideDoorHanger);

    sync SetSystemFont(nsCString aFontName);
    sync GetSystemFont() returns (nsCString retval);

    sync SetPrefersReducedMotionOverrideForTest(bool aValue);
    sync ResetPrefersReducedMotionOverrideForTest();

child:
    /**
     * Notify the remote browser that it has been Show()n on this
     * side, with the given |visibleRect|.  This message is expected
     * to trigger creation of the remote browser's "widget".
     *
     * |Show()| and |Move()| take IntSizes rather than Rects because
     * content processes always render to a virtual <0, 0> top-left
     * point.
     */
    async Show(ScreenIntSize size,
               ShowInfo info,
               bool parentIsActive,
               nsSizeMode sizeMode);

    async InitRendering(TextureFactoryIdentifier textureFactoryIdentifier,
                        LayersId layersId,
                        CompositorOptions compositorOptions,
                        bool layersConnected);

    async LoadURL(nsCString uri, ShowInfo info);

    async ResumeLoad(uint64_t pendingSwitchID, ShowInfo info);

    async UpdateDimensions(DimensionInfo dimensions) compressall;

    async SizeModeChanged(nsSizeMode sizeMode);

    async ChildToParentMatrix(Matrix4x4 aMatrix);

    async ParentActivated(bool aActivated);

    async SetKeyboardIndicators(UIStateChangeType showAccelerators,
                                UIStateChangeType showFocusRings);

    /**
     * StopIMEStateManagement() is called when the process loses focus and
     * should stop managing IME state.
     */
    async StopIMEStateManagement();

    /**
     * @see nsIDOMWindowUtils sendMouseEvent.
     */
    async MouseEvent(nsString aType,
                     float aX,
                     float aY,
                     int32_t aButton,
                     int32_t aClickCount,
                     int32_t aModifiers,
                     bool aIgnoreRootScrollFrame);

    /**
     * When two consecutive mouse move events would be added to the message queue,
     * they are 'compressed' by dumping the oldest one.
     */
    prio(input) async RealMouseMoveEvent(WidgetMouseEvent event,
                                         ScrollableLayerGuid aGuid,
                                         uint64_t aInputBlockId) compress;

    async NormalPriorityRealMouseMoveEvent(WidgetMouseEvent event,
                                           ScrollableLayerGuid aGuid,
                                           uint64_t aInputBlockId) compress;

    /**
     * Mouse move events with |reason == eSynthesized| are sent via a separate
     * message because they do not generate DOM 'mousemove' events, and the
     * 'compress' attribute on RealMouseMoveEvent() could result in a
     * |reason == eReal| event being dropped in favour of an |eSynthesized|
     * event, and thus a DOM 'mousemove' event to be lost.
     */
    prio(input) async SynthMouseMoveEvent(WidgetMouseEvent event,
                                          ScrollableLayerGuid aGuid,
                                          uint64_t aInputBlockId);
    async NormalPrioritySynthMouseMoveEvent(WidgetMouseEvent event,
                                            ScrollableLayerGuid aGuid,
                                            uint64_t aInputBlockId);

    prio(input) async RealMouseButtonEvent(WidgetMouseEvent event,
                                           ScrollableLayerGuid aGuid,
                                           uint64_t aInputBlockId);
    async NormalPriorityRealMouseButtonEvent(WidgetMouseEvent event,
                                             ScrollableLayerGuid aGuid,
                                             uint64_t aInputBlockId);

    prio(input) async RealKeyEvent(WidgetKeyboardEvent event);
    async NormalPriorityRealKeyEvent(WidgetKeyboardEvent event);

    prio(input) async MouseWheelEvent(WidgetWheelEvent event,
                                      ScrollableLayerGuid aGuid,
                                      uint64_t aInputBlockId);
    async NormalPriorityMouseWheelEvent(WidgetWheelEvent event,
                                        ScrollableLayerGuid aGuid,
                                        uint64_t aInputBlockId);

    prio(input) async RealTouchEvent(WidgetTouchEvent aEvent,
                                     ScrollableLayerGuid aGuid,
                                     uint64_t aInputBlockId,
                                     nsEventStatus aApzResponse);
    async NormalPriorityRealTouchEvent(WidgetTouchEvent aEvent,
                                       ScrollableLayerGuid aGuid,
                                       uint64_t aInputBlockId,
                                       nsEventStatus aApzResponse);

    prio(input) async HandleTap(TapType aType, LayoutDevicePoint point,
                                Modifiers aModifiers, ScrollableLayerGuid aGuid,
                                uint64_t aInputBlockId);
    async NormalPriorityHandleTap(TapType aType, LayoutDevicePoint point,
                                  Modifiers aModifiers, ScrollableLayerGuid aGuid,
                                  uint64_t aInputBlockId);

    prio(input) async RealTouchMoveEvent(WidgetTouchEvent aEvent,
                                         ScrollableLayerGuid aGuid,
                                         uint64_t aInputBlockId,
                                         nsEventStatus aApzResponse);
    async NormalPriorityRealTouchMoveEvent(WidgetTouchEvent aEvent,
                                           ScrollableLayerGuid aGuid,
                                           uint64_t aInputBlockId,
                                           nsEventStatus aApzResponse);

    /*
     * We disable the input event queue when there is an active dnd session. We
     * don't need support RealDragEvent with input priority.
     */
    async RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction,
                        uint32_t aDropEffect, nsIPrincipal aPrincipal);

    async PluginEvent(WidgetPluginEvent aEvent);

    prio(input) async CompositionEvent(WidgetCompositionEvent event);
    async NormalPriorityCompositionEvent(WidgetCompositionEvent event);

    prio(input) async SelectionEvent(WidgetSelectionEvent event);
    async NormalPrioritySelectionEvent(WidgetSelectionEvent event);

    /**
     * Call PasteTransferable via a controller on the content process
     * to handle the command content event, "pasteTransferable".
     */
    async PasteTransferable(IPCDataTransfer aDataTransfer,
                            bool aIsPrivateData,
                            nsIPrincipal aRequestingPrincipal,
                            uint32_t aContentPolicyType);

    /**
     * Activate event forwarding from client to parent.
     */
    async ActivateFrameEvent(nsString aType, bool capture);

    async LoadRemoteScript(nsString aURL, bool aRunInGlobalScope);

    /**
     * Sent by the chrome process when it no longer wants this remote
     * <browser>.  The child side cleans up in response, then
     * finalizing its death by sending back __delete__() to the
     * parent.
     */
    async Destroy();

    /**
     * Update the child side docShell active (resource use) state.
     *
     * @param aIsActive
     *        Whether to activate or deactivate the docshell.
     * @param aPreserveLayers
     *        Whether layer trees should be preserved for inactive docshells.
     */
    async SetDocShellIsActive(bool aIsActive);

    /**
     * If aEnabled is true, tells the child to paint and upload layers to
     * the compositor. If aEnabled is false, the child stops painting and
     * clears the layers from the compositor.
     *
     * @param aEnabled
     *        True if the child should render and upload layers, false if the
     *        child should clear layers.
     * @param aForceRepaint
     *        True if the child should force a paint even if it's already
     *        visible.
     * @param aEpoch
     *        The layer observer epoch for this activation. This message should be
     *        ignored if this epoch has already been observed (via
     *        PaintWhileInterruptingJS).
     */
    async RenderLayers(bool aEnabled, bool aForceRepaint, LayersObserverEpoch aEpoch);

    async RequestRootPaint(IntRect aRect, float aScale, nscolor aBackgroundColor) returns (PaintFragment retval);
    async RequestSubPaint(float aScale, nscolor aBackgroundColor) returns (PaintFragment retval);
child:
    /**
     * Notify the child that it shouldn't paint the offscreen displayport.
     * This is useful to speed up interactive operations over async
     * scrolling performance like resize, tabswitch, pageload.
     *
     * Each enable call must be matched with a disable call. The child
     * will remain in the suppress mode as long as there's
     * a single unmatched call.
     */
    async SuppressDisplayport(bool aEnabled);

    /**
     * Navigate by key (Tab/Shift+Tab/F6/Shift+f6).
     */
    async NavigateByKey(bool aForward, bool aForDocumentNavigation);

    /**
     * The parent (chrome thread) requests that the child inform it when
     * the graphics objects are ready to display.
     * @see PCompositor
     * @see RemotePaintIsReady
     */
    async RequestNotifyAfterRemotePaint();

    /**
     * Tell the child that the UI resolution changed for the containing
     * window.
     * To avoid some sync messages from child to parent, we also send the dpi
     * and default scale with the notification.
     * If we don't know the dpi and default scale, we just pass in a negative
     * value (-1) but in the majority of the cases this saves us from two
     * sync requests from the child to the parent.
     */
    async UIResolutionChanged(float dpi, int32_t rounding, double scale);

    /**
     * Tell the child that the system theme has changed, and that a repaint
     * is necessary.
     */
    async ThemeChanged(LookAndFeelInt[] lookAndFeelIntCache);

    /**
     * Tell the browser that its frame loader has been swapped
     * with another.
     */
    async SwappedWithOtherRemoteLoader(IPCTabContext context);

    /**
     * A potential accesskey was just pressed. Look for accesskey targets
     * using the list of provided charCodes.
     *
     * @param event keyboard event
     * @param isTrusted true if triggered by a trusted key event
     */
    async HandleAccessKey(WidgetKeyboardEvent event,
                          uint32_t[] charCodes);

    /**
     * Tells the root child docShell whether or not to use
     * global history. This is sent right after the PBrowser
     * is bound to a frameloader element.
     */
    async SetUseGlobalHistory(bool aUse);

    /**
     * HandledWindowedPluginKeyEvent() is always called after posting a native
     * key event with OnWindowedPluginKeyEvent().
     *
     * @param aKeyEventData      The key event which was posted to the parent
     *                           process.
     * @param aIsConsumed        true if aKeyEventData is consumed in the
     *                           parent process.  Otherwise, false.
     */
    async HandledWindowedPluginKeyEvent(NativeEventData aKeyEventData,
                                        bool aIsConsumed);

    /**
     * Tell the child to print the current page with the given settings.
     *
     * @param aOuterWindowID the ID of the outer window to print
     * @param aPrintData the serialized settings to print with
     */
    async Print(uint64_t aOuterWindowID, PrintData aPrintData);

    /**
     * Update the child with the tab's current top-level native window handle.
     * This is used by a11y objects who must expose their native window.
     *
     * @param aNewHandle The native window handle of the tab's top-level window.
     */
    async UpdateNativeWindowHandle(uintptr_t aNewHandle);

    /**
     * Tell the BrowserChild that it should expect a Large-Allocation load to occur.
     * Loads which occur until this flag is cleared will not leave the process.
     */
    async AwaitLargeAlloc();

    /**
     * Tell the BrowserChild to set the name of its toplevel docshell to the given name.
     */
    async SetWindowName(nsString aName);

    /**
     * Tell the BrowserChild to allow scripts in the docshell to close the window.
     */
    async AllowScriptsToClose();

    /**
     * Tell the BrowserChild what OriginAttributes it should inherit from. This must
     * be called before the first non-blank document is loaded in the BrowserChild.
     */
    async SetOriginAttributes(OriginAttributes aOriginAttributes);

    /**
     * Pass the current handle for the current native widget to the content
     * process, so it can be used by PuppetWidget.
     */
    async SetWidgetNativeData(WindowsHandle aHandle);

    /**
     * Requests the content blocking log, which is sent back in response.
     */
    async GetContentBlockingLog() returns(nsCString log, bool success);

parent:
    /** Records a history visit. */
    async VisitURI(URIParams aURI, URIParams? aLastVisitedURI,
                   uint32_t aFlags);

    /** Fetches the visited status for an array of URIs (Android-only). */
    async QueryVisitedState(URIParams[] aURIs);

/*
 * FIXME: write protocol!

state LIVE:
    send LoadURL goto LIVE;
//etc.
    send Destroy goto DYING;

state DYING:
    discard send blah;
// etc.
    recv __delete__;
 */
};

}
}