Bug 1280898 - Set up eslint for calendar files - enable spaced-comment rule. r?MakeMyDay
authoreslint <eslint@bugzilla.kewis.ch>
Fri, 08 Jul 2016 11:18:57 +0200
changeset 25950 7b2fedd2dee96487ec5dde6c89617429e3737dc6
parent 25949 239f769da6b375beb31a149046382429f59af6ae
child 25951 d4ec82bf6586d090cd8a7e43ac7ade112ee732f4
push id1771
push userclokep@gmail.com
push dateMon, 14 Nov 2016 17:47:53 +0000
treeherdercomm-beta@399ae9d71595 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay
bugs1280898
Bug 1280898 - Set up eslint for calendar files - enable spaced-comment rule. r?MakeMyDay MozReview-Commit-ID: 3RNMzhvfNtO
calendar/.eslintrc
calendar/base/content/calendar-base-view.xml
calendar/base/content/calendar-item-bindings.xml
calendar/base/content/calendar-multiday-view.xml
calendar/base/content/calendar-task-tree.xml
calendar/base/content/calendar-unifinder.js
calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
calendar/base/content/dialogs/calendar-print-dialog.js
calendar/base/content/widgets/calendar-widgets.xml
calendar/base/modules/calRecurrenceUtils.jsm
calendar/base/src/calCachedCalendar.js
calendar/base/src/calCalendarManager.js
calendar/base/src/calFilter.js
calendar/base/src/calIcsParser.js
calendar/base/src/calItemBase.js
calendar/base/src/calTimezoneService.js
calendar/base/src/calUtils.js
calendar/import-export/calOutlookCSVImportExport.js
calendar/providers/ics/calICSCalendar.js
calendar/providers/memory/calMemoryCalendar.js
calendar/providers/storage/calStorageCalendar.js
calendar/providers/storage/calStorageUpgrade.jsm
calendar/providers/wcap/calWcapCalendar.js
calendar/providers/wcap/calWcapErrors.js
calendar/resources/content/datetimepickers/datetimepickers.xml
calendar/resources/content/publishDialog.js
calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
calendar/test/unit/test_items.js
calendar/test/unit/test_recur.js
calendar/test/unit/test_timezone_definition.js
--- a/calendar/.eslintrc
+++ b/calendar/.eslintrc
@@ -116,16 +116,19 @@
     "no-octal-escape": 2,
 
     // disallow use of void operator
     "no-void": 2,
 
     // Disallow Yoda conditions (where literal value comes first).
     "yoda": 2,
 
+    // Require a space immediately following the // in a line comment.
+    "spaced-comment": [2, "always"],
+
     // Will enable these rules later
     "keyword-spacing": 0,
     "block-spacing": 0,
     "no-lonely-if": 0,
     "space-before-blocks": 0,
     "computed-property-spacing": 0,
     "consistent-return": 0,
     "no-redeclare": 0,
--- a/calendar/base/content/calendar-base-view.xml
+++ b/calendar/base/content/calendar-base-view.xml
@@ -637,17 +637,17 @@
                case "calendar.week.d6saturdaysoff":
                    this.updateDaysOffPrefs();
                    break;
                case "calendar.timezone.local":
                    this.timezone = calendarDefaultTimezone();
                    this.refreshView();
                    break;
                case "calendar.alarms.indicator.show":
-                   //Break here to ensure the view is refreshed
+                   // Break here to ensure the view is refreshed
                    break;
                case "calendar.week.start":
                    this.weekStartOffset = aSubject.getIntPref(aPreference);
                    break;
                case "calendar.date.format":
                    this.refreshView();
                    break;
                default:
