Bug 758585 - Fix all creations of nsITimer that are locally-scoped, module: calendar. r=MakeMyDay
--- a/calendar/base/modules/calProviderUtils.jsm
+++ b/calendar/base/modules/calProviderUtils.jsm
@@ -145,16 +145,17 @@ cal.InterfaceRequestor_getInterface = fu
* Bad Certificate Handler for Network Requests. Shows the Network Exception
* Dialog if a certificate Problem occurs.
*/
cal.BadCertHandler = function(thisProvider) {
this.thisProvider = thisProvider;
};
cal.BadCertHandler.prototype = {
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIBadCertListener2]),
+ timer: null,
notifyCertProblem: function(socketInfo, status, targetSite) {
// Unfortunately we can't pass js objects using the window watcher, so
// we'll just take the first available calendar window. We also need to
// do this on a timer so that the modal window doesn't block the
// network request.
let calWindow = cal.getCalendarWindow();
@@ -174,21 +175,23 @@ cal.BadCertHandler.prototype = {
if (this.thisProvider.canRefresh &&
params.exceptionAdded) {
// Refresh the provider if the
// exception certificate was added
this.thisProvider.refresh();
}
}
};
- let timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.initWithCallback(timerCallback,
- 0,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ this.timer = Components.classes["@mozilla.org/timer;1"]
+ .createInstance(Components.interfaces.nsITimer);
+ this.timer.initWithCallback(
+ timerCallback,
+ 0,
+ Components.interfaces.nsITimer.TYPE_ONE_SHOT
+ );
return true;
}
};
/**
* Freebusy interval implementation. All parameters are optional.
*
* @param aCalId The calendar id to set up with.
--- a/calendar/providers/caldav/calDavRequestHandlers.js
+++ b/calendar/providers/caldav/calDavRequestHandlers.js
@@ -673,16 +673,17 @@ multigetSyncHandler.prototype = {
baseUri: null,
newSyncToken: null,
listener: null,
changeLogListener: null,
logXML: null,
unhandledErrors: 0,
itemsNeedFetching: null,
additionalSyncNeeded: false,
+ timer: null,
QueryInterface: XPCOMUtils.generateQI([
Components.interfaces.nsISAXContentHandler,
Components.interfaces.nsISAXErrorHandler,
Components.interfaces.nsIRequestObserver,
Components.interfaces.nsIStreamListener
]),
@@ -804,21 +805,23 @@ multigetSyncHandler.prototype = {
this._reader.parseAsync(null);
let timerCallback = {
requestHandler: this,
notify: function(timer) {
// Call multiget again to get another batch
this.requestHandler.doMultiGet();
}
};
- let timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.initWithCallback(timerCallback,
- 0,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ this.timer = Components.classes["@mozilla.org/timer;1"]
+ .createInstance(Components.interfaces.nsITimer);
+ this.timer.initWithCallback(
+ timerCallback,
+ 0,
+ Components.interfaces.nsITimer.TYPE_ONE_SHOT
+ );
}
},
onDataAvailable: function(request, context, inputStream, offset, count) {
if (this._reader) {
// No reader means request error
this._reader.onDataAvailable(request, context, inputStream, offset, count);
}