Bug 684582 - Fix a few calendar warningsa=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Thu, 27 Oct 2011 10:44:54 +0200
changeset 8957 177be7c55fd4ecfb416fba0507fddab3839faffb
parent 8956 8898520a1258e32a4883b6fd71453d2255b12d3e
child 8958 359d0ea7f24d6495b9eded00581bde7360a4c0d4
push id207
push usermozilla@kewis.ch
push dateThu, 27 Oct 2011 13:43:58 +0000
treeherdercomm-beta@359d0ea7f24d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs684582
Bug 684582 - Fix a few calendar warningsa=philipp
calendar/base/content/calendar-unifinder.js
calendar/base/content/widgets/calendar-list-tree.xml
calendar/base/src/calAlarmService.js
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/providers/composite/calCompositeCalendar.js
--- a/calendar/base/content/calendar-unifinder.js
+++ b/calendar/base/content/calendar-unifinder.js
@@ -53,16 +53,17 @@
  * This is a hacked in interface to the unifinder. We will need to
  * improve this to make it usable in general.
  *
  * NOTE: Including this file will cause a load handler to be added to the
  * window.
  */
 
 Components.utils.import("resource://calendar/modules/calUtils.jsm");
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 // Set this to true when the calendar event tree is clicked to allow for
 // multiple selection
 var gCalendarEventTreeClicked = false;
 
 // Store the start and enddate, because the providers can't be trusted when
 // dealing with all-day events. So we need to filter later. See bug 306157
 
@@ -429,16 +430,18 @@ function unifinderKeyPress(aEvent) {
             break;
     }
 }
 
 /**
  * Tree controller for unifinder search results
  */
 var unifinderTreeView = {
+    QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsITreeView]),
+
     // Provide a default tree that holds all the functions used here to avoid
     // cludgy if (this.tree) { this.tree.rowCountChanged(...); } constructs.
     tree: {
         rowCountChanged: function() {},
         beginUpdateBatch: function() {},
         endUpdateBatch: function() {},
         invalidate: function() {}
     },
--- a/calendar/base/content/widgets/calendar-list-tree.xml
+++ b/calendar/base/content/widgets/calendar-list-tree.xml
@@ -95,16 +95,18 @@
           throw Components.Exception("Seting calendars on type='full' is not supported",
                                      Components.results.NS_ERROR_NOT_IMPLEMENTED);
         ]]></setter>
       </property>
 
       <field name="calMgrObserver"><![CDATA[
       ({ listTree: this,
 
+        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICalendarManagerObserver]),
+
         // calICalendarManagerObserver
         onCalendarRegistered: function cMO_onCalendarRegistered(aCalendar) {
             this.listTree.addCalendar(aCalendar);
             let composite = this.listTree.compositeCalendar;
             let inComposite = aCalendar.getProperty(composite.prefPrefix +
                                                     "-in-composite");
             if ((inComposite === null) || inComposite) {
                 composite.addCalendar(aCalendar);
@@ -121,24 +123,18 @@
             // enabled/disabled.
             document.commandDispatcher.updateCommands("calendar_commands");
         }
       })
       ]]></field>
       <field name="compositeObserver"><![CDATA[
       ({ listTree: this,
 
-        QueryInterface: function cO_QueryInterface(aIID) {
-            if (!aIID.equals(Components.interfaces.calICompositeObserver) &&
-                !aIID.equals(Components.interfaces.calIObserver) &&
-                !aIID.equals(Components.interfaces.nsISupports)) {
-                throw Components.results.NS_ERROR_NO_INTERFACE;
-            }
-            return this;
-        },
+        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICompositeObserver,
+                                               Components.interfaces.calIObserver]),
 
         // calICompositeObserver
         onCalendarAdded: function onCalendarAdded(aCalendar) {
             // Make sure the checkbox state is updated
             this.listTree.updateCalendar(aCalendar);
         },
 
         onCalendarRemoved: function onCalendarRemoved(aCalendar) {
@@ -260,16 +256,17 @@
       <field name="tree">null</field>
       <field name="treebox">null</field>
       <field name="ruleCache">new Object()</field>
       <field name="mCachedSheet">null</field>
 
 
       <constructor><![CDATA[
         Components.utils.import("resource://calendar/modules/calUtils.jsm");
+        Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
         this.tree.view = this;
       ]]></constructor>
       <destructor><![CDATA[
         // Clean up the calendar manager observers. Do not use removeCalendar
         // here since that will remove the calendar from the composite calendar.
         for each (let calendar in this.mCalendarList) {
             calendar.removeObserver(this.calObserver);
         }
@@ -280,16 +277,18 @@
         if (this.mCompositeCalendar) {
             this.mCompositeCalendar.removeObserver(this.compositeObserver);
         }
       ]]></destructor>
 
       <field name="calObserver"><![CDATA[
       ({ listTree: this,
 
+        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calIObserver]),
+
         // calIObserver. Note that each registered calendar uses this observer
         onStartBatch: function cMO_onStartBatch() { },
         onEndBatch: function cMO_onEndBatch() { },
         onLoad: function cMO_onLoad() { },
 
         onAddItem: function cMO_onAddItem(aItem) { },
         onModifyItem: function cMO_onModifyItem(aNewItem, aOldItem) { },
         onDeleteItem: function cMO_onDeleteItem(aDeletedItem) { },
@@ -324,23 +323,17 @@
             this.onPropertyChanged(aCalendar, aName, null, null);
         }
       })
       ]]></field>
 
       <field name="compositeObserver"><![CDATA[
       ({ listTree: this,
 
-        QueryInterface: function cO_QueryInterface(aIID) {
-            if (!aIID.equals(Components.interfaces.calICompositeObserver) &&
-                !aIID.equals(Components.interfaces.nsISupports)) {
-                throw Components.results.NS_ERROR_NO_INTERFACE;
-            }
-            return this;
-        },
+        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICompositeObserver]),
 
         // calICompositeObserver
         onCalendarAdded: function onCalendarAdded(aCalendar) {
             // Make sure the checkbox state is updated
             this.listTree.updateCalendar(aCalendar);
         },
 
         onCalendarRemoved: function onCalendarRemoved(aCalendar) {
--- a/calendar/base/src/calAlarmService.js
+++ b/calendar/base/src/calAlarmService.js
@@ -36,16 +36,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * 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 ***** */
 
 Components.utils.import("resource://calendar/modules/calUtils.jsm");
 Components.utils.import("resource://calendar/modules/calAlarmUtils.jsm");
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const kHoursBetweenUpdates = 6;
 
 function nowUTC() {
     return jsDateToDateTime(new Date()).getInTimezone(UTC());
 }
 
 function newTimerWithCallback(aCallback, aDelay, aRepeating) {
@@ -63,16 +64,18 @@ function calAlarmService() {
 
     this.mLoadedCalendars = {};
     this.mTimerMap = {};
     this.mObservers = new calListenerBag(Components.interfaces.calIAlarmServiceObserver);
 
     this.calendarObserver = {
         alarmService: this,
 
+        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calIObserver]),
+
         // calIObserver:
         onStartBatch: function() { },
         onEndBatch: function() { },
         onLoad: function co_onLoad(calendar) {
             // ignore any onLoad events until initial getItems() call of startup has finished:
             if (calendar && this.alarmService.mLoadedCalendars[calendar.id]) {
                 // a refreshed calendar signals that it has been reloaded
                 // (and cannot notify detailed changes), thus reget all alarms of it:
@@ -107,16 +110,18 @@ function calAlarmService() {
         onPropertyDeleting: function(aCalendar, aName) {
             this.onPropertyChanged(aCalendar, aName);
         }
     };
 
     this.calendarManagerObserver = {
         alarmService: this,
 
+        QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICalendarManagerObserver]),
+
         onCalendarRegistered: function(aCalendar) {
             this.alarmService.observeCalendar(aCalendar);
             // initial refresh of alarms for new calendar:
             this.alarmService.initAlarms([aCalendar]);
         },
         onCalendarUnregistering: function(aCalendar) {
             // XXX todo: we need to think about calendar unregistration;
             // there may still be dangling items (-> alarm dialog),
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -40,16 +40,18 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * 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 ***** */
 
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
 var gLastShownCalendarView = null;
 
 var calendarTabMonitor = {
     monitorName: "lightning",
 
     // Unused, but needed functions
     onTabTitleChanged: function() {},
     onTabOpened: function() {},
@@ -349,16 +351,18 @@ var gInvitationsOperationListener = {
             this.mCount += aCount;
         }
     }
 };
 
 var gInvitationsCalendarManagerObserver = {
     mSideBar: this,
 
+    QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICalendarManagerObserver]),
+
     onCalendarRegistered: function cMO_onCalendarRegistered(aCalendar) {
         this.mSideBar.rescheduleInvitationsUpdate(FIRST_DELAY_REGISTER);
     },
 
     onCalendarUnregistering: function cMO_onCalendarUnregistering(aCalendar) {
         this.mSideBar.rescheduleInvitationsUpdate(FIRST_DELAY_UNREGISTER);
     },
 
--- a/calendar/providers/composite/calCompositeCalendar.js
+++ b/calendar/providers/composite/calCompositeCalendar.js
@@ -51,16 +51,18 @@ const calIOperationListener = Components
 function calCompositeCalendarObserverHelper (compCalendar) {
     this.compCalendar = compCalendar;
     this.pendingLoads = {};
 }
 
 calCompositeCalendarObserverHelper.prototype = {
     pendingLoads: null,
 
+    QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calIObserver]),
+
     onStartBatch: function() {
         this.compCalendar.mObservers.notify("onStartBatch");
     },
 
     onEndBatch: function() {
         this.compCalendar.mObservers.notify("onEndBatch");
     },