| Index: lib/synchronizer.js |
| =================================================================== |
| --- a/lib/synchronizer.js |
| +++ b/lib/synchronizer.js |
| @@ -56,30 +56,30 @@ let executing = {__proto__: null}; |
| let Synchronizer = exports.Synchronizer = |
| { |
| /** |
| * Called on module startup. |
| */ |
| init: function() |
| { |
| TimeLine.enter("Entered Synchronizer.init()"); |
| - |
| + |
| let callback = function() |
| { |
| timer.delay = CHECK_INTERVAL * MILLISECONDS_IN_SECOND; |
| checkSubscriptions(); |
| }; |
| - |
| + |
| timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
| timer.initWithCallback(callback, INITIAL_DELAY * MILLISECONDS_IN_SECOND, Ci.nsITimer.TYPE_REPEATING_SLACK); |
| onShutdown.add(function() |
| { |
| timer.cancel(); |
| }); |
| - |
| + |
| TimeLine.leave("Synchronizer.init() done"); |
| }, |
| /** |
| * Checks whether a subscription is currently being downloaded. |
| * @param {String} url URL of the subscription |
| * @return {Boolean} |
| */ |
| @@ -163,30 +163,30 @@ let Synchronizer = exports.Synchronizer |
| // Ignore modification date if we are downloading from a different location |
| forceDownload = true; |
| } |
| let {addonVersion} = require("info"); |
| loadFrom = loadFrom.replace(/%VERSION%/, "ABP" + addonVersion); |
| let request = null; |
| - function errorCallback(error) |
| + let errorCallback = function(error) |
| { |
| let channelStatus = -1; |
| try |
| { |
| channelStatus = request.channel.status; |
| } catch (e) {} |
| let responseStatus = ""; |
| try |
| { |
| responseStatus = request.channel.QueryInterface(Ci.nsIHttpChannel).responseStatus; |
| } catch (e) {} |
| setError(subscription, error, channelStatus, responseStatus, loadFrom, isBaseLocation, manual); |
| - } |
| + }; |
| try |
| { |
| request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); |
| request.mozBackgroundRequest = true; |
| request.open("GET", loadFrom); |
| } |
| catch (e) |
| @@ -215,17 +215,17 @@ let Synchronizer = exports.Synchronizer |
| { |
| if (iid.equals(Ci.nsIChannelEventSink)) |
| { |
| try { |
| oldEventSink = oldNotifications.QueryInterface(iid); |
| } catch(e) {} |
| return this; |
| } |
| - |
| + |
| if (oldNotifications) |
| return oldNotifications.QueryInterface(iid); |
| else |
| throw Cr.NS_ERROR_NO_INTERFACE; |
| }, |
| asyncOnChannelRedirect: function(oldChannel, newChannel, flags, callback) |
| { |