Bug 1056034 - Avoid unassigned lastUpdateTime use. r=rstrong

Scope of 'let' variables is limited to the current block, however, there
is a later use of this variable that is done outside of the block where
it's declared as 'var'. We declare the variable as 'var' and at the top
level of the function to make sure that it is a legit one when we want
to assign it.
This commit is contained in:
Alexandre Lissy 2014-08-20 07:02:00 -04:00
Родитель a7b5de355c
Коммит 071721792e
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -140,6 +140,7 @@ TimerManager.prototype = {
var callbackToFire = null;
var earliestIntendedTime = null;
var skippedFirings = false;
var lastUpdateTime = null;
function tryFire(callback, intendedTime) {
var selected = false;
if (intendedTime <= now) {
@ -184,7 +185,7 @@ TimerManager.prototype = {
timerID);
// 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);
lastUpdateTime = getPref("getIntPref", prefLastUpdate, 0);
// If the last update time is greater than the current time then reset
// it to 0 and the timer manager will correct the value when it fires