author John Dai <>
Fri, 10 May 2019 15:01:40 +0000
changeset 532226 0e3d9d0c32602bf7a0847cac48b3622d57a46247
parent 532186 012ce6437a4cbb2bdffb1d641dd08f0a4ca66b75
child 534121 f798f327a76198fc38ae07358768e556fe126039
permissions -rw-r--r--
Bug 1538979 - Part 2: Add WillDestroy and DidDestroy lifecycle methods on JSWindowActor; r=nika Differential Revision:

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 */

interface nsISupports;

interface JSWindowActor {
  void sendAsyncMessage(DOMString messageName,
                        optional any obj,
                        optional any transfers);

  Promise<any> sendQuery(DOMString messageName,
                         optional any obj,
                         optional any transfers);

[ChromeOnly, ChromeConstructor]
interface JSWindowActorParent {
  readonly attribute WindowGlobalParent manager;
JSWindowActorParent implements JSWindowActor;

[ChromeOnly, ChromeConstructor]
interface JSWindowActorChild {
  readonly attribute WindowGlobalChild manager;

  readonly attribute Document? document;

  readonly attribute BrowsingContext? browsingContext;

  // NOTE: As this returns a window proxy, it may not be currently referencing
  // the document associated with this JSWindowActor. Generally prefer using
  // `document`.
  readonly attribute WindowProxy? contentWindow;
JSWindowActorChild implements JSWindowActor;

// WebIDL callback interface version of the nsIObserver interface for use when
// calling the observe method on JSWindowActors.
// NOTE: This isn't marked as ChromeOnly, as it has no interface object, and
// thus cannot be conditionally exposed.
callback interface MozObserverCallback {
  void observe(nsISupports subject, ByteString topic, DOMString? data);

// WebIDL callback interface calling the `willDestroy` and `didDestroy`
// method on JSWindowActors.
callback MozActorDestroyCallback = void();

dictionary MozActorDestroyCallbacks {
  [ChromeOnly] MozActorDestroyCallback willDestroy;
  [ChromeOnly] MozActorDestroyCallback didDestroy;