diff --git a/mozilla/calendar/base/content/calendar-views.js b/mozilla/calendar/base/content/calendar-views.js index 5b80c8f160a..43fb3b74482 100644 --- a/mozilla/calendar/base/content/calendar-views.js +++ b/mozilla/calendar/base/content/calendar-views.js @@ -378,6 +378,7 @@ function scheduleMidnightUpdate(aRefreshCallback) { // stuck in an infinite loop. var udCallback = { notify: function(timer) { + LOG("scheduleMidnightUpdate -- timer shot."); aRefreshCallback(); } }; @@ -386,8 +387,17 @@ function scheduleMidnightUpdate(aRefreshCallback) { // Observer for wake after sleep/hibernate/standby to create new timers and refresh UI var wakeObserver = { observe: function(aSubject, aTopic, aData) { + LOG("scheduleMidnightUpdate -- wakeObserver: " + aTopic); if (aTopic == "wake_notification") { - aRefreshCallback(); + // postpone refresh for another couple of seconds to get netwerk ready: + if (this.mTimer) { + this.mTimer.cancel(); + } else { + this.mTimer = Components.classes["@mozilla.org/timer;1"] + .createInstance(Components.interfaces.nsITimer); + } + this.mTimer.initWithCallback(udCallback, 10 * 1000, + Components.interfaces.nsITimer.TYPE_ONE_SHOT); } } }; @@ -402,12 +412,12 @@ function scheduleMidnightUpdate(aRefreshCallback) { function() { observerService.removeObserver(wakeObserver, "wake_notification"); }, false); - gMidnightTimer = Components.classes["@mozilla.org/timer;1"] .createInstance(Components.interfaces.nsITimer); } else { gMidnightTimer.cancel(); } + LOG("scheduleMidnightUpdate -- init timer."); gMidnightTimer.initWithCallback(udCallback, msUntilTomorrow, gMidnightTimer.TYPE_ONE_SHOT); } diff --git a/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js b/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js index 7dce748bd6c..cd9bef3488c 100644 --- a/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js +++ b/mozilla/calendar/lightning/content/messenger-overlay-sidebar.js @@ -295,21 +295,25 @@ function onSelectionChanged(aEvent) { * this for normal refresh, since it also calls scheduleMidnightRefresh. */ function refreshUIBits() { - document.getElementById("ltnMinimonth").refreshDisplay(); + try { + getMinimonth().refreshDisplay(); - // refresh the current view, if it has ever been shown - var cView = currentView(); - if (cView.initialized) { - cView.goToDay(cView.selectedDay); + // refresh the current view, if it has ever been shown + var cView = currentView(); + if (cView.initialized) { + cView.goToDay(cView.selectedDay); + } + + if (!TodayPane.showsToday()) { + TodayPane.setDay(now()); + } + + // update the unifinder + refreshEventTree(); + } catch (exc) { + ASSERT(false, exc); } - if (TodayPane.showsYesterday()) { - TodayPane.setDay(now()); - } - - // update the unifinder - refreshEventTree(); - // schedule our next update... scheduleMidnightUpdate(refreshUIBits); } diff --git a/mozilla/calendar/resources/content/calendar.js b/mozilla/calendar/resources/content/calendar.js index f9c55ba1c3b..4e875018a4c 100644 --- a/mozilla/calendar/resources/content/calendar.js +++ b/mozilla/calendar/resources/content/calendar.js @@ -196,8 +196,12 @@ function handleCommandLine(aComLine) { /* Called at midnight to tell us to update the views and other ui bits */ function refreshUIBits() { - currentView().goToDay(now()); - refreshEventTree(); + try { + currentView().goToDay(now()); + refreshEventTree(); + } catch (exc) { + ASSERT(false, exc); + } // and schedule again... scheduleMidnightUpdate(refreshUIBits);