Bug 648068 - In Blocklist, Remove the OOB value "reset" from days since last request; r=dtownsend

This commit is contained in:
Daniel Einspanjer 2011-04-07 10:41:00 -07:00
parent 4dd16cdfda
commit bb195a948d
2 changed files with 27 additions and 9 deletions

View File

@ -433,12 +433,8 @@ Blocklist.prototype = {
var pingCountVersion = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTVERSION, 0);
var pingCountTotal = getPref("getIntPref", PREF_BLOCKLIST_PINGCOUNTTOTAL, 1);
var daysSinceLastPing = 0;
if (pingCountVersion < 1 || pingCountTotal < 1) {
daysSinceLastPing = pingCountVersion == 0 ? "new" : "reset";
if (pingCountVersion < 1)
pingCountVersion = 1;
if (pingCountTotal < 1)
pingCountTotal = 1;
if (pingCountVersion == 0) {
daysSinceLastPing = "new";
}
else {
// Seconds in one day is used because nsIUpdateTimerManager stores the
@ -458,6 +454,11 @@ Blocklist.prototype = {
}
}
if (pingCountVersion < 1)
pingCountVersion = 1;
if (pingCountTotal < 1)
pingCountTotal = 1;
dsURI = dsURI.replace(/%APP_ID%/g, gApp.ID);
dsURI = dsURI.replace(/%APP_VERSION%/g, gApp.version);
dsURI = dsURI.replace(/%PRODUCT%/g, gApp.name);

View File

@ -68,7 +68,7 @@ function test4() {
Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME,
(getNowInSeconds() - (SECONDS_IN_DAY * 2)));
gNextTest = test5;
gExpectedQueryString = "1&3&reset";
gExpectedQueryString = "1&3&2";
notify_blocklist();
}
@ -100,7 +100,7 @@ function test8() {
Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME,
(getNowInSeconds() - (SECONDS_IN_DAY * 5)));
gNextTest = test9;
gExpectedQueryString = "1&6&reset";
gExpectedQueryString = "1&6&5";
notify_blocklist();
}
@ -116,8 +116,25 @@ function test9() {
function test10() {
Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME,
(getNowInSeconds() - (SECONDS_IN_DAY * 7)));
gNextTest = test11;
gExpectedQueryString = "3&1&7";
notify_blocklist();
}
function test11() {
Services.prefs.setIntPref(PREF_BLOCKLIST_PINGCOUNTVERSION, -1);
Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME,
(getNowInSeconds() - (SECONDS_IN_DAY * 8)));
gNextTest = test12;
gExpectedQueryString = "1&2&8";
notify_blocklist();
}
function test12() {
Services.prefs.setIntPref(PREF_BLOCKLIST_LASTUPDATETIME,
(getNowInSeconds() - (SECONDS_IN_DAY * 9)));
gNextTest = finish;
gExpectedQueryString = "3&1&reset";
gExpectedQueryString = "2&3&9";
notify_blocklist();
}