From 4d2443b2051b809c831d2280c804c548e9c04288 Mon Sep 17 00:00:00 2001 From: "dolske@mozilla.com" Date: Wed, 5 Dec 2007 22:51:24 -0800 Subject: [PATCH] Backing out 407018, trace_malloc_allocs on bm-xserve11 jumped from 460K to 570K. --- .../components/places/src/nsNavHistoryExpire.cpp | 12 +++++------- .../places/tests/unit/test_expiration.js | 15 ++++++--------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/toolkit/components/places/src/nsNavHistoryExpire.cpp b/toolkit/components/places/src/nsNavHistoryExpire.cpp index ddbafab65911..2cd41f4ec572 100644 --- a/toolkit/components/places/src/nsNavHistoryExpire.cpp +++ b/toolkit/components/places/src/nsNavHistoryExpire.cpp @@ -479,18 +479,16 @@ nsNavHistoryExpire::FindVisits(PRTime aExpireThreshold, PRUint32 aNumToExpire, nsresult rv = aConnection->CreateStatement(sqlMinAge, getter_AddRefs(selectMinStatement)); NS_ENSURE_SUCCESS(rv, rv); - PRInt64 minDaysAgo = mHistory->mExpireDaysMin * 86400 * PR_USEC_PER_SEC; - PRTime minThreshold = PR_Now() - minDaysAgo; - rv = selectMinStatement->BindInt64Parameter(0, minThreshold); + rv = selectStatement->BindInt64Parameter(0, aExpireThreshold); NS_ENSURE_SUCCESS(rv, rv); - rv = selectMinStatement->BindInt64Parameter(1, aNumToExpire); + rv = selectStatement->BindInt64Parameter(1, aNumToExpire); NS_ENSURE_SUCCESS(rv, rv); - rv = selectMinStatement->BindInt32Parameter(2, mHistory->mExpireSites); + rv = selectStatement->BindInt32Parameter(2, mHistory->mExpireSites); NS_ENSURE_SUCCESS(rv, rv); hasMore = PR_FALSE; - while (NS_SUCCEEDED(selectMinStatement->ExecuteStep(&hasMore)) && hasMore) { - nsNavHistoryExpireRecord record(selectMinStatement); + while (NS_SUCCEEDED(selectStatement->ExecuteStep(&hasMore)) && hasMore) { + nsNavHistoryExpireRecord record(selectStatement); aRecords.AppendElement(record); } } diff --git a/toolkit/components/places/tests/unit/test_expiration.js b/toolkit/components/places/tests/unit/test_expiration.js index 0da8a997e2e0..0ea0a230fa0a 100644 --- a/toolkit/components/places/tests/unit/test_expiration.js +++ b/toolkit/components/places/tests/unit/test_expiration.js @@ -533,12 +533,11 @@ confirmation: - query for the visit, confirm it's there */ function startExpireDaysOnly() { + dump("startExpireDaysOnly()\n"); // setup histsvc.removeAllPages(); observer.expiredURI = null; - dump("startExpireDaysOnly()\n"); - // add expirable visit histsvc.addVisit(testURI, (Date.now() - (86400 * 2 * 1000)) * 1000, 0, histsvc.TRANSITION_TYPED, false, 0); annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, annosvc.EXPIRE_WITH_HISTORY); @@ -549,9 +548,7 @@ function startExpireDaysOnly() { // set visit cap to 2 prefs.setIntPref("browser.history_expire_sites", 2); // set date minimum to 2 - prefs.setIntPref("browser.history_expire_days_min", 2); - // set date maximum to 3 - prefs.setIntPref("browser.history_expire_days", 3); + prefs.setIntPref("browser.history_expire_days", 2); // trigger expiration ghist.addURI(triggerURI, false, true, null); @@ -563,8 +560,8 @@ function startExpireDaysOnly() { function checkExpireDaysOnly() { try { // test expired record - do_check_eq(observer.expiredURI, null); - do_check_eq(annosvc.getPageAnnotationNames(testURI, {}).length, 1); + do_check_eq(observer.expiredURI, testURI.spec); + do_check_eq(annosvc.getPageAnnotationNames(testURI, {}).length, 0); // test unexpired record do_check_neq(histsvc.getPageTitle(uri("http://unexpirable.com")), null); } catch(ex) {} @@ -594,10 +591,10 @@ confirmation: - query for the visit, confirm it's not there */ function startExpireBoth() { + dump("starting expiration test 3: both criteria met\n"); // setup histsvc.removeAllPages(); observer.expiredURI = null; - dump("starting expiration test 3: both criteria met\n"); // add visits // 2 days old, in microseconds @@ -612,7 +609,7 @@ function startExpireBoth() { // set date max to 3 prefs.setIntPref("browser.history_expire_days", 3); // set date minimum to 1 - prefs.setIntPref("browser.history_expire_days_min", 1); + prefs.setIntPref("browser.history_expire_days", 1); // trigger expiration ghist.addURI(triggerURI, false, true, null);