diff options
Diffstat (limited to '')
16 files changed, 90 insertions, 14 deletions
diff --git a/toolkit/components/places/tests/bookmarks/test_sync_fields.js b/toolkit/components/places/tests/bookmarks/test_sync_fields.js index 0a6f53fb85..b7b2ab4a1a 100644 --- a/toolkit/components/places/tests/bookmarks/test_sync_fields.js +++ b/toolkit/components/places/tests/bookmarks/test_sync_fields.js @@ -330,7 +330,7 @@ async function findTagFolder(tag) { return results.length ? results[0].getResultByName("guid") : null; } -// Exercises the new, async calls implemented in `Bookmarks.jsm`. +// Exercises the new, async calls implemented in `Bookmarks.sys.mjs`. class AsyncTestCases extends TestCases { async createFolder(parentGuid, title, index) { let item = await PlacesUtils.bookmarks.insert({ diff --git a/toolkit/components/places/tests/browser/browser_visituri.js b/toolkit/components/places/tests/browser/browser_visituri.js index 529c010e63..6aafe084e7 100644 --- a/toolkit/components/places/tests/browser/browser_visituri.js +++ b/toolkit/components/places/tests/browser/browser_visituri.js @@ -139,7 +139,7 @@ add_task(async function test_userpass() { ); // Open the target link as background. - await ContentTask.spawn(gBrowser.selectedBrowser, null, async args => { + await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => { let link = content.document.getElementById("target-userpass"); EventUtils.synthesizeMouseAtCenter( link, diff --git a/toolkit/components/places/tests/browser/previews/browser_thumbnails.js b/toolkit/components/places/tests/browser/previews/browser_thumbnails.js index 27f4fa3745..4fbbafccf9 100644 --- a/toolkit/components/places/tests/browser/previews/browser_thumbnails.js +++ b/toolkit/components/places/tests/browser/previews/browser_thumbnails.js @@ -2,7 +2,7 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ /** - * Tests PlacesPreviews.jsm + * Tests PlacesPreviews.sys.mjs */ const { PlacesPreviews } = ChromeUtils.importESModule( "resource://gre/modules/PlacesPreviews.sys.mjs" diff --git a/toolkit/components/places/tests/history/test_hasVisits.js b/toolkit/components/places/tests/history/test_hasVisits.js index 36fc9fd7be..5c7b56a8f3 100644 --- a/toolkit/components/places/tests/history/test_hasVisits.js +++ b/toolkit/components/places/tests/history/test_hasVisits.js @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests for `History.hasVisits` as implemented in History.jsm +// Tests for `History.hasVisits` as implemented in History.sys.mjs "use strict"; diff --git a/toolkit/components/places/tests/history/test_insert.js b/toolkit/components/places/tests/history/test_insert.js index a3a820ade9..ce83199516 100644 --- a/toolkit/components/places/tests/history/test_insert.js +++ b/toolkit/components/places/tests/history/test_insert.js @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests for `History.insert` as implemented in History.jsm +// Tests for `History.insert` as implemented in History.sys.mjs "use strict"; diff --git a/toolkit/components/places/tests/history/test_insertMany.js b/toolkit/components/places/tests/history/test_insertMany.js index 3d0774cbf2..4fe1481d85 100644 --- a/toolkit/components/places/tests/history/test_insertMany.js +++ b/toolkit/components/places/tests/history/test_insertMany.js @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests for `History.insertMany` as implemented in History.jsm +// Tests for `History.insertMany` as implemented in History.sys.mjs "use strict"; diff --git a/toolkit/components/places/tests/history/test_remove.js b/toolkit/components/places/tests/history/test_remove.js index 8c5e941fd0..c018a996f3 100644 --- a/toolkit/components/places/tests/history/test_remove.js +++ b/toolkit/components/places/tests/history/test_remove.js @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 et: */ -// Tests for `History.remove`, as implemented in History.jsm +// Tests for `History.remove`, as implemented in History.sys.mjs "use strict"; diff --git a/toolkit/components/places/tests/history/test_removeMany.js b/toolkit/components/places/tests/history/test_removeMany.js index ff8c3a21ee..5c955af0e1 100644 --- a/toolkit/components/places/tests/history/test_removeMany.js +++ b/toolkit/components/places/tests/history/test_removeMany.js @@ -2,7 +2,7 @@ /* vim:set ts=2 sw=2 sts=2 et: */ // Tests for `History.remove` with removing many urls, as implemented in -// History.jsm. +// History.sys.mjs. "use strict"; diff --git a/toolkit/components/places/tests/history/test_removeVisitsByFilter.js b/toolkit/components/places/tests/history/test_removeVisitsByFilter.js index be01fcb901..1045245d89 100644 --- a/toolkit/components/places/tests/history/test_removeVisitsByFilter.js +++ b/toolkit/components/places/tests/history/test_removeVisitsByFilter.js @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 et: */ -// Tests for `History.removeVisitsByFilter`, as implemented in History.jsm +// Tests for `History.removeVisitsByFilter`, as implemented in History.sys.mjs "use strict"; diff --git a/toolkit/components/places/tests/history/test_update.js b/toolkit/components/places/tests/history/test_update.js index d7beafd368..df5bcc7195 100644 --- a/toolkit/components/places/tests/history/test_update.js +++ b/toolkit/components/places/tests/history/test_update.js @@ -3,7 +3,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests for `History.update` as implemented in History.jsm +// Tests for `History.update` as implemented in History.sys.mjs "use strict"; diff --git a/toolkit/components/places/tests/sync/test_bookmark_mirror_migration.js b/toolkit/components/places/tests/sync/test_bookmark_mirror_migration.js index 86cf45eb0f..774ee9a1bb 100644 --- a/toolkit/components/places/tests/sync/test_bookmark_mirror_migration.js +++ b/toolkit/components/places/tests/sync/test_bookmark_mirror_migration.js @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Keep in sync with `SyncedBookmarksMirror.jsm`. +// Keep in sync with `SyncedBookmarksMirror.sys.mjs`. const CURRENT_MIRROR_SCHEMA_VERSION = 9; // The oldest schema version that we support. Any databases with schemas older diff --git a/toolkit/components/places/tests/unit/test_PlacesObservers_counts.js b/toolkit/components/places/tests/unit/test_PlacesObservers_counts.js new file mode 100644 index 0000000000..3eb7c2d2a9 --- /dev/null +++ b/toolkit/components/places/tests/unit/test_PlacesObservers_counts.js @@ -0,0 +1,58 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test PlacesObservers.counts. + +add_task(async function test_counts() { + const url = "http://example.com/title"; + await PlacesUtils.history.insertMany([ + { + title: "will change", + url, + visits: [{ transition: TRANSITION_LINK }], + }, + { + title: "changed", + url, + referrer: url, + visits: [{ transition: TRANSITION_LINK }], + }, + { + title: "another", + url: "http://example.com/another", + visits: [{ transition: TRANSITION_LINK }], + }, + ]); + await PlacesUtils.bookmarks.insert({ + url, + parentGuid: PlacesUtils.bookmarks.toolbarGuid, + }); + await PlacesUtils.history.clear(); + await PlacesUtils.bookmarks.eraseEverything; + + Assert.strictEqual( + PlacesObservers.counts.get("non-existing"), + undefined, + "Check non existing event returns undefined" + ); + Assert.strictEqual( + PlacesObservers.counts.get("page-removed"), + 0, + "Check non fired event returns 0" + ); + Assert.strictEqual( + PlacesObservers.counts.get("page-visited"), + 3, + "Check fired event `page-visited`" + ); + Assert.strictEqual( + PlacesObservers.counts.get("history-cleared"), + 1, + "Check fired event `history-cleared`" + ); + Assert.strictEqual( + PlacesObservers.counts.get("bookmark-added"), + 1, + "Check fired event `bookmark-added`" + ); +}); diff --git a/toolkit/components/places/tests/unit/test_frecency_observers.js b/toolkit/components/places/tests/unit/test_frecency_observers.js index 44747b06f9..bc7a7ca099 100644 --- a/toolkit/components/places/tests/unit/test_frecency_observers.js +++ b/toolkit/components/places/tests/unit/test_frecency_observers.js @@ -37,7 +37,7 @@ add_task(async function test_nsNavHistory_UpdateFrecency() { await promise; }); -// History.jsm invalidateFrecencies() +// History.sys.mjs invalidateFrecencies() add_task(async function test_invalidateFrecencies() { let url = Services.io.newURI("http://test-invalidateFrecencies.com/"); // Bookmarking the URI is enough to add it to moz_places, and importantly, it @@ -54,7 +54,7 @@ add_task(async function test_invalidateFrecencies() { await promise; }); -// History.jsm clear() should not cause a frecency recalculation since pages +// History.sys.mjs clear() should not cause a frecency recalculation since pages // are removed. add_task(async function test_clear() { let received = []; diff --git a/toolkit/components/places/tests/unit/test_frecency_recalculator.js b/toolkit/components/places/tests/unit/test_frecency_recalculator.js index ed4501c56a..414882eaf5 100644 --- a/toolkit/components/places/tests/unit/test_frecency_recalculator.js +++ b/toolkit/components/places/tests/unit/test_frecency_recalculator.js @@ -176,3 +176,19 @@ add_task(async function test_chunk_time_telemetry() { "Should still not have set shouldStartFrecencyRecalculation" ); }); + +add_task(async function test_acceleration() { + await PlacesTestUtils.addVisits( + new Array(300).fill("https://www.mozilla.org/") + ); + + Assert.ok( + PlacesFrecencyRecalculator.maybeUpdateRecalculationSpeed(), + "Recalculation accelerated" + ); + await PlacesFrecencyRecalculator.recalculateAnyOutdatedFrecencies(); + Assert.ok( + !PlacesFrecencyRecalculator.maybeUpdateRecalculationSpeed(), + "Recalculation back to normal rate" + ); +}); diff --git a/toolkit/components/places/tests/unit/test_origins_parsing.js b/toolkit/components/places/tests/unit/test_origins_parsing.js index bdeabce271..8372e9fb66 100644 --- a/toolkit/components/places/tests/unit/test_origins_parsing.js +++ b/toolkit/components/places/tests/unit/test_origins_parsing.js @@ -71,7 +71,7 @@ add_task(async function parsing() { // The history cannot be deleted at a URL with a user path. } else { expectedOrigins = expectedOrigins.filter( - ([prefix, hostPort]) => !prefix.startsWith(uri.scheme + ":") + ([prefix]) => !prefix.startsWith(uri.scheme + ":") ); } await checkDB(expectedOrigins); diff --git a/toolkit/components/places/tests/unit/xpcshell.toml b/toolkit/components/places/tests/unit/xpcshell.toml index 8a56fcc370..62de0c0db7 100644 --- a/toolkit/components/places/tests/unit/xpcshell.toml +++ b/toolkit/components/places/tests/unit/xpcshell.toml @@ -179,6 +179,8 @@ prefs = ["places.frecency.pages.alternative.featureGate=true"] ["test_pageGuid_bookmarkGuid.js"] +["test_PlacesObservers_counts.js"] + ["test_placeURIs.js"] ["test_promiseBookmarksTree.js"] |