Bug 746048 - Alarm service should ignore alarms on added and modified items outside the alarm search range. r=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Tue, 17 Apr 2012 22:21:30 -0400
changeset 11658 a73bde329a9fcf55080b2dc7d551aa1478be6201
parent 11657 85ab1c6c78aa08a8587fca9d02c98eb6e7cd6ef7
child 11659 56ea15c0e0a2577b0ce969eecc0dbb8ffdcb1509
push id529
push userbugzilla@standard8.plus.com
push dateMon, 04 Jun 2012 19:55:55 +0000
treeherdercomm-beta@109334822255 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs746048
Bug 746048 - Alarm service should ignore alarms on added and modified items outside the alarm search range. r=philipp
calendar/base/src/calAlarmService.js
--- a/calendar/base/src/calAlarmService.js
+++ b/calendar/base/src/calAlarmService.js
@@ -443,25 +443,25 @@ calAlarmService.prototype = {
         this.mObservers.notify("onRemoveAlarmsByItem", [aItem]);
         // Purge alarms specifically for this item (i.e exception)
         for each (let alarm in aItem.getAlarms({})) {
             this.removeTimer(aItem, alarm);
         }
     },
 
     getOccurrencesInRange: function cAS_getOccurrencesInRange(aItem) {
+        // We search 1 month in each direction for alarms.  Therefore,
+        // we need occurrences between initial start date and 1 month from now
+        let until = nowUTC();
+        until.month += 1;
+
         if (aItem && aItem.recurrenceInfo) {
-            // We search 1 month in each direction for alarms.  Therefore,
-            // we need occurrences between initial start date and 1 month from now
-            let until = nowUTC();
-            until.month += 1;
-
             return aItem.recurrenceInfo.getOccurrences(this.mRangeStart, until, 0, {});
         } else {
-            return [aItem];
+            return cal.checkIfInRange(aItem, this.mRangeStart, until) ? [aItem] : [];
         }
     },
 
     addAlarmsForOccurrences: function cAS_addAlarmsForOccurrences(aParentItem) {
         let occs = this.getOccurrencesInRange(aParentItem);
 
         // Add an alarm for each occurrence
         occs.forEach(this.addAlarmsForItem, this);