Bug 1533955 - Move the current message manager actors to a legacy list, and create a new list of JS Window Actors. r=NeilDeakin
authorMike Conley <mconley@mozilla.com>
Wed, 01 May 2019 20:05:06 +0000
changeset 530973 52b38a9f7f8f663e5a3862bf88bcbd5711651d7e
parent 530972 83eece97230e06f4b83940dc862a35e20c836532
child 530974 e5cca993c39d3f074d1d36d02ce95afeedf6a8ce
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin
bugs1533955
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533955 - Move the current message manager actors to a legacy list, and create a new list of JS Window Actors. r=NeilDeakin Differential Revision: https://phabricator.services.mozilla.com/D29237
browser/components/BrowserGlue.jsm
toolkit/modules/ActorManagerParent.jsm
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -11,16 +11,19 @@ const {Services} = ChromeUtils.import("r
 const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 ChromeUtils.defineModuleGetter(this, "ActorManagerParent",
                                "resource://gre/modules/ActorManagerParent.jsm");
 
 const PREF_PDFJS_ENABLED_CACHE_STATE = "pdfjs.enabledCache.state";
 
 let ACTORS = {
+};
+
+let LEGACY_ACTORS = {
   AboutReader: {
     child: {
       module: "resource:///actors/AboutReaderChild.jsm",
       group: "browsers",
       events: {
         "AboutReaderContentLoaded": {wantUntrusted: true},
         "DOMContentLoaded": {},
         "pageshow": {mozSystemGroup: true},
@@ -937,16 +940,17 @@ BrowserGlue.prototype = {
     os.addObserver(this, "restart-in-safe-mode");
     os.addObserver(this, "flash-plugin-hang");
     os.addObserver(this, "xpi-signature-changed");
     os.addObserver(this, "sync-ui-state:update");
     os.addObserver(this, "handlersvc-store-initialized");
     os.addObserver(this, "shield-init-complete");
 
     ActorManagerParent.addActors(ACTORS);
+    ActorManagerParent.addLegacyActors(LEGACY_ACTORS);
     ActorManagerParent.flush();
 
     this._flashHangCount = 0;
     this._firstWindowReady = new Promise(resolve => this._firstWindowLoaded = resolve);
     if (AppConstants.platform == "win") {
       JawsScreenReaderVersionCheck.init();
     }
   },
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -19,35 +19,35 @@
  * actors as necessary.
  *
  *
  * Each actor is a class which lives in a JSM, and has a constructor which takes
  * a single message manager argument. Each actor may conceptually have both
  * Child and Parent variants, but only Child variants are currently implemented.
  * The parent and child variants live in separate JSMs, and have separate class
  * names, each of which have Child or Parent appended to their names, as
- * appropriate. For instance, the Browser actor has a child instance named
- * BrowserChild which lives in BrowserChild.jsm.
+ * appropriate. For instance, the AudioPlayback actor has a child instance named
+ * AudioPlaybackChild which lives in AudioPlaybackChild.jsm.
  *
  *
  * Actors are defined by calling ActorManagerParent.addActors, with an object
  * containing a property for each actor being defined, whose value is an object
  * describing how the actor should be loaded. That object may have the following
  * properties:
  *
  * - "child": The actor definition for the child side of the actor.
  *
  * Each "child" (or "parent", when it is implemented) actor definition may
  * contain the following properties:
  *
  * - "module": The URI from which the modules is loaded. This should be a
  *   resource: URI, ideally beginning with "resource://gre/actors/" or
  *   "resource:///actors/", with a filename matching the name of the actor for
- *   the given side. So, the child side of the Browser actor should live at
- *   "resource://gre/actors/BrowserChild.jsm".
+ *   the given side. So, the child side of the AudioPlayback actor should live at
+ *   "resource://gre/actors/AudioPlaybackChild.jsm".
  *
  * - "group": A group name which restricts the message managers to which this
  *   actor may be attached. This should match the "messagemanagergroup"
  *   attribute of a <browser> element. Frame scripts are responsible for
  *   attaching the appropriate actors to the appropriate browsers using
  *   ActorManagerChild.attach().
  *
  * - "events": An object containing a property for each event the actor will
@@ -96,16 +96,19 @@
 var EXPORTED_SYMBOLS = ["ActorManagerParent"];
 
 const {ExtensionUtils} = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const {DefaultMap} = ExtensionUtils;
 
 let ACTORS = {
+};
+
+let LEGACY_ACTORS = {
   AudioPlayback: {
     child: {
       module: "resource://gre/actors/AudioPlaybackChild.jsm",
       messages: [
         "AudioPlayback",
       ],
       observers: [
         "audio-playback",
@@ -413,16 +416,22 @@ var ActorManagerParent = {
 
   // Singleton actor sets, which should be loaded only for documents which match
   // a specific pattern. The keys in this map are plain objects specifying
   // filter keys as understood by MozDocumentMatcher.
   singletons: new DefaultMap(() => new ActorSet(null, "Child")),
 
   addActors(actors) {
     for (let [actorName, actor] of Object.entries(actors)) {
+      ChromeUtils.registerWindowActor(actorName, actor);
+    }
+  },
+
+  addLegacyActors(actors) {
+    for (let [actorName, actor] of Object.entries(actors)) {
       let {child} = actor;
       {
         let actorSet;
         if (child.matches || child.allFrames) {
           actorSet = this.singletons.get({matches: child.matches || ["<all_urls>"],
                                           allFrames: child.allFrames,
                                           matchAboutBlank: child.matchAboutBlank});
         } else {
@@ -450,8 +459,9 @@ var ActorManagerParent = {
     for (let [name, data] of this.childGroups) {
       sharedData.set(`ChildActors:${name || ""}`, data);
     }
     sharedData.set("ChildSingletonActors", this.singletons);
   },
 };
 
 ActorManagerParent.addActors(ACTORS);
+ActorManagerParent.addLegacyActors(LEGACY_ACTORS);