Bug 1820790 - Generalize the 180 day history import limit, and apply it to IE and Edge (EdgeHTML) migrators. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D172718
This commit is contained in:
Mike Conley
2023-03-21 15:18:34 +00:00
parent e95341af1a
commit e8af8e6305
10 changed files with 388 additions and 28 deletions

View File

@@ -536,21 +536,17 @@ async function GetHistoryResource(aProfileFolder) {
migrate(aCallback) {
(async function() {
const MAX_AGE_IN_DAYS = Services.prefs.getIntPref(
"browser.migrate.chrome.history.maxAgeInDays"
);
const LIMIT = Services.prefs.getIntPref(
"browser.migrate.chrome.history.limit"
);
let query =
"SELECT url, title, last_visit_time, typed_count FROM urls WHERE hidden = 0";
if (MAX_AGE_IN_DAYS) {
let maxAge = lazy.ChromeMigrationUtils.dateToChromeTime(
Date.now() - MAX_AGE_IN_DAYS * 24 * 60 * 60 * 1000
);
query += " AND last_visit_time > " + maxAge;
}
let maxAge = lazy.ChromeMigrationUtils.dateToChromeTime(
Date.now() - MigrationUtils.HISTORY_MAX_AGE_IN_MILLISECONDS
);
query += " AND last_visit_time > " + maxAge;
if (LIMIT) {
query += " ORDER BY last_visit_time DESC LIMIT " + LIMIT;
}