Bug 980682 - Ensure mozAlarms doesn't throw on chrome documents and fix alarms set on non-index.html pages. r=gene

This commit is contained in:
Alexandre Poirot 2014-03-20 09:20:12 -04:00
Родитель ac1bf381e1
Коммит 90b68f9d4e
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -168,6 +168,12 @@ AlarmsManager.prototype = {
return null; return null;
} }
// SystemPrincipal documents do not have any origin.
// Reject them for now.
if (!principal.URI) {
return null;
}
this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
.getService(Ci.nsISyncMessageSender); .getService(Ci.nsISyncMessageSender);
@ -180,7 +186,7 @@ AlarmsManager.prototype = {
// Get the manifest URL if this is an installed app // Get the manifest URL if this is an installed app
let appsService = Cc["@mozilla.org/AppsService;1"] let appsService = Cc["@mozilla.org/AppsService;1"]
.getService(Ci.nsIAppsService); .getService(Ci.nsIAppsService);
this._pageURL = aWindow.location.href; this._pageURL = principal.URI.spec;
this._manifestURL = appsService.getManifestURLByLocalId(principal.appId); this._manifestURL = appsService.getManifestURLByLocalId(principal.appId);
this._window = aWindow; this._window = aWindow;
}, },