зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160450 - Places Maintenance never runs. r=ttaubert
This commit is contained in:
Родитель
66deded1e3
Коммит
792db8bcbf
|
@ -67,7 +67,6 @@ this.PlacesDBUtils = {
|
|||
}
|
||||
|
||||
// Notify observers that maintenance finished.
|
||||
Services.prefs.setIntPref("places.database.lastMaintenance", parseInt(Date.now() / 1000));
|
||||
Services.obs.notifyObservers(null, FINISHED_MAINTENANCE_TOPIC, null);
|
||||
}
|
||||
},
|
||||
|
@ -94,7 +93,12 @@ this.PlacesDBUtils = {
|
|||
, this._refreshUI
|
||||
]);
|
||||
tasks._telemetryStart = Date.now();
|
||||
tasks.callback = aCallback;
|
||||
tasks.callback = function() {
|
||||
Services.prefs.setIntPref("places.database.lastMaintenance",
|
||||
parseInt(Date.now() / 1000));
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
}
|
||||
tasks.scope = aScope;
|
||||
this._executeTasks(tasks);
|
||||
},
|
||||
|
|
|
@ -1279,14 +1279,17 @@ add_task(function test_preventive_maintenance()
|
|||
stmt.finalize();
|
||||
do_check_true(defaultBookmarksMaxId > 0);
|
||||
|
||||
for ([, test] in Iterator(tests)) {
|
||||
for (let [, test] in Iterator(tests)) {
|
||||
dump("\nExecuting test: " + test.name + "\n" + "*** " + test.desc + "\n");
|
||||
yield test.setup();
|
||||
|
||||
let promiseMaintenanceFinished =
|
||||
promiseTopicObserved(FINISHED_MAINTENANCE_NOTIFICATION_TOPIC);
|
||||
PlacesDBUtils.maintenanceOnIdle();
|
||||
Services.prefs.clearUserPref("places.database.lastMaintenance");
|
||||
let callbackInvoked = false;
|
||||
PlacesDBUtils.maintenanceOnIdle(() => callbackInvoked = true);
|
||||
yield promiseMaintenanceFinished;
|
||||
do_check_true(callbackInvoked);
|
||||
|
||||
// Check the lastMaintenance time has been saved.
|
||||
do_check_neq(Services.prefs.getIntPref("places.database.lastMaintenance"), null);
|
||||
|
|
|
@ -126,6 +126,7 @@ add_task(function test_execute()
|
|||
});
|
||||
|
||||
add_test(function test_healthreport_callback() {
|
||||
Services.prefs.clearUserPref("places.database.lastMaintenance");
|
||||
PlacesDBUtils.telemetry(null, function onResult(data) {
|
||||
do_check_neq(data, null);
|
||||
|
||||
|
@ -133,6 +134,7 @@ add_test(function test_healthreport_callback() {
|
|||
do_check_eq(data.PLACES_PAGES_COUNT, 1);
|
||||
do_check_eq(data.PLACES_BOOKMARKS_COUNT, 1);
|
||||
|
||||
do_check_true(!Services.prefs.prefHasUserValue("places.database.lastMaintenance"));
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче