Bug 1472491: Part 5κ - Add ManifestMessagesChild actor. r=mconley
authorKris Maglione <maglione.k@gmail.com>
Mon, 30 Jul 2018 11:39:52 -0700
changeset 486584 1e3e2acebb2c832fbcc04ed64be7b9bb35941b0c
parent 486583 1194a1b4bf239c861da8f8f89ab5e8dacb68848c
child 486585 6e04b88dde43abfeb8a2ee3fe21c561a79f6c1e9
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1472491
milestone63.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 1472491: Part 5κ - Add ManifestMessagesChild actor. r=mconley MozReview-Commit-ID: 20toouW9YzT
browser/base/content/tab-content.js
dom/ipc/ManifestMessages.jsm
dom/ipc/ManifestMessagesChild.jsm
dom/ipc/moz.build
toolkit/modules/ActorManagerParent.jsm
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -20,22 +20,16 @@ ChromeUtils.import("resource://gre/modul
 ActorManagerChild.attach(this, "browsers");
 
 // TabChildGlobal
 var global = this;
 
 XPCOMUtils.defineLazyProxy(this, "LightweightThemeChildHelper",
   "resource:///modules/LightweightThemeChildHelper.jsm");
 
-XPCOMUtils.defineLazyProxy(this, "ManifestMessages", () => {
-  let tmp = {};
-  ChromeUtils.import("resource://gre/modules/ManifestMessages.jsm", tmp);
-  return new tmp.ManifestMessages(global);
-});
-
 let themeablePagesWhitelist = new Set([
   "about:home",
   "about:newtab",
   "about:welcome",
 ]);
 
 addEventListener("pageshow", function({ originalTarget }) {
   if (originalTarget.defaultView == content && themeablePagesWhitelist.has(content.document.documentURI)) {
@@ -87,13 +81,8 @@ Services.obs.notifyObservers(this, "tab-
 
 // Remove this once bug 1397365 is fixed.
 addEventListener("MozAfterPaint", function onFirstNonBlankPaint() {
   if (content.document.documentURI == "about:blank" && !content.opener)
     return;
   removeEventListener("MozAfterPaint", onFirstNonBlankPaint);
   sendAsyncMessage("Browser:FirstNonBlankPaint");
 });
-
-addMessageListener("DOM:WebManifest:hasManifestLink", ManifestMessages);
-addMessageListener("DOM:ManifestObtainer:Obtain", ManifestMessages);
-addMessageListener("DOM:Manifest:FireAppInstalledEvent", ManifestMessages);
-addMessageListener("DOM:WebManifest:fetchIcon", ManifestMessages);
rename from dom/ipc/ManifestMessages.jsm
rename to dom/ipc/ManifestMessagesChild.jsm
--- a/dom/ipc/ManifestMessages.jsm
+++ b/dom/ipc/ManifestMessagesChild.jsm
@@ -8,32 +8,29 @@
  * It searches a top-level browsing context for
  * a <link rel=manifest> element. Then fetches
  * and processes the linked manifest.
  *
  * BUG: https://bugzilla.mozilla.org/show_bug.cgi?id=1083410
  */
 "use strict";
 
-var EXPORTED_SYMBOLS = ["ManifestMessages"];
+var EXPORTED_SYMBOLS = ["ManifestMessagesChild"];
 
+ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 ChromeUtils.defineModuleGetter(this, "ManifestObtainer",
                                "resource://gre/modules/ManifestObtainer.jsm");
 ChromeUtils.defineModuleGetter(this, "ManifestFinder",
                                "resource://gre/modules/ManifestFinder.jsm");
 ChromeUtils.defineModuleGetter(this, "ManifestIcons",
                                "resource://gre/modules/ManifestIcons.jsm");
 
-class ManifestMessages {
-  constructor(mm) {
-    this.mm = mm;
-  }
-
+class ManifestMessagesChild extends ActorChild {
   receiveMessage(message) {
     switch (message.name) {
     case "DOM:WebManifest:hasManifestLink":
       return this.hasManifestLink(message);
     case "DOM:ManifestObtainer:Obtain":
       return this.obtainManifest(message);
     case "DOM:Manifest:FireAppInstalledEvent":
       return this.fireAppInstalledEvent(message);
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -9,17 +9,17 @@ with Files("**"):
 
 XPIDL_SOURCES += [
     'nsIHangReport.idl',
 ]
 
 XPIDL_MODULE = 'dom'
 
 EXTRA_JS_MODULES += [
-    'ManifestMessages.jsm',
+    'ManifestMessagesChild.jsm',
 ]
 
 EXPORTS.mozilla.dom.ipc += [
     'IdType.h',
     'MemMapSnapshot.h',
     'SharedMap.h',
     'SharedMapChangeEvent.h',
     'SharedStringMap.h',
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -135,16 +135,29 @@ let ACTORS = {
     child: {
       module: "resource://gre/actors/FindBarChild.jsm",
       events: {
         "keypress": {mozSystemGroup: true},
       },
     },
   },
 
+  ManifestMessages: {
+    child: {
+      module: "resource://gre/modules/ManifestMessagesChild.jsm",
+      group: "browsers",
+      messages: [
+        "DOM:Manifest:FireAppInstalledEvent",
+        "DOM:ManifestObtainer:Obtain",
+        "DOM:WebManifest:fetchIcon",
+        "DOM:WebManifest:hasManifestLink",
+      ],
+    },
+  },
+
   PopupBlocking: {
     child: {
       module: "resource://gre/actors/PopupBlockingChild.jsm",
       events: {
         "DOMPopupBlocked": {capture: true},
       },
     },
   },