--- a/calendar/base/content/calendar-item-bindings.xml
+++ b/calendar/base/content/calendar-item-bindings.xml
@@ -46,17 +46,16 @@
         ]]></getter>
         <setter><![CDATA[
           this.mItem = val;
           let headerLabel = document.getAnonymousElementByAttribute(this, "anonid", "item-datetime-label");
           let itemDateTimeLabel = document.getAnonymousElementByAttribute(this, "anonid", "item-datetime-value");
           let date;
           if (this.mode == "start") {
               date = this.mItem[calGetStartDateProp(this.mItem)];
-              //this.mItem.startDate || this.mItem.entryDate;
               if (date) {
                   let label;
                   if (isToDo(this.mItem)) {
                       label = this.getAttribute("taskStartLabel");
                   } else {
                       label = this.getAttribute("eventStartLabel");
                   }
                   headerLabel.value = label;
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -90,22 +90,20 @@
       </method>
 
       <property name="pixelsPerMinute"
         onget="return this.mPixPerMin"
         onset="if (this.mPixPerMin != val) { this.mPixPerMin = val; this.relayout(); } return val;"/>
 
       <method name="relayout">
         <body><![CDATA[
-          //dump ("calendar-time-bar: relayout\n");
           var topbox = document.getAnonymousElementByAttribute(this, "anonid", "topbox");
           var orient = topbox.getAttribute("orient");
           var otherorient = getOtherOrientation(orient);
 
-          //dump ("calendar-time-bar: orient: " + orient + " other: " + otherorient + "\n");
 
           function makeTimeBox(timestr, size) {
               var box = createXULElement("box");
               box.setAttribute("orient", orient);
 
               if (orient == "horizontal") {
                   box.setAttribute("width", size);
               } else {
@@ -334,17 +332,16 @@
       <property name="date">
         <getter><![CDATA[
           return this.mDate;
         ]]></getter>
         <setter><![CDATA[
           this.mDate = val;
 
           if (!compareObjects(val.timezone, this.mTimezone)) {
-              //dump ("++ column tz: " + val.timezone + "\n");
               this.mTimezone = val.timezone;
               if (!this.mLayoutBatchCount) {
                   this.recalculateStartEndMinutes();
               }
           }
 
           return val;
         ]]></setter>
--- a/calendar/base/content/calendar-task-tree.xml
+++ b/calendar/base/content/calendar-task-tree.xml
@@ -1157,25 +1157,25 @@
           var bo = obo.treeBody.boxObject;
           var sel= tree.view.selection;
 
           var rowX = bo.x;
           var rowY = bo.y;
           var rowHeight = obo.rowHeight;
           var rowWidth = bo.width;
 
-          //add a rectangle for each visible selected row
+          // add a rectangle for each visible selected row
           for (var i = obo.getFirstVisibleRow(); i <= obo.getLastVisibleRow(); i ++) {
             if (sel.isSelected(i)) {
               region.unionRect(rowX, rowY, rowWidth, rowHeight);
             }
             rowY = rowY + rowHeight;
           }
 
-          //and finally, clip the result to be sure we don't spill over...
+          // and finally, clip the result to be sure we don't spill over...
           if (!region.isEmpty()) {
             region.intersectRect(bo.x, bo.y, bo.width, bo.height);
           }
         } catch(ex) {
           ASSERT(false, "Error while building selection region: " + ex + "\n");
           region = null;
         }
         invokeEventDragSession(item, event.target);
--- a/calendar/base/content/calendar-unifinder.js
+++ b/calendar/base/content/calendar-unifinder.js
@@ -760,17 +760,17 @@ var unifinderTreeView = {
             case "title":
                 return (calendarEvent.title ? calendarEvent.title.replace(/\n/g, ' ') : "");
             case "startDate":
                 return formatUnifinderEventDateTime(calendarEvent.startDate);
 
             case "endDate":
                 let eventEndDate = calendarEvent.endDate.clone();
                 // XXX reimplement
-                //let eventEndDate = getCurrentNextOrPreviousRecurrence(calendarEvent);
+                // let eventEndDate = getCurrentNextOrPreviousRecurrence(calendarEvent);
                 if (calendarEvent.startDate.isDate) {
                     // display enddate is ical enddate - 1
                     eventEndDate.day = eventEndDate.day - 1;
                 }
                 return formatUnifinderEventDateTime(eventEndDate);
 
             case "categories":
                 return calendarEvent.getCategories({}).join(", ");
--- a/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
+++ b/calendar/base/content/dialogs/calendar-event-dialog-attendees.xml
@@ -338,18 +338,16 @@
                   input.setAttribute("id", "attendeeCol3#" + rowNumber);
               }
 
               input.value = null;
               input.removeAttribute("value");
               input.attendee = newAttendee;
 
               // set role and participation status
-              //status.setAttribute("status", newAttendee.participationStatus);
-              //role.setAttribute("role", newAttendee.role);
               roleStatusIcon.setAttribute("class", "role-icon");
               roleStatusIcon.setAttribute("role", "REQ-PARTICIPANT");
               userTypeIcon.setAttribute("cutype", "INDIVIDUAL");
 
               // Set tooltip for rolenames and usertype icon
               this.updateTooltip(roleStatusIcon);
               this.updateTooltip(userTypeIcon);
 
@@ -390,17 +388,17 @@
               // the inputfield already has a reference to the attendee
               // object, we just need to fill in the name.
               let attendee = inputField.attendee.clone();
               if (attendee.isOrganizer) {
                   continue;
               }
 
               attendee.role = this.getRoleElement(i).getAttribute("role");
-              //attendee.participationStatus = this.getStatusElement(i).getAttribute("status");
+              // attendee.participationStatus = this.getStatusElement(i).getAttribute("status");
               let userType = this.getUserTypeElement(i).getAttribute("cutype");
               attendee.userType = (userType == "INDIVIDUAL" ? null : userType) // INDIVIDUAL is the default
 
               // break the list of potentially many attendees back into individual names. This
               // is required in case the user entered comma-separated attendees in one field and
               // then clicked OK without switching to the next line.
               let parsedInput = MailServices.headerParser.makeFromDisplayAddress(inputField.value);
               let j = 0;
@@ -433,17 +431,17 @@
               } else if (inputField.value == "") {
                   continue;
               }
 
               // The inputfield already has a reference to the attendee
               // object, we just need to fill in the name.
               let attendee = inputField.attendee.clone();
 
-              //attendee.role = this.getRoleElement(i).getAttribute("role");
+              // attendee.role = this.getRoleElement(i).getAttribute("role");
               attendee.participationStatus = this.getStatusElement(i).getAttribute("status");
               // Organizers do not have a CUTYPE
               attendee.userType = null;
 
               // break the list of potentially many attendees back into individual names
               let parsedInput = MailServices.headerParser.makeFromDisplayAddress(inputField.value);
               if (parsedInput[0].email > 0) {
                   attendee.id = cal.prependMailTo(parsedInput[0].email);
--- a/calendar/base/content/dialogs/calendar-print-dialog.js
+++ b/calendar/base/content/dialogs/calendar-print-dialog.js
@@ -79,17 +79,17 @@ function getPrintSettings(receiverFunc) 
     settings.eventList = [];
     settings.printEvents = document.getElementById("events").checked;
     settings.printTasks = document.getElementById("tasks").checked;
     settings.printCompletedTasks = document.getElementById("completed-tasks").checked;
     settings.printTasksWithNoDueDate = document.getElementById("tasks-with-no-due-date").checked;
     var theView = getCalendarView();
     switch (document.getElementById("view-field").selectedItem.value) {
     case 'currentView':
-    case '': //just in case
+    case '': // just in case
         settings.start = theView.startDay.clone();
         settings.end = theView.endDay.clone();
         settings.end.day += 1;
         settings.start.isDate = false;
         settings.end.isDate = false;
         break;
     case 'selected': {
         let selectedItems = theView.getSelectedItems({});
--- a/calendar/base/content/widgets/calendar-widgets.xml
+++ b/calendar/base/content/widgets/calendar-widgets.xml
@@ -680,17 +680,17 @@
          }
 
          session.getData(transfer, 0);
          let flavor = {};
          let data = {};
          // nsITransferable sucks when it comes to trying to add extra flavors.
          // This will throw NS_ERROR_FAILURE, so as a workaround, we use the
          // sourceNode property and get the event that way
-         //transfer.getAnyTransferData(flavor, data, {});
+         //   transfer.getAnyTransferData(flavor, data, {});
 
          item = session.sourceNode.sourceObject;
          let newItem = this.onDropItem(item).clone();
          let newStart = newItem.startDate || newItem.entryDate || newItem.dueDate;
          let newEnd = newItem.endDate || newItem.dueDate || newItem.entryDate;
          let offset = this.calendarView.mShadowOffset;
          newStart.addDuration(offset);
          newEnd.addDuration(offset);
--- a/calendar/base/modules/calRecurrenceUtils.jsm
+++ b/calendar/base/modules/calRecurrenceUtils.jsm
@@ -49,22 +49,22 @@ function recurrenceRule2String(recurrenc
     recurrenceInfo = recurrenceInfo.clone();
     let rrules = splitRecurrenceRules(recurrenceInfo);
     if (rrules[0].length == 1) {
         let rule = cal.wrapInstance(rrules[0][0], Components.interfaces.calIRecurrenceRule);
         // Currently we allow only for BYDAY, BYMONTHDAY, BYMONTH rules.
         if (rule &&
             !checkRecurrenceRule(rule, ['BYSECOND',
                                         'BYMINUTE',
-                                        //'BYDAY',
+                                        // 'BYDAY',
                                         'BYHOUR',
-                                        //'BYMONTHDAY',
+                                        // 'BYMONTHDAY',
                                         'BYYEARDAY',
                                         'BYWEEKNO',
-                                        //'BYMONTH',
+                                        // 'BYMONTH',
                                         'BYSETPOS'])) {
             let dateFormatter = cal.getDateFormatter();
             let ruleString;
             if (rule.type == 'DAILY') {
                 if (checkRecurrenceRule(rule, ['BYDAY'])) {
                     let days = rule.getComponent("BYDAY", {});
                     let weekdays = [2, 3, 4, 5, 6];
                     if (weekdays.length == days.length) {
--- a/calendar/base/src/calCachedCalendar.js
+++ b/calendar/base/src/calCachedCalendar.js
@@ -458,17 +458,17 @@ calCachedCalendar.prototype = {
         if (aNewState) {
             // Going offline: (XXX get items before going offline?) => we may ask the user to stay online a bit longer
         } else {
             // Going online (start replaying changes to the remote calendar)
             this.refresh();
         }
     },
 
-    //aOldItem is already in the cache
+    // aOldItem is already in the cache
     promptOverwrite: function cCC_promptOverwrite(aMethod, aItem, aListener, aOldItem) {
         let overwrite = cal.promptOverwrite(aMethod, aItem, aListener, aOldItem);
         if (overwrite) {
             if (aMethod == "modify") {
                 this.modifyOfflineItem(aItem, aOldItem, aListener);
             } else {
                 this.deleteOfflineItem(aItem, aListener);
             }
--- a/calendar/base/src/calCalendarManager.js
+++ b/calendar/base/src/calCalendarManager.js
@@ -327,17 +327,16 @@ calCalendarManager.prototype = {
         storageSdb.append("storage.sdb");
         let db = Services.storage.openDatabase(storageSdb);
 
         db.beginTransactionAs(Components.interfaces.mozIStorageConnection.TRANSACTION_EXCLUSIVE);
         try {
             if (db.tableExists("cal_calendars_prefs")) {
                 // Check if we need to upgrade:
                 let version = this.getSchemaVersion(db);
-                //cal.LOG("*** Calendar schema version is: " + version);
                 if (version < DB_SCHEMA_VERSION) {
                     this.upgradeDB(version, db);
                 }
 
                 this.migrateDB(db);
 
                 db.executeSimpleSQL("DROP TABLE cal_calendars; " +
                                     "DROP TABLE cal_calendars_prefs; " +
--- a/calendar/base/src/calFilter.js
+++ b/calendar/base/src/calFilter.js
@@ -349,17 +349,17 @@ calFilter.prototype = {
         }
 
         let searchText = this.mFilterText.toLowerCase();
 
         if (!searchText.length || searchText.match(/^\s*$/)) {
             return true;
         }
 
-        //XXX TODO: Support specifying which fields to search on
+        // TODO: Support specifying which fields to search on
         for (let field of ["SUMMARY", "DESCRIPTION", "LOCATION", "URL"]) {
             let val = aItem.getProperty(field);
             if (val && val.toLowerCase().includes(searchText)) {
                 return true;
             }
         }
 
         return aItem.getCategories({}).some(function(cat) {
--- a/calendar/base/src/calIcsParser.js
+++ b/calendar/base/src/calIcsParser.js
@@ -172,32 +172,32 @@ calIcsParser.prototype = {
         unicodeConverter.charset = "UTF-8";
         let stringData = unicodeConverter.convertFromByteArray(octetArray, octetArray.length);
 
         this.parseString(stringData, aTzProvider, aAsyncParsing);
     },
 
     getItems: function ip_getItems(aCount) {
         aCount.value = this.mItems.length;
-        return this.mItems.concat([]); //clone
+        return this.mItems.concat([]);
     },
 
     getParentlessItems: function ip_getParentlessItems(aCount) {
         aCount.value = this.mParentlessItems.length;
-        return this.mParentlessItems.concat([]); //clone
+        return this.mParentlessItems.concat([]);
     },
 
     getProperties: function ip_getProperties(aCount) {
         aCount.value = this.mProperties.length;
-        return this.mProperties.concat([]); //clone
+        return this.mProperties.concat([]);
     },
 
     getComponents: function ip_getComponents(aCount) {
         aCount.value = this.mComponents.length;
-        return this.mComponents.concat([]); //clone
+        return this.mComponents.concat([]);
     }
 };
 
 /**
  * The parser state, which helps process ical components without clogging up the
  * event queue.
  *
  * @param aParser       The parser that is using this state
--- a/calendar/base/src/calItemBase.js
+++ b/calendar/base/src/calItemBase.js
@@ -453,19 +453,19 @@ calItemBase.prototype = {
     //                              in AString aParameterName);
     hasPropertyParameter: function cIB_hasPropertyParameter(aPropName, aParamName) {
         let propName = aPropName.toUpperCase();
         let paramName = aParamName.toUpperCase();
         return ((propName in this.mPropertyParams) &&
                 (paramName in this.mPropertyParams[propName]));
     },
 
-    //void setPropertyParameter(in AString aPropertyName,
-    //                          in AString aParameterName,
-    //                          in AUTF8String aParameterValue);
+    // void setPropertyParameter(in AString aPropertyName,
+    //                           in AString aParameterName,
+    //                           in AUTF8String aParameterValue);
     setPropertyParameter: function cIB_setPropertyParameter(aPropName, aParamName, aParamValue) {
         let propName = aPropName.toUpperCase();
         let paramName = aParamName.toUpperCase();
         this.modify();
         if (!(propName in this.mPropertyParams)) {
             if (!this.hasProperty(propName)) {
                 throw "Property " + aPropName + " not set";
             } else {
--- a/calendar/base/src/calTimezoneService.js
+++ b/calendar/base/src/calTimezoneService.js
@@ -481,17 +481,17 @@ function guessSystemTimezone() {
                         continue; // period ends too early
                     }
                 } // else forever rule
             } // else no daylight rule
 
             // found period that covers today.
             if (!isForNextTransitionDate) {
                 return period;
-            } else /*isForNextTranstionDate*/ {
+            } else {
                 if (todayUTC.nativeTime < periodStartCalDate.nativeTime) {
                     // already know periodStartCalDate < oneYr from now,
                     // and transitions are at most once per year, so it is next.
                     return cal.dateTimeToJsDate(periodStartCalDate);
                 } else if (rrule) {
                     // find next occurrence after today
                     periodCalRule.icalProperty = rrule;
                     var nextTransitionDate =
--- a/calendar/base/src/calUtils.js
+++ b/calendar/base/src/calUtils.js
@@ -89,25 +89,25 @@ function getWeekInfoService() {
 }
 
 /* Shortcut to date formatter service */
 function getDateFormatter() {
     return Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
                      .getService(Components.interfaces.calIDateTimeFormatter);
 }
 
-/// @return the UTC timezone.
+// @return the UTC timezone.
 function UTC() {
     if (UTC.mObject === undefined) {
         UTC.mObject = getTimezoneService().UTC;
     }
     return UTC.mObject;
 }
 
-/// @return the floating timezone.
+// @return the floating timezone.
 function floating() {
     if (floating.mObject === undefined) {
         floating.mObject = getTimezoneService().floating;
     }
     return floating.mObject;
 }
 
 /**
@@ -887,19 +887,20 @@ function setDefaultStartEndHour(aItem, a
     aItem[calGetStartDateProp(aItem)] = getDefaultStartDate(aReferenceDate);
 
     if (isEvent(aItem)) {
         aItem.endDate = aItem.startDate.clone();
         aItem.endDate.minute += Preferences.get("calendar.event.defaultlength", 60);
     }
 }
 
-/****
- **** debug code
- ****/
+/**
+ * Helper used in the following log functions to actually log the message.
+ * Should not be used outside of this file.
+ */
 function _log(message, flag) {
     let frame = Components.stack.caller.caller;
     let filename = frame.filename ? frame.filename.split(" -> ").pop() : null;
     let scriptError = Components.classes["@mozilla.org/scripterror;1"]
                                 .createInstance(Components.interfaces.nsIScriptError);
     scriptError.init(message, filename, null, frame.lineNumber, frame.columnNumber,
                      flag, "component javascript");
     Services.console.logMessage(scriptError);
@@ -1165,23 +1166,23 @@ function calInterfaceBag(iid) {
 }
 calInterfaceBag.prototype = {
     mIid: null,
     mInterfaces: null,
 
     // Iterating the inteface bag iterates the interfaces it contains
     [Symbol.iterator]: function() { return this.mInterfaces[Symbol.iterator](); },
 
-    /// internal:
+    // internal:
     init: function calInterfaceBag_init(iid) {
         this.mIid = iid;
         this.mInterfaces = [];
     },
 
-    /// external:
+    // external:
     get size() {
         return this.mInterfaces.length;
     },
 
     get interfaceArray() {
         return this.mInterfaces;
     },
 
--- a/calendar/import-export/calOutlookCSVImportExport.js
+++ b/calendar/import-export/calOutlookCSVImportExport.js
@@ -134,21 +134,21 @@ calOutlookCSVImporter.prototype = {
         let trimEndQuotesRegExp = /^"(.*)"$/m;
         let trimResults = trimEndQuotesRegExp.exec( str );
         let header = trimResults && trimResults[1].split(/","/);
         if (header == null) {
             aCount.value = 0;
             return [];
         }
 
-        //strip header from string
+        // strip header from string
         str = str.slice(trimResults[0].length);
 
         let args = {};
-        //args.fieldList contains the field names from the first row of CSV
+        // args.fieldList contains the field names from the first row of CSV
         args.fieldList = header;
 
         let locale;
         let i;
         let knownIndxs;
         for (i in locales) {
             locale = locales[i];
             knownIndxs = 0;
@@ -352,34 +352,34 @@ calOutlookCSVImporter.prototype = {
                 }
                 if ("locationIndex" in args) {
                     txt = this.parseTextField(eventFields[args.locationIndex])
                     if (txt) {
                         event.setProperty("LOCATION", txt);
                     }
                 }
 
-                //save the event into return array
+                // save the event into return array
                 eventArray.push(event);
             }
 
-            //get next events fields
+            // get next events fields
             eventFields = eventRegExp.exec(str);
 
         } while (eventRegExp.lastIndex != 0);
 
         // return results
         aCount.value = eventArray.length;
         return eventArray;
     },
 
     parseDateTime: function parseDateTime(aDate, aTime, aLocale) {
         let dt = cal.createDateTime();
 
-        //XXX Can we do better?
+        // XXX Can we do better?
         dt.timezone = cal.floating();
 
         let rd = aLocale.dateRe.exec(aDate);
         let rt = aLocale.timeRe.exec(aTime);
 
         if (!rd || !rt) {
             return null;
         }
--- a/calendar/providers/ics/calICSCalendar.js
+++ b/calendar/providers/ics/calICSCalendar.js
@@ -869,17 +869,17 @@ calICSObserver.prototype = {
     },
 
     onError: function(aCalendar, aErrNo, aMessage) {
         this.mCalendar.readOnly = true;
         this.mCalendar.notifyError(aErrNo, aMessage);
     }
 };
 
-/***************************
+/*
  * Transport Abstraction Hooks
  *
  * Those hooks provide a way to do checks before or after publishing an
  * ics file. The main use will be to check etags (or some other way to check
  * for remote changes) to protect remote changes from being overwritten.
  *
  * Different protocols need different checks (webdav can do etag, but
  * local files need last-modified stamps), hence different hooks for each
--- a/calendar/providers/memory/calMemoryCalendar.js
+++ b/calendar/providers/memory/calMemoryCalendar.js
@@ -122,33 +122,35 @@ calMemoryCalendar.prototype = {
             this.notifyOperationComplete(aListener,
                                          Components.results.NS_ERROR_FAILURE,
                                          Components.interfaces.calIOperationListener.ADD,
                                          aItem.id,
                                          "Can't set ID on non-mutable item to addItem");
             return;
         }
 
-        //Lines below are commented because of the offline bug 380060
-        //Memory Calendar cannot assume that a new item should not have an ID.
-        //calCachedCalendar could send over an item with an id.
+        // Lines below are commented because of the offline bug 380060, the
+        // memory calendar cannot assume that a new item should not have an ID.
+        // calCachedCalendar could send over an item with an id.
 
-        /*if (this.mItems[aItem.id] != null) {
+        /*
+        if (this.mItems[aItem.id] != null) {
             if (this.relaxedMode) {
                 // we possibly want to interact with the user before deleting
                 delete this.mItems[aItem.id];
             } else {
                 this.notifyOperationComplete(aListener,
                                              Components.interfaces.calIErrors.DUPLICATE_ID,
                                              Components.interfaces.calIOperationListener.ADD,
                                              aItem.id,
                                              "ID already exists for addItem");
                 return;
             }
-        }*/
+        }
+        */
 
         let parentItem = aItem.parentItem;
         if (parentItem != aItem) {
             parentItem = parentItem.clone();
             parentItem.recurrenceInfo.modifyException(aItem, true);
         }
         parentItem.calendar = this.superCalendar;
 
--- a/calendar/providers/storage/calStorageCalendar.js
+++ b/calendar/providers/storage/calStorageCalendar.js
@@ -665,17 +665,16 @@ calStorageCalendar.prototype = {
         let this_ = this;
         cal.postPone(function() {
             this_.getItems_(aItemFilter, aCount, aRangeStart, aRangeEnd, aListener);
         });
     },
     getItems_: function cSC_getItems_(aItemFilter, aCount,
                                       aRangeStart, aRangeEnd, aListener)
     {
-        //var profStartTime = Date.now();
         if (!aListener) {
             return;
         }
 
         let self = this;
 
         let itemsFound = [];
         let startTime = -0x7fffffffffffffff;
@@ -752,25 +751,21 @@ calStorageCalendar.prototype = {
                 queuedItemsIID = theIID;
             }
 
             if (theItems) {
                 queuedItems = queuedItems.concat(theItems);
             }
 
             if (queuedItems.length != 0 && (!theItems || queuedItems.length > maxQueueSize)) {
-                //var listenerStart = Date.now();
                 aListener.onGetResult(self.superCalendar,
                                       Components.results.NS_OK,
                                       queuedItemsIID, null,
                                       queuedItems.length, queuedItems);
-                //var listenerEnd = Date.now();
-                //dump ("++++ listener callback took: " + (listenerEnd - listenerStart) + " ms\n");
-
-                queuedItems = [ ];
+                queuedItems = [];
             }
         }
 
         // helper function to handle converting a row to an item,
         // expanding occurrences, and queue the items for the listener
         function handleResultItem(item, theIID, optionalFilterFunc) {
             let expandedItems = [];
             if (item.recurrenceInfo && asOccurrences) {
@@ -946,18 +941,16 @@ calStorageCalendar.prototype = {
 
         // and finish
         this.notifyOperationComplete(aListener,
                                      Components.results.NS_OK,
                                      Components.interfaces.calIOperationListener.GET,
                                      null,
                                      null);
 
-        //var profEndTime = Date.now();
-        //dump ("++++ getItems took: " + (profEndTime - profStartTime) + " ms\n");
     },
 
     getItemOfflineFlag: function cSC_getOfflineJournalFlag(aItem, aListener) {
         let flag = null;
         if (!aItem) {
             // It is possible that aItem can be null, flag provided should be null in this case
             aListener.onOperationComplete(this, Components.results.NS_OK,
                                                Components.interfaces.calIOperationListener.GET, null, flag);
@@ -1359,17 +1352,17 @@ calStorageCalendar.prototype = {
                 + " (cal_id, item_id, value)"
                 + " VALUES (:cal_id, :item_id, :value)");
 
             this.mInsertAlarm = this.mDB.createStatement(
                 "INSERT INTO cal_alarms " +
                 "  (cal_id, item_id, icalString, recurrence_id, recurrence_id_tz) " +
                 "VALUES  (:cal_id, :item_id, :icalString, :recurrence_id, :recurrence_id_tz)  "
                 );
-            //Offline Operations
+            // Offline Operations
             this.mEditEventOfflineFlag = this.mDB.createStatement(
                 "UPDATE cal_events SET offline_journal = :offline_journal" +
                 " WHERE id = :id AND cal_id = :cal_id"
             );
 
             this.mEditTodoOfflineFlag = this.mDB.createStatement(
                 "UPDATE cal_todos SET offline_journal = :offline_journal" +
                 " WHERE id = :id AND cal_id = :cal_id"
@@ -1798,32 +1791,32 @@ calStorageCalendar.prototype = {
             let rec = item.recurrenceInfo;
 
             if (cal.isEvent(item)) {
                 this.mSelectEventExceptions.params.id = item.id;
                 this.prepareStatement(this.mSelectEventExceptions);
                 try {
                     while (this.mSelectEventExceptions.executeStep()) {
                         let row = this.mSelectEventExceptions.row;
-                        let exc = this.getEventFromRow(row, {}, true /*isException*/);
+                        let exc = this.getEventFromRow(row, {}, true /* isException */);
                         rec.modifyException(exc, true);
                     }
                 } catch (e) {
                     this.logError("Error getting exceptions for event '" +
                                   item.title + "' (" + item.id + ")!", e);
                 } finally {
                     this.mSelectEventExceptions.reset();
                 }
             } else if (cal.isToDo(item)) {
                 this.mSelectTodoExceptions.params.id = item.id;
                 this.prepareStatement(this.mSelectTodoExceptions);
                 try {
                     while (this.mSelectTodoExceptions.executeStep()) {
                         let row = this.mSelectTodoExceptions.row;
-                        let exc = this.getTodoFromRow(row, {}, true /*isException*/);
+                        let exc = this.getTodoFromRow(row, {}, true /* isException */);
                         rec.modifyException(exc, true);
                     }
                 } catch (e) {
                     this.logError("Error getting exceptions for task '" +
                                   item.title + "' (" + item.id + ")!", e);
                 } finally {
                     this.mSelectTodoExceptions.reset();
                 }
--- a/calendar/providers/storage/calStorageUpgrade.jsm
+++ b/calendar/providers/storage/calStorageUpgrade.jsm
@@ -1345,17 +1345,17 @@ upgrade.v19 = function upgrade_v19(db, v
  * Setting a offline_journal column in cal_events tables
  * r=philipp, p=redDragon
  */
 upgrade.v20 = function upgrade_v20(db, version) {
     let tbl = upgrade.v19(version < 19 && db, version);
     LOGdb(db, "Storage: Upgrading to v20");
     beginTransaction(db);
     try {
-        //Adding a offline_journal column
+        // Adding a offline_journal column
         for (let tblName of ["cal_events", "cal_todos"]) {
             addColumn(tbl, tblName, ["offline_journal"], "INTEGER", db);
         }
         setDbVersionAndCommit(db, 20);
     } catch (e) {
         throw reportErrorAndRollback(db, e);
     }
     return tbl;
--- a/calendar/providers/wcap/calWcapCalendar.js
+++ b/calendar/providers/wcap/calWcapCalendar.js
@@ -1,16 +1,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Components.utils.import("resource://calendar/modules/calUtils.jsm");
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-function calWcapCalendar(/*optional*/session, /*optional*/calProps) {
+/**
+ * The calendar provider class for WCAP calendars. Usually instanciated through
+ * the calendar manager, but may also be created by the wcap session, hence the
+ * following optional parameters.
+ *
+ * @param session       (optional) The calWcapSession for this calendar
+ * @param calProps      (optional) The XML node containing the WCAP calendar properties
+ */
+function calWcapCalendar(session, calProps) {
     this.initProviderBase();
     this.m_session = session;
     this.m_calProps = calProps;
 }
 var calWcapCalendarClassID = Components.ID("{cf4d93e5-af79-451a-95f3-109055b32ef0}");
 var calWcapCalendarInterfaces = [
     calIWcapCalendar,
     calICalendar,
--- a/calendar/providers/wcap/calWcapErrors.js
+++ b/calendar/providers/wcap/calWcapErrors.js
@@ -63,47 +63,47 @@ var g_nsNetErrorCodes = [
     NS_BINDING_FAILED,
     "The async request failed for some unknown reason.",
     NS_BINDING_ABORTED,
     "The async request failed because it was aborted by some user action.",
     NS_BINDING_REDIRECTED,
     "The async request has been redirected to a different async request.",
     NS_BINDING_RETARGETED,
     "The async request has been retargeted to a different handler.",
-    /*NS_ERROR_MALFORMED_URI*/ generateNetFailure(10),
+    /* NS_ERROR_MALFORMED_URI */ generateNetFailure(10),
     "The URI is malformed.",
-    /*NS_ERROR_UNKNOWN_PROTOCOL*/ generateNetFailure(18),
+    /* NS_ERROR_UNKNOWN_PROTOCOL */ generateNetFailure(18),
     "The URI scheme corresponds to an unknown protocol handler.",
-    /*NS_ERROR_CONNECTION_REFUSED*/ generateNetFailure(13),
+    /* NS_ERROR_CONNECTION_REFUSED */ generateNetFailure(13),
     "The connection attempt failed, for example, because no server was listening at specified host:port.",
-    /*NS_ERROR_PROXY_CONNECTION_REFUSED*/ generateNetFailure(72),
+    /* NS_ERROR_PROXY_CONNECTION_REFUSED */ generateNetFailure(72),
     "The connection attempt to a proxy failed.",
-    /*NS_ERROR_NET_TIMEOUT*/ generateNetFailure(14),
+    /* NS_ERROR_NET_TIMEOUT */ generateNetFailure(14),
     "The connection was lost due to a timeout error.",
     NS_ERROR_OFFLINE,
     "The requested action could not be completed while the networking library is in the offline state.",
-    /*NS_ERROR_PORT_ACCESS_NOT_ALLOWED*/ generateNetFailure(19),
+    /* NS_ERROR_PORT_ACCESS_NOT_ALLOWED */ generateNetFailure(19),
     "The requested action was prohibited because it would have caused the networking library to establish a connection to an unsafe or otherwise banned port.",
-    /*NS_ERROR_NET_RESET*/ generateNetFailure(20),
+    /* NS_ERROR_NET_RESET */ generateNetFailure(20),
     "The connection was established, but no data was ever received.",
-    /*NS_ERROR_NET_INTERRUPT*/ generateNetFailure(71),
+    /* NS_ERROR_NET_INTERRUPT */ generateNetFailure(71),
     "The connection was established, but the data transfer was interrupted.",
-    /*NS_ERROR_NOT_RESUMABLE*/ generateNetFailure(25),
+    /* NS_ERROR_NOT_RESUMABLE */ generateNetFailure(25),
     "This request is not resumable, but it was tried to resume it, or to request resume-specific data.",
-    /*NS_ERROR_ENTITY_CHANGED*/ generateNetFailure(32),
+    /* NS_ERROR_ENTITY_CHANGED */ generateNetFailure(32),
     "It was attempted to resume the request, but the entity has changed in the meantime.",
-    /*NS_ERROR_REDIRECT_LOOP*/ generateNetFailure(31),
+    /* NS_ERROR_REDIRECT_LOOP */ generateNetFailure(31),
     "The request failed as a result of a detected redirection loop.",
-    /*NS_ERROR_UNKNOWN_HOST*/ generateNetFailure(30),
+    /* NS_ERROR_UNKNOWN_HOST */ generateNetFailure(30),
     "The lookup of a hostname failed. This generally refers to the hostname from the URL being loaded.",
-    /*NS_ERROR_UNKNOWN_PROXY_HOST*/ generateNetFailure(42),
+    /* NS_ERROR_UNKNOWN_PROXY_HOST */ generateNetFailure(42),
     "The lookup of a proxy hostname failed.",
-    /*NS_ERROR_UNKNOWN_SOCKET_TYPE*/ generateNetFailure(51),
+    /* NS_ERROR_UNKNOWN_SOCKET_TYPE */ generateNetFailure(51),
     "The specified socket type does not exist.",
-    /*NS_ERROR_SOCKET_CREATE_FAILED*/ generateNetFailure(52),
+    /* NS_ERROR_SOCKET_CREATE_FAILED */ generateNetFailure(52),
     "The specified socket type could not be created."
     ];
 
 function netErrorToString(rc) {
     if (!isNaN(rc) && getErrorModule(rc) == NS_ERROR_MODULE_NETWORK) {
         var i = 0;
         while (i < g_nsNetErrorCodes.length) {
             // however rc is kept unsigned, our generated code signed,
--- a/calendar/resources/content/datetimepickers/datetimepickers.xml
+++ b/calendar/resources/content/datetimepickers/datetimepickers.xml
@@ -1663,17 +1663,17 @@
                 if (time != null) {
                   hours = time.getHours();
                   minutes = time.getMinutes();
                   seconds = time.getSeconds();
                   this.mLastDateParseIncludedTime = true;
                 }
               }
               tempDate = new Date(year, month, day, hours, minutes, seconds, 0);
-            } //else did not match regex, not a valid date
+            } // else did not match regex, not a valid date
             return tempDate;
           ]]>
         </body>
       </method>
 
       <!-- Parse a variety of time formats so that cut and paste is likely to work.
            separator:            ':'         '.'        ' '        symbol        none
                                  "12:34:56"  "12.34.56" "12 34 56" "12h34m56s"   "123456"
--- a/calendar/resources/content/publishDialog.js
+++ b/calendar/resources/content/publishDialog.js
@@ -1,30 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-
-
-/*-----------------------------------------------------------------
-*   W I N D O W      V A R I A B L E S
-*/
-
-
 var gOnOkFunction;   // function to be called when user clicks OK
 var gPublishObject;
 
-/*-----------------------------------------------------------------
-*   W I N D O W      F U N C T I O N S
-*/
-
 /**
 *   Called when the dialog is loaded.
 */
-
 function loadCalendarPublishDialog()
 {
    // Get arguments, see description at top of file
 
    var args = window.arguments[0];
 
    gOnOkFunction = args.onOk;
 
--- a/calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
+++ b/calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
@@ -130,18 +130,16 @@ var testEventDialogModificationPrompt = 
     md.start(handleSavePrompt);
     event.keypress(undefined, "VK_ESCAPE", {});
     controller.sleep(sleep);
     md.stop();
 
     // delete it
     // XXX somehow the event is selected at this point, this didn't use to be the case
     // and can't be reproduced manually
-    /*controller.click(new elementslib.Lookup(controller.window.document,
-      calUtils.getEventBoxPath(controller, "day", calUtils.EVENT_BOX, undefined, 1, 8)));*/
     controller.keypress(new elementslib.ID(controller.window.document, "day-view"),
       "VK_DELETE", {});
     controller.waitForElementNotPresent(new elementslib.Lookup(controller.window.document,
       calUtils.getEventBoxPath(controller, "day", calUtils.EVENT_BOX, undefined, 1, 8)));
   }
 }
 
 var teardownTest = function(module) {
--- a/calendar/test/unit/test_items.js
+++ b/calendar/test/unit/test_items.js
@@ -254,17 +254,17 @@ function test_immutable() {
 
 function test_lastack() {
 
     let e = cal.createEvent();
 
     e.alarmLastAck = cal.createDateTime("20120101T010101");
 
     // Our items don't support this yet
-    //equal(e.getProperty("X-MOZ-LASTACK"), "20120101T010101");
+    //  equal(e.getProperty("X-MOZ-LASTACK"), "20120101T010101");
 
     let comp = e.icalComponent;
     let prop = comp.getFirstProperty("X-MOZ-LASTACK");
 
     equal(prop.value, "20120101T010101Z");
 
     prop.value = "20120101T010102Z";
 
--- a/calendar/test/unit/test_recur.js
+++ b/calendar/test/unit/test_recur.js
@@ -28,17 +28,17 @@ function test_rules() {
         let start = createDate(1990, 0, 1);
         let end = createDate(2020, 0, 1);
         let recdates = event.recurrenceInfo.getOccurrenceDates(start, end, 0, {});
         let occurrences = event.recurrenceInfo.getOccurrences(start, end, 0, {});
 
         // Check number of items
         dump("Expected " + expected.length + " occurrences\n");
         dump("Got: " + recdates.map(x => x.toString()) + "\n");
-        //equal(recdates.length, expected.length);
+        equal(recdates.length, expected.length);
         let fmt = cal.getDateFormatter();
 
         for (let i = 0; i < expected.length; i++) {
             // Check each date
             let ed = cal.createDateTime(expected[i]);
             dump("Expecting instance at " + ed + "(" + fmt.dayName(ed.weekday) + ")\n");
             dump("Recdate:");
             equal(recdates[i].icalString, expected[i]);
--- a/calendar/test/unit/test_timezone_definition.js
+++ b/calendar/test/unit/test_timezone_definition.js
@@ -10,23 +10,23 @@ function run_test() {
  * Checks whether the pased string is a valid tz version number
  * @param    {String}         aVersionString
  * @returns  {boolean}
  */
 function valid_tz_version(aVersionString) {
     return (aVersionString.match(/^2\.(\d{4})(z*[a-z])$/));
 }
 
-//check tz database version
+// check tz database version
 add_task(function* version_test() {
     let tzs = cal.getTimezoneService();
     ok(valid_tz_version(tzs.version), "timezone version");
 });
 
-//check whether all tz definitions have all properties
+// check whether all tz definitions have all properties
 add_task(function* zone_test() {
     function resolveZone(aZoneId) {
         let tz = tzs.getTimezone(aZoneId);
         equal(aZoneId, tz.tzid, "Zone test " + aZoneId);
         ok(tz.icalComponent.serializeToICS().startsWith("BEGIN:VTIMEZONE"),
            "VTIMEZONE test " + aZoneId);
         ok(tz.latitude && !!tz.latitude.match(/^[+-]\d{7}$/), "Latitude test " + aZoneId);
         ok(tz.longitude && !!tz.longitude.match(/^[+-]\d{7}$/), "Longitude test " + aZoneId);