Comment 1 for bug 638197

Revision history for this message
Holger Goetz (holgerg) wrote : Re: Events don't load due to js error

Hi,

Think this is calendar content dependent. It doesn't happen if it's "Day" view and you press the "today" - but in all other views in my calendar it happens.

Looked at the code around the offending line in soapin.js bit closer -

The nextOccurrence is calculated from the previousOccurrence if there's a difference. There are cases when there's no PrevisousOccurrence available thus the code is ending up w/ a nextOcc==null.

Could it be that the nextOccAlarm.compare call does only return "0" or "1" - and not "-1" or "0" or "1" ??
At least there isn't a check if a previous occurrence does exist at all.

Adding a "if (nextOcc === null) { }" the call to aItem.setproperty avoids the error and make things work better.

Not sure if that's really the root cause here, but maybe a point to start looking further into it.

--------- code from soapin.js - readDismissSnoozeState proc-----------

let alarmDiff = nextOccAlarm.compare(nextRem);
if (alarmDiff > 0) {
  sdbg("readDismissSnoozeState: alarmDiff>0\n");
  /*
  * The alarm of the next item will happen after
  * the remider time. This means we did snooze
  * a previous alarm.
  */
  nextOcc = aItem.recurrenceInfo.getPreviousOccurrence(nextRem);
}

if (nextOcc === null) {
  // would lead to an error otherwise
  sdbg("readDismissSnoozeState: dkipping Set X-MOZ-SNOOZE-TIME\n");
  return
} else {
  aItem.setProperty('X-MOZ-SNOOZE-TIME-' + nextOcc.recurrenceId.nativeTime, nextRem.icalString);
}