author | Robert Strong <robert.bugzilla@gmail.com> |
Wed, 05 Jul 2017 19:03:48 -0700 | |
changeset 367555 | 39e61f5e8fc5a66c7b038f897e600a59eb0e75ab |
parent 367554 | e5ff3bedda17dc95abc2c68fdf784f7e070dae6c |
child 367556 | fc07a79051918f888c67f456f85da6b1c55ef103 |
push id | 32137 |
push user | cbook@mozilla.com |
push date | Thu, 06 Jul 2017 09:18:21 +0000 |
treeherder | mozilla-central@018b3829d0a7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mhowell |
bugs | 1378033 |
milestone | 56.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
toolkit/components/timermanager/nsUpdateTimerManager.js | file | annotate | diff | comparison | revisions |
--- a/toolkit/components/timermanager/nsUpdateTimerManager.js +++ b/toolkit/components/timermanager/nsUpdateTimerManager.js @@ -1,17 +1,16 @@ /* 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://gre/modules/XPCOMUtils.jsm", this); -Components.utils.import("resource://gre/modules/Services.jsm", this); +const { classes: Cc, interfaces: Ci, utils: Cu } = Components; -const Cc = Components.classes; -const Ci = Components.interfaces; +Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); +Cu.import("resource://gre/modules/Services.jsm", this); const PREF_APP_UPDATE_LASTUPDATETIME_FMT = "app.update.lastUpdateTime.%ID%"; const PREF_APP_UPDATE_TIMERMINIMUMDELAY = "app.update.timerMinimumDelay"; const PREF_APP_UPDATE_TIMERFIRSTINTERVAL = "app.update.timerFirstInterval"; const PREF_APP_UPDATE_LOG = "app.update.log"; const CATEGORY_UPDATE_TIMER = "update-timer"; @@ -303,16 +302,24 @@ TimerManager.prototype = { } }, /** * See nsIUpdateTimerManager.idl */ registerTimer: function TM_registerTimer(id, callback, interval) { LOG("TimerManager:registerTimer - id: " + id); + if (this._timers === null) { + // Use normal logging since reportError is not available while shutting + // down. + gLogEnabled = true; + LOG("TimerManager:registerTimer called after profile-before-change " + + "notification. Ignoring timer registration for id: " + id); + return; + } if (id in this._timers && callback != this._timers[id].callback) { LOG("TimerManager:registerTimer - Ignoring second registration for " + id); return; } let prefLastUpdate = PREF_APP_UPDATE_LASTUPDATETIME_FMT.replace(/%ID%/, id); // Initialize the last update time to 0 when the preference isn't set so // the timer will be notified soon after a new profile's first use. let lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0); @@ -326,21 +333,22 @@ TimerManager.prototype = { this._timers[id] = {callback, interval, lastUpdateTime}; this._ensureTimer(interval * 1000); }, unregisterTimer: function TM_unregisterTimer(id) { - LOG(`TimerManager:unregisterTimer - id: ${id}`); + LOG("TimerManager:unregisterTimer - id: " + id); if (id in this._timers) { delete this._timers[id]; } else { - LOG(`TimerManager:registerTimer - Ignoring unregistration request for unknown id: ${id}`); + LOG("TimerManager:unregisterTimer - Ignoring unregistration request for " + + "unknown id: " + id); } }, classID: Components.ID("{B322A5C0-A419-484E-96BA-D7182163899F}"), QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateTimerManager, Ci.nsITimerCallback, Ci.nsIObserver]) };