author | Gene Lian <clian@mozilla.com> |
Tue, 17 Jul 2012 18:38:24 +0800 | |
changeset 100293 | 44e8a79e4be3d8cebe4f57b21ad7bdb066d33cae |
parent 100292 | 51a7bf2b46f181de6b658ec9e845d6d8d2080667 |
child 100294 | de032906bb686eed9b1d0f537a45b777cf188916 |
push id | 23175 |
push user | emorley@mozilla.com |
push date | Wed, 25 Jul 2012 15:03:49 +0000 |
treeherder | mozilla-central@75d16b99e8ab [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | fabrice |
bugs | 772369 |
milestone | 17.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/alarm/AlarmService.jsm | file | annotate | diff | comparison | revisions | |
dom/alarm/AlarmsManager.js | file | annotate | diff | comparison | revisions |
--- a/dom/alarm/AlarmService.jsm +++ b/dom/alarm/AlarmService.jsm @@ -223,34 +223,34 @@ let AlarmService = { ppmm.sendAsyncMessage("AlarmsManager:" + aMessageName, json); }, _onAlarmFired: function _onAlarmFired() { debug("_onAlarmFired()"); if (this._currentAlarm) { debug("Fire system intent: " + JSON.stringify(this._currentAlarm)); - if (this._currentAlarm.manifestURL) - messenger.sendMessage("alarm", this._currentAlarm, this._currentAlarm.manifestURL); + let manifestURI = Services.io.newURI(this._currentAlarm.manifestURL, null, null); + messenger.sendMessage("alarm", this._currentAlarm, manifestURI); this._currentAlarm = null; } // reset the next alarm from the queue let nowTime = Date.now(); let alarmQueue = this._alarmQueue; while (alarmQueue.length > 0) { let nextAlarm = alarmQueue.shift(); let nextAlarmTime = this._getAlarmTime(nextAlarm); // if the next alarm has been expired, directly // fire system intent for it instead of setting it if (nextAlarmTime <= nowTime) { debug("Fire system intent: " + JSON.stringify(nextAlarm)); - if (nextAlarm.manifestURL) - messenger.sendMessage("alarm", nextAlarm, nextAlarm.manifestURL); + let manifestURI = Services.io.newURI(nextAlarm.manifestURL, null, null); + messenger.sendMessage("alarm", nextAlarm, manifestURI); } else { this._currentAlarm = nextAlarm; break; } } this._debugCurrentAlarm(); },
--- a/dom/alarm/AlarmsManager.js +++ b/dom/alarm/AlarmsManager.js @@ -40,16 +40,21 @@ AlarmsManager.prototype = { contractID: ALARMSMANAGER_CONTRACTID, classDescription: "AlarmsManager", interfaces: [nsIDOMMozAlarmsManager], flags: nsIClassInfo.DOM_OBJECT }), add: function add(aDate, aRespectTimezone, aData) { debug("add()"); + if (!this._manifestURL) { + debug("Cannot add alarms for non-installed apps."); + throw Components.results.NS_ERROR_FAILURE; + } + let isIgnoreTimezone = true; switch (aRespectTimezone) { case "honorTimezone": isIgnoreTimezone = false; break; case "ignoreTimezone": isIgnoreTimezone = true; @@ -145,18 +150,17 @@ AlarmsManager.prototype = { this._cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender); // Add the valid messages to be listened. this.initHelper(aWindow, ["AlarmsManager:Add:Return:OK", "AlarmsManager:Add:Return:KO", "AlarmsManager:GetAll:Return:OK", "AlarmsManager:GetAll:Return:KO"]); // Get the manifest URL if this is an installed app this._manifestURL = null; - let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindowUtils); + let utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); let app = utils.getApp(); if (app) this._manifestURL = app.manifestURL; }, // Called from DOMRequestIpcHelper. uninit: function uninit() { debug("uninit()");