Backed out changeset 5212e051d039 (bug 1479310) for bc failures on /browser/browser_onboarding_uitour.js.

--HG--
rename : browser/components/uitour/ContentUITour.jsm => browser/components/uitour/content-UITour.js
This commit is contained in:
Brindusan Cristian 2018-08-07 20:49:43 +03:00
parent 90cfc55b47
commit 8c70dfad01
5 changed files with 27 additions and 31 deletions

View file

@ -1319,6 +1319,7 @@ var gBrowserInit = {
let mm = window.getGroupMessageManager("browsers");
mm.loadFrameScript("chrome://browser/content/tab-content.js", true);
mm.loadFrameScript("chrome://browser/content/content.js", true);
mm.loadFrameScript("chrome://browser/content/content-UITour.js", true);
mm.loadFrameScript("chrome://global/content/content-HybridContentTelemetry.js", true);
window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad);

View file

@ -2,18 +2,14 @@
* 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"];
/* eslint-env mozilla/frame-script */
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;
}
var UITourListener = {
handleEvent(event) {
if (!Services.prefs.getBoolPref("browser.uitour.enabled")) {
return;
@ -21,14 +17,14 @@ class UITourListener {
if (!this.ensureTrustedOrigin()) {
return;
}
this.mm.addMessageListener("UITour:SendPageCallback", this);
this.mm.addMessageListener("UITour:SendPageNotification", this);
this.mm.sendAsyncMessage("UITour:onPageEvent", {
addMessageListener("UITour:SendPageCallback", this);
addMessageListener("UITour:SendPageNotification", this);
sendAsyncMessage("UITour:onPageEvent", {
detail: event.detail,
type: event.type,
pageVisibilityState: this.mm.content.document.visibilityState,
pageVisibilityState: content.document.visibilityState,
});
}
},
isTestingOrigin(aURI) {
if (Services.prefs.getPrefType(PREF_TEST_WHITELIST) != Services.prefs.PREF_STRING) {
@ -47,7 +43,7 @@ class UITourListener {
}
}
return false;
}
},
// This function is copied from UITour.jsm.
isSafeScheme(aURI) {
@ -59,11 +55,9 @@ class UITourListener {
return false;
return true;
}
},
ensureTrustedOrigin() {
let {content} = this.mm;
if (content.top != content)
return false;
@ -80,7 +74,7 @@ class UITourListener {
return true;
return this.isTestingOrigin(uri);
}
},
receiveMessage(aMessage) {
switch (aMessage.name) {
@ -91,19 +85,21 @@ class UITourListener {
this.sendPageEvent("Notification", aMessage.data);
break;
}
}
},
sendPageEvent(type, detail) {
if (!this.ensureTrustedOrigin()) {
return;
}
let win = this.mm.content;
let doc = content.document;
let eventName = "mozUITour" + type;
let event = new win.CustomEvent(eventName, {
let event = new doc.defaultView.CustomEvent(eventName, {
bubbles: true,
detail: Cu.cloneInto(detail, win),
detail: Cu.cloneInto(detail, doc.defaultView)
});
win.document.dispatchEvent(event);
doc.dispatchEvent(event);
}
}
};
addEventListener("mozUITour", UITourListener, false, true);

View file

@ -0,0 +1,6 @@
# 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/.
browser.jar:
content/browser/content-UITour.js

View file

@ -3,10 +3,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXTRA_JS_MODULES += [
'ContentUITour.jsm',
'UITour.jsm',
]
JAR_MANIFESTS += ['jar.mn']
BROWSER_CHROME_MANIFESTS += [
'test/browser.ini',
]

View file

@ -37,12 +37,6 @@ XPCOMUtils.defineLazyProxy(this, "PopupBlocking", () => {
return new tmp.PopupBlocking(global);
});
XPCOMUtils.defineLazyProxy(this, "ShieldFrameListener", () => {
let tmp = {};
ChromeUtils.import("resource://normandy-content/ShieldFrameListener.jsm", tmp);
return new tmp.ShieldFrameListener(global);
});
XPCOMUtils.defineLazyProxy(this, "SelectionSourceContent",
"resource://gre/modules/SelectionSourceContent.jsm");
@ -439,5 +433,3 @@ let ExtFind = {
};
ExtFind.init();
addEventListener("ShieldPageEvent", ShieldFrameListener, false, true);