Bug 772369 - Alarm API (Follow-Up Fix for System Message Integration). r=fabrice

This commit is contained in:
Gene Lian 2012-07-17 18:38:24 +08:00
Родитель 688a8caad5
Коммит ce1a64ab3b
2 изменённых файлов: 10 добавлений и 6 удалений

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

@ -228,8 +228,8 @@ let AlarmService = {
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;
}
@ -244,8 +244,8 @@ let AlarmService = {
// 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;

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

@ -45,6 +45,11 @@ AlarmsManager.prototype = {
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":
@ -150,8 +155,7 @@ AlarmsManager.prototype = {
// 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;