diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /services/sync | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'services/sync')
-rw-r--r-- | services/sync/modules/SyncedTabs.sys.mjs | 39 | ||||
-rw-r--r-- | services/sync/modules/constants.sys.mjs | 2 | ||||
-rw-r--r-- | services/sync/tests/unit/test_bookmark_tracker.js | 21 |
3 files changed, 40 insertions, 22 deletions
diff --git a/services/sync/modules/SyncedTabs.sys.mjs b/services/sync/modules/SyncedTabs.sys.mjs index 410244413e..058525995b 100644 --- a/services/sync/modules/SyncedTabs.sys.mjs +++ b/services/sync/modules/SyncedTabs.sys.mjs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; + const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { @@ -40,6 +42,21 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => { return log; }); +// We allow some test preferences to simulate many and inactive tabs. +XPCOMUtils.defineLazyPreferenceGetter( + lazy, + "NUM_FAKE_INACTIVE_TABS", + "services.sync.syncedTabs.numFakeInactiveTabs", + 0 +); + +XPCOMUtils.defineLazyPreferenceGetter( + lazy, + "NUM_FAKE_ACTIVE_TABS", + "services.sync.syncedTabs.numFakeActiveTabs", + 0 +); + // A private singleton that does the work. let SyncedTabsInternal = { /* Make a "tab" record. Returns a promise */ @@ -143,7 +160,27 @@ let SyncedTabsInternal = { let clientRepr = await this._makeClient(client); lazy.log.debug("Processing client", clientRepr); - for (let tab of client.tabs) { + let tabs = Array.from(client.tabs); // avoid modifying in-place. + // For QA, UX, etc, we allow "fake tabs" to be added to each device. + for (let i = 0; i < lazy.NUM_FAKE_INACTIVE_TABS; i++) { + tabs.push({ + icon: null, + lastUsed: 1000, + title: `Fake inactive tab ${i}`, + urlHistory: [`https://example.com/inactive/${i}`], + inactive: true, + }); + } + for (let i = 0; i < lazy.NUM_FAKE_ACTIVE_TABS; i++) { + tabs.push({ + icon: null, + lastUsed: Date.now() - 1000 + i, + title: `Fake tab ${i}`, + urlHistory: [`https://example.com/${i}`], + }); + } + + for (let tab of tabs) { let url = tab.urlHistory[0]; lazy.log.trace("remote tab", url); diff --git a/services/sync/modules/constants.sys.mjs b/services/sync/modules/constants.sys.mjs index 9efe941c0a..ac7960f468 100644 --- a/services/sync/modules/constants.sys.mjs +++ b/services/sync/modules/constants.sys.mjs @@ -4,7 +4,7 @@ // Don't manually modify this line, as it is automatically replaced on merge day // by the gecko_migration.py script. -export const WEAVE_VERSION = "1.128.0"; +export const WEAVE_VERSION = "1.129.0"; // Sync Server API version that the client supports. export const SYNC_API_VERSION = "1.5"; diff --git a/services/sync/tests/unit/test_bookmark_tracker.js b/services/sync/tests/unit/test_bookmark_tracker.js index 6084e48ebd..c47b573e7e 100644 --- a/services/sync/tests/unit/test_bookmark_tracker.js +++ b/services/sync/tests/unit/test_bookmark_tracker.js @@ -764,26 +764,7 @@ add_task(async function test_onFaviconChanged() { let iconURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAA" + "AAAA6fptVAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=="; - - PlacesUtils.favicons.replaceFaviconDataFromDataURL( - iconURI, - iconURL, - 0, - Services.scriptSecurityManager.getSystemPrincipal() - ); - - await new Promise(resolve => { - PlacesUtils.favicons.setAndFetchFaviconForPage( - pageURI, - iconURI, - true, - PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, - () => { - resolve(); - }, - Services.scriptSecurityManager.getSystemPrincipal() - ); - }); + await PlacesTestUtils.setFaviconForPage(pageURI, iconURI, iconURL); await verifyTrackedItems([]); Assert.equal(tracker.score, 0); } finally { |