Bug 1472491: Part 5γ - Add UITourChild actor. r=MattN
MozReview-Commit-ID: 7Pfu7sSOE1i
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -225,16 +225,26 @@ let ACTORS = {
module: "resource://normandy-content/ShieldFrameChild.jsm",
events: {
"ShieldPageEvent": {wantUntrusted: true},
},
matches: ["about:studies"],
},
},
+ UITour: {
+ child: {
+ module: "resource:///modules/UITourChild.jsm",
+ events: {
+ "mozUITour": {wantUntrusted: true},
+ },
+ permissions: ["uitour"],
+ },
+ },
+
URIFixup: {
child: {
module: "resource:///actors/URIFixupChild.jsm",
group: "browsers",
observers: ["keyword-uri-fixup"],
},
},
};
rename from browser/components/uitour/ContentUITour.jsm
rename to browser/components/uitour/UITourChild.jsm
--- a/browser/components/uitour/ContentUITour.jsm
+++ b/browser/components/uitour/UITourChild.jsm
@@ -1,24 +1,21 @@
/* 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/. */
-var EXPORTED_SYMBOLS = ["UITourListener"];
+var EXPORTED_SYMBOLS = ["UITourChild"];
+ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const PREF_TEST_WHITELIST = "browser.uitour.testingOrigins";
const UITOUR_PERMISSION = "uitour";
-class UITourListener {
- constructor(mm) {
- this.mm = mm;
- }
-
+class UITourChild extends ActorChild {
handleEvent(event) {
if (!Services.prefs.getBoolPref("browser.uitour.enabled")) {
return;
}
if (!this.ensureTrustedOrigin()) {
return;
}
this.mm.addMessageListener("UITour:SendPageCallback", this);
--- a/browser/components/uitour/moz.build
+++ b/browser/components/uitour/moz.build
@@ -1,15 +1,15 @@
# 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/.
EXTRA_JS_MODULES += [
- 'ContentUITour.jsm',
'UITour.jsm',
+ 'UITourChild.jsm',
]
BROWSER_CHROME_MANIFESTS += [
'test/browser.ini',
]
with Files('**'):
BUG_COMPONENT = ('Firefox', 'Tours')
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -19,22 +19,16 @@ ChromeUtils.defineModuleGetter(this, "Au
"resource://gre/modules/AutoScrollController.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "formFill",
"@mozilla.org/satchel/form-fill-controller;1",
"nsIFormFillController");
var global = this;
-XPCOMUtils.defineLazyProxy(this, "UITourListener", () => {
- let tmp = {};
- ChromeUtils.import("resource:///modules/ContentUITour.jsm", tmp);
- return new tmp.UITourListener(global);
-});
-
// Lazily load the finder code
addMessageListener("Finder:Initialize", function() {
let {RemoteFinderListener} = ChromeUtils.import("resource://gre/modules/RemoteFinder.jsm", {});
new RemoteFinderListener(global);
});
var AutoScrollListener = {
handleEvent(event) {
@@ -139,10 +133,8 @@ let AutoComplete = {
this._connected = false;
}
break;
}
},
};
AutoComplete.init();
-
-addEventListener("mozUITour", UITourListener, false, true);