Fix bug 492640 - Fix misc js warnings. r=ssitter
authorDaniel Boelzle [:dbo] <mozilla@boelzle.org>
Wed, 20 May 2009 18:54:13 +0200
changeset 2670 3a1af5262d96407fb89d80032e5afb50eebf098c
parent 2669 b73fde72e2073b59fe1f9bfde7384e96705fb04e
child 2671 82a2160a9e64e952875e16c58d223b8463483018
push idunknown
push userunknown
push dateunknown
reviewersssitter
bugs492640
Fix bug 492640 - Fix misc js warnings. r=ssitter
calendar/base/content/agenda-listbox.js
calendar/base/content/calendar-base-view.xml
calendar/base/content/widgets/calendar-list-tree.xml
calendar/base/content/widgets/minimonth.xml
calendar/base/src/calCalendarManager.js
calendar/lightning/content/lightning-scripts.inc
calendar/providers/storage/calStorageCalendar.js
--- a/calendar/base/content/agenda-listbox.js
+++ b/calendar/base/content/agenda-listbox.js
@@ -348,29 +348,28 @@ agendaListbox.addItem =
 function addItem(aItem) {
     if (!isEvent(aItem)) {
         return null;
     }
     var periods = this.findPeriodsForItem(aItem);
     if (periods.length == 0) {
         return null;
     }
+    let newlistItem = null;
     for (var i = 0; i < periods.length; i++) {
-        period = periods[i];
-        var complistItem = period.listItem;
-        var visible = complistItem.getCheckbox().checked;
-        var newlistItem = null;
+        let period = periods[i];
+        let complistItem = period.listItem;
+        let visible = complistItem.getCheckbox().checked;
         if ((aItem.startDate.isDate) && (period.duration == 1)) {
             if (this.getListItems(aItem, period).length == 0) {
                 this.addItemBefore(aItem, period.listItem.nextSibling, period, visible);
             }
         } else {
             do {
-                var prevlistItem = complistItem;
-                var complistItem = complistItem.nextSibling;
+                complistItem = complistItem.nextSibling;
                 if (!this.isEventListItem(complistItem)) {
                     newlistItem = this.addItemBefore(aItem, complistItem, period, visible);
                     break;
                 } else {
                     var compitem = complistItem.occurrence;
                     if (this.isSameEvent(aItem, compitem)) {
                         // The same event occurs on several calendars but we only
                         // display the first one.
@@ -427,20 +426,20 @@ agendaListbox.getListItems =
 function getListItems(aItem, aPeriod) {
     var retlistItems = new Array();
     var periods = [aPeriod];
     if (!aPeriod) {
         var periods = this.findPeriodsForItem(aItem);
     }
     if (periods.length > 0) {
         for (var i = 0; i < periods.length; i++) {
-            period = periods[i];
-            var complistItem = period.listItem;
+            let period = periods[i];
+            let complistItem = period.listItem;
             do {
-                var complistItem = complistItem.nextSibling;
+                complistItem = complistItem.nextSibling;
                 var leaveloop = (!this.isEventListItem(complistItem));
                 if (!leaveloop) {
                     if (this.isSameEvent(aItem, complistItem.occurrence)){
                         retlistItems.push(complistItem);
                         break;
                     }
                 }
             } while (!leaveloop)
--- a/calendar/base/content/calendar-base-view.xml
+++ b/calendar/base/content/calendar-base-view.xml
@@ -590,17 +590,17 @@
         ]]></body>
       </method>
 
       <method name="getLongWeekdayTotalPixels">
         <body><![CDATA[
           if (this.mLongWeekdayTotalPixels <= 0) {
               let maxDayWidth = 0;
               for each(label in this.labeldaybox.childNodes) {
-                  if (label.localName == "calendar-day-label") {
+                  if (label.localName == "calendar-day-label") { // xxx todo Warning: reference to undefined property label.localName
                       label.shortWeekNames = false;
                       let curPixelLength = label.getLongWeekdayPixels();
                       maxDayWidth = Math.max(maxDayWidth, curPixelLength);
                   }
               }
               this.mLongWeekdayTotalPixels = (maxDayWidth * this.labeldaybox.childNodes.length) + 10;
           }
           return this.mLongWeekdayTotalPixels;
--- a/calendar/base/content/widgets/calendar-list-tree.xml
+++ b/calendar/base/content/widgets/calendar-list-tree.xml
@@ -109,17 +109,17 @@
                 composite.addCalendar(aCalendar);
             }
         },
 
         onCalendarUnregistering: function cMO_onCalendarUnregistering(aCalendar) {
             this.listTree.removeCalendar(aCalendar);
         },
 
-        onCalendarDeleting: function cMO_onCalendarDeleting(aCalendar) { },
+        onCalendarDeleting: function cMO_onCalendarDeleting(aCalendar) { }
       })
       ]]></field>
       <field name="compositeObserver"><![CDATA[
       ({ listTree: this,
 
         QueryInterface: function cO_QueryInterface(aIID) {
             if (!aIID.equals(Components.interfaces.calICompositeObserver) &&
                 !aIID.equals(Components.interfaces.calIObserver) &&
--- a/calendar/base/content/widgets/minimonth.xml
+++ b/calendar/base/content/widgets/minimonth.xml
@@ -432,18 +432,18 @@
     <implementation implements="calICompositeObserver calIOperationListener nsIObserver" >
       <property name="value"
                 onget="return this.mValue"
                 onset="this.update(val)"/>
 
        <!--returns the first (inclusive) date of the minimonth as a calIDateTime object-->
       <property name="firstDate" readonly="true">
         <getter><![CDATA[
-            var calbox = document.getAnonymousElementByAttribute(this, "anonid", "minimonth-calendar");
-            date = calbox.childNodes[1].firstChild.date;
+            let calbox = document.getAnonymousElementByAttribute(this, "anonid", "minimonth-calendar");
+            let date = calbox.childNodes[1].firstChild.date;
             return jsDateToDateTime(date);
         ]]></getter>
       </property>
 
        <!--returns the last (exclusive) date of the minimonth as a calIDateTime object-->
       <property name="lastDate" readonly="true">
         <getter><![CDATA[
             var calbox = document.getAnonymousElementByAttribute(this, "anonid", "minimonth-calendar");
@@ -879,17 +879,17 @@
       </method>
 
       <method name="getBoxForDate">
         <parameter name="aJsDate"/>
         <body><![CDATA[
             var ymd = aJsDate.getFullYear() + "-" +
                       aJsDate.getMonth() + "-" +
                       aJsDate.getDate();
-            return this.mDayMap[ymd];
+            return this.mDayMap[ymd] || null;
         ]]></body>
       </method>
 
       <method name="resetAttributesForDate">
         <parameter name="aDate"/>
         <body><![CDATA[
             function removeForBox(aBox) {
               var allowedAttributes = 0;
--- a/calendar/base/src/calCalendarManager.js
+++ b/calendar/base/src/calCalendarManager.js
@@ -763,18 +763,18 @@ calCalendarManager.prototype = {
                         calendar = new calDummyCalendar(ctype);
                         calendar.id = id;
                         calendar.uri = uri;
                         // try to enable on next startup if calendar has been enabled:
                         if (!calendar.getProperty("disabled")) {
                             calendar.setProperty("auto-enabled", true);
                         }
                         calendar.setProperty("disabled", true);
-                     }
- 
+                    }
+
                     this.setupCalendar(calendar);
                 } catch (exc) {
                     cal.ERROR("Can't create calendar for " + id + " (" + ctype + ", " + curi + "): " + exc);
                 }
             }
 
             // do refreshing in a second step, when *all* calendars are already available
             // via getCalendars():
--- a/calendar/lightning/content/lightning-scripts.inc
+++ b/calendar/lightning/content/lightning-scripts.inc
@@ -40,17 +40,16 @@
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK ***** -->
 
 <script type="application/javascript" src="chrome://lightning/content/lightning-utils.js"/>
 <script type="application/javascript" src="chrome://lightning/content/messenger-overlay-sidebar.js"/>
 <script type="application/javascript" src="chrome://lightning/content/messenger-overlay-toolbar.js"/>
-<script type="application/javascript" src="chrome://lightning/content/lightning-common-sets.js"/>
 <script type="application/javascript" src="chrome://calendar/content/calendar-invitations-manager.js"/>
 <script type="application/javascript">
     var calendarmenulabel = "&lightning.calendar.label;";
     var calendarmenuaccesskey = "&lightning.calendar.accesskey;";
     var messagemenulabel = "&msgMenu.label;";
     var messagemenuaccesskey = "&msgMenu.accesskey;";
     var tasksmenulabel = "&lightning.tasks.label;";
     var tasksmenuaccesskey = "&lightning.tasks.accesskey;";
--- a/calendar/providers/storage/calStorageCalendar.js
+++ b/calendar/providers/storage/calStorageCalendar.js
@@ -215,16 +215,17 @@ function calStorageTimezone(comp) {
 calStorageTimezone.prototype = {
     toString: function() {
         return this.icalComponent.toString();
     }
 };
 var gForeignTimezonesCache = {};
 
 function getTimezone(aTimezone) {
+    let tz = null;
     if (aTimezone.indexOf("BEGIN:VTIMEZONE") == 0) {
         tz = gForeignTimezonesCache[aTimezone]; // using full definition as key
         if (!tz) {
             try {
                 // cannot cope without parent VCALENDAR:
                 var comp = getIcsService().parseICS("BEGIN:VCALENDAR\n" + aTimezone + "\nEND:VCALENDAR", null);
                 tz = new calStorageTimezone(comp.getFirstSubcomponent("VTIMEZONE"));
                 gForeignTimezonesCache[aTimezone] = tz;
@@ -1922,17 +1923,17 @@ calStorageCalendar.prototype = {
 
     assureRecurringItemCaches: function stor_assureRecurringItemCaches() {
         if (this.mRecItemCacheInited) {
             return;
         }
         // build up recurring event and todo cache, because we need that on every query:
         // for recurring items, we need to query database-wide.. yuck
 
-        sp = this.mSelectEventsWithRecurrence.params;
+        let sp = this.mSelectEventsWithRecurrence.params;
         try {
             while (this.mSelectEventsWithRecurrence.step()) {
                 var row = this.mSelectEventsWithRecurrence.row;
                 var item = this.getEventFromRow(row, {});
                 this.mRecEventCache[item.id] = item;
             }
         } catch (e) {
             cal.ERROR("Error selecting events with recurrence!\n" + e +