Bug 1274146 part 1 - Use Services.els instead of loading event listener service manually. r?gijs
MozReview-Commit-ID: 7eqVOM9Zn5p
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -76,17 +76,17 @@ addEventListener("pageshow", function(ev
});
addEventListener("DOMAutoComplete", function(event) {
LoginManagerContent.onUsernameInput(event);
});
addEventListener("blur", function(event) {
LoginManagerContent.onUsernameInput(event);
});
-var handleContentContextMenu = function (event) {
+Services.els.addSystemEventListener(global, "contextmenu", function(event) {
let defaultPrevented = event.defaultPrevented;
if (!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")) {
let plugin = null;
try {
plugin = event.target.QueryInterface(Ci.nsIObjectLoadingContent);
} catch (e) {}
if (plugin && plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN) {
// Don't open a context menu for plugins.
@@ -204,21 +204,17 @@ var handleContentContextMenu = function
contentType: contentType,
contentDisposition: contentDisposition,
selectionInfo: selectionInfo,
disableSetDesktopBackground: disableSetDesktopBg,
loginFillInfo,
parentAllowsMixedContent,
};
}
-}
-
-Cc["@mozilla.org/eventlistenerservice;1"]
- .getService(Ci.nsIEventListenerService)
- .addSystemEventListener(global, "contextmenu", handleContentContextMenu, false);
+}, false);
// Values for telemtery bins: see TLS_ERROR_REPORT_UI in Histograms.json
const TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN = 0;
const TLS_ERROR_REPORT_TELEMETRY_EXPANDED = 1;
const TLS_ERROR_REPORT_TELEMETRY_SUCCESS = 6;
const TLS_ERROR_REPORT_TELEMETRY_FAILURE = 7;
const SEC_ERROR_BASE = Ci.nsINSSErrorsService.NSS_SEC_ERROR_BASE;
@@ -403,19 +399,17 @@ var AboutNetAndCertErrorListener = {
}
}
AboutNetAndCertErrorListener.init(this);
var ClickEventHandler = {
init: function init() {
- Cc["@mozilla.org/eventlistenerservice;1"]
- .getService(Ci.nsIEventListenerService)
- .addSystemEventListener(global, "click", this, true);
+ Services.els.addSystemEventListener(global, "click", this, true);
},
handleEvent: function(event) {
if (!event.isTrusted || event.defaultPrevented || event.button == 2) {
return;
}
let originalTarget = event.originalTarget;