зеркало из https://github.com/mozilla/gecko-dev.git
Bug 707564 followup #2. Make the push code actually follow the contract for JS-implemented webidl in an attempt to reopen the CLOSED TREE. r=khuey
This commit is contained in:
Родитель
87c6485b2e
Коммит
bed367b9a1
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче