Backed out changeset 0cd289fcea16 (bug 876936) for failing in test_alarm_add_date.html

This commit is contained in:
Ed Morley 2013-06-04 09:37:38 +01:00
parent 286c6df2aa
commit 7181ea0687
2 changed files with 9 additions and 3 deletions

View File

@ -394,6 +394,13 @@ this.AlarmService = {
}
aNewAlarm['timezoneOffset'] = this._currentTimezoneOffset;
let aNewAlarmTime = this._getAlarmTime(aNewAlarm);
if (aNewAlarmTime <= Date.now()) {
debug("Adding a alarm that has past time.");
this._debugCurrentAlarm();
aErrorCb("InvalidStateError");
return;
}
this._db.add(
aNewAlarm,
@ -417,7 +424,6 @@ this.AlarmService = {
// If the new alarm is earlier than the current alarm, swap them and
// push the previous alarm back to queue.
let alarmQueue = this._alarmQueue;
let aNewAlarmTime = this._getAlarmTime(aNewAlarm);
let currentAlarmTime = this._getAlarmTime(this._currentAlarm);
if (aNewAlarmTime < currentAlarmTime) {
alarmQueue.unshift(this._currentAlarm);

View File

@ -57,11 +57,11 @@
domRequest.onsuccess = function(e) {
navigator.mozAlarms.remove(e.target.result);
ok(true, "Should be able to add alarm for already past date, which should fire immediately.");
ok(false, "Should not be able to add alarm for already past date.");
testNull();
};
domRequest.onerror = function(e) {
ok(false, "Unable to add alarm for yesterday.");
ok(true, "Can't use past date when adding new alarm.");
// Errors as it should, on to the next test
testNull();