From 90b68f9d4e96da04367c9c5002e974903f7803d5 Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Thu, 20 Mar 2014 09:20:12 -0400 Subject: [PATCH] Bug 980682 - Ensure mozAlarms doesn't throw on chrome documents and fix alarms set on non-index.html pages. r=gene --- dom/alarm/AlarmsManager.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dom/alarm/AlarmsManager.js b/dom/alarm/AlarmsManager.js index c62ed3fa1fe7..56821ddb7b52 100644 --- a/dom/alarm/AlarmsManager.js +++ b/dom/alarm/AlarmsManager.js @@ -168,6 +168,12 @@ AlarmsManager.prototype = { 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"] .getService(Ci.nsISyncMessageSender); @@ -180,7 +186,7 @@ AlarmsManager.prototype = { // Get the manifest URL if this is an installed app let appsService = Cc["@mozilla.org/AppsService;1"] .getService(Ci.nsIAppsService); - this._pageURL = aWindow.location.href; + this._pageURL = principal.URI.spec; this._manifestURL = appsService.getManifestURLByLocalId(principal.appId); this._window = aWindow; },