diff --git a/dom/push/src/Push.js b/dom/push/src/Push.js index 9ef41aef4576..4486820d58ac 100644 --- a/dom/push/src/Push.js +++ b/dom/push/src/Push.js @@ -41,9 +41,6 @@ Push.prototype = { init: function(aWindow) { debug("init()"); - if (!Services.prefs.getBoolPref("services.push.enabled")) - return null; - let principal = aWindow.document.nodePrincipal; this._pageURL = principal.URI; @@ -52,13 +49,19 @@ Push.prototype = { .getService(Ci.nsIAppsService); this._app = appsService.getAppByLocalId(principal.appId); this._manifestURL = appsService.getManifestURLByLocalId(principal.appId); - if (!this._manifestURL) - return null; + if (!this._manifestURL) { + // Now what? XXXbz should this be tested in a Func for this + // interface so it wouldn't appear at all? + return; + } let perm = Services.perms.testExactPermissionFromPrincipal(principal, "push"); - if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) - return null; + if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) { + // Now what? XXXbz should this be tested in a Func for this + // interface so it wouldn't appear at all? + return; + } this.initDOMRequestHelper(aWindow, [ "PushService:Register:OK", @@ -71,8 +74,6 @@ Push.prototype = { this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] .getService(Ci.nsISyncMessageSender); - - var self = this; }, receiveMessage: function(aMessage) { diff --git a/dom/webidl/PushManager.webidl b/dom/webidl/PushManager.webidl index 6877b4e02fd0..facf3a31c873 100644 --- a/dom/webidl/PushManager.webidl +++ b/dom/webidl/PushManager.webidl @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -[NoInterfaceObject, NavigatorProperty="push", JSImplementation="@mozilla.org/push/PushManager;1"] +[NoInterfaceObject, NavigatorProperty="push", JSImplementation="@mozilla.org/push/PushManager;1", Pref="services.push.enabled"] interface PushManager { DOMRequest register(); DOMRequest unregister(DOMString pushEndpoint);