blob: dc3e8452f16a4c500dea9068903be31f805b84b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test whether purge-caches event works collectry when maintenance the places.
add_task(async function test_history() {
await PlacesTestUtils.addVisits({ uri: "http://example.com/" });
await assertPurgingCaches();
});
add_task(async function test_bookmark() {
await PlacesTestUtils.addBookmarkWithDetails({ uri: "http://example.com/" });
await assertPurgingCaches();
});
async function assertPurgingCaches() {
const query = PlacesUtils.history.getNewQuery();
const options = PlacesUtils.history.getNewQueryOptions();
const result = PlacesUtils.history.executeQuery(query, options);
result.root.containerOpen = true;
const onInvalidateContainer = new Promise(resolve => {
const resultObserver = new NavHistoryResultObserver();
resultObserver.invalidateContainer = resolve;
result.addObserver(resultObserver, false);
});
await PlacesDBUtils.maintenanceOnIdle();
await onInvalidateContainer;
ok(true, "InvalidateContainer is called");
}
|