|
6 | 6 | // Test for the behavior of UrlbarProviderHistoryUrlHeuristic.
|
7 | 7 |
|
8 | 8 | add_setup(async function () {
|
| 9 | + Services.prefs.setBoolPref("browser.search.suggest.enabled", false); |
9 | 10 | Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
|
10 | 11 | Services.prefs.setBoolPref("browser.urlbar.suggest.quickactions", false);
|
11 |
| - registerCleanupFunction(() => { |
| 12 | + registerCleanupFunction(async () => { |
| 13 | + Services.prefs.clearUserPref("browser.search.suggest.enabled"); |
12 | 14 | Services.prefs.clearUserPref("browser.urlbar.autoFill");
|
13 | 15 | Services.prefs.clearUserPref("browser.urlbar.suggest.quickactions");
|
| 16 | + await PlacesUtils.history.clear(); |
| 17 | + await PlacesUtils.bookmarks.eraseEverything(); |
14 | 18 | });
|
15 | 19 | });
|
16 | 20 |
|
| 21 | +add_task(async function test_after_clear_history() { |
| 22 | + await PlacesTestUtils.addVisits([ |
| 23 | + { uri: "https://example.com/", title: "VISIT" }, |
| 24 | + ]); |
| 25 | + await PlacesTestUtils.addBookmarkWithDetails({ |
| 26 | + uri: "https://example.com/", |
| 27 | + title: "BOOKMARK", |
| 28 | + }); |
| 29 | + |
| 30 | + const before = createContext("example.com", { isPrivate: false }); |
| 31 | + await check_results({ |
| 32 | + context: before, |
| 33 | + matches: [ |
| 34 | + makeVisitResult(before, { |
| 35 | + uri: "http://example.com/", |
| 36 | + title: "VISIT", |
| 37 | + iconUri: "page-icon:https://example.com/", |
| 38 | + heuristic: true, |
| 39 | + providerName: "HistoryUrlHeuristic", |
| 40 | + }), |
| 41 | + makeBookmarkResult(before, { |
| 42 | + uri: "https://example.com/", |
| 43 | + title: "BOOKMARK", |
| 44 | + }), |
| 45 | + ], |
| 46 | + }); |
| 47 | + |
| 48 | + await PlacesUtils.history.clear(); |
| 49 | + |
| 50 | + const after = createContext("example.com", { isPrivate: false }); |
| 51 | + await check_results({ |
| 52 | + context: after, |
| 53 | + matches: [ |
| 54 | + makeVisitResult(after, { |
| 55 | + uri: "http://example.com/", |
| 56 | + title: "BOOKMARK", |
| 57 | + iconUri: "page-icon:https://example.com/", |
| 58 | + heuristic: true, |
| 59 | + providerName: "HistoryUrlHeuristic", |
| 60 | + }), |
| 61 | + makeBookmarkResult(after, { |
| 62 | + uri: "https://example.com/", |
| 63 | + title: "BOOKMARK", |
| 64 | + }), |
| 65 | + ], |
| 66 | + }); |
| 67 | + |
| 68 | + await PlacesUtils.bookmarks.eraseEverything(); |
| 69 | +}); |
| 70 | + |
17 | 71 | add_task(async function test_basic() {
|
18 | 72 | await PlacesTestUtils.addVisits([
|
19 | 73 | { uri: "https://example.com/", title: "Example COM" },
|
|
0 commit comments