tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f6db3d1b91805f3d323d1f86b589c301e58f9e11
parent 2aa24e4cb5fd0c2b55abcde8cea9cf065b667cf6
Author: Atila Butkovits <abutkovits@mozilla.com>
Date:   Thu,  4 Dec 2025 06:57:00 +0200

Revert "Bug 2003898 - Dont show connect another device button if no sync keys r=sync-reviewers,LougeniaBailey,markh" for causing failures at test_uistate.js.

This reverts commit 8edaac307780ea3c4eeaa9627ff26518013ed862.

Diffstat:
Mbrowser/base/content/browser-sync.js | 15++-------------
Mbrowser/base/content/test/sync/browser_sync.js | 2--
Mservices/sync/modules/UIState.sys.mjs | 5-----
Mservices/sync/tests/unit/test_uistate.js | 11+----------
4 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/browser/base/content/browser-sync.js b/browser/base/content/browser-sync.js @@ -1195,14 +1195,10 @@ var gSync = { document, "PanelUI-fxa-menu-setup-sync-container" ); + const fxaToolbarMenuButton = document.getElementById( "fxa-toolbar-menu-button" ); - const syncSetupSeparator = PanelMultiView.getViewNode( - document, - "PanelUI-set-up-sync-separator" - ); - let fxaAvatarLabelEl = document.getElementById("fxa-avatar-label"); // Reset FxA/Sync UI elements to default, which is signed out @@ -1315,17 +1311,10 @@ var gSync = { if (this._shouldShowSyncOffIndicator()) { fxaToolbarMenuButton?.setAttribute("badge-status", "sync-disabled"); } + // Show the sync element depending on if the user is enrolled or not syncSetupEl.removeAttribute("hidden"); } - if (state.hasSyncKeys) { - cadButtonEl.removeAttribute("hidden"); - syncSetupSeparator.removeAttribute("hidden"); - } else { - cadButtonEl.setAttribute("hidden", "true"); - syncSetupSeparator.setAttribute("hidden", "true"); - } - // Reposition profiles elements emptyProfilesButton.remove(); profilesButton.remove(); diff --git a/browser/base/content/test/sync/browser_sync.js b/browser/base/content/test/sync/browser_sync.js @@ -790,7 +790,6 @@ add_task(async function test_new_sync_setup_ui() { let state = { status: UIState.STATUS_SIGNED_IN, syncEnabled: false, - hasSyncKeys: true, email: "foo@bar.com", displayName: "Foo Bar", avatarURL: "https://foo.bar", @@ -840,7 +839,6 @@ add_task(async function test_ui_my_services_signedin() { let state = { status: UIState.STATUS_SIGNED_IN, syncEnabled: true, - hasSyncKeys: true, email: "foo@bar.com", displayName: "Foo Bar", avatarURL: "https://foo.bar", diff --git a/services/sync/modules/UIState.sys.mjs b/services/sync/modules/UIState.sys.mjs @@ -10,11 +10,8 @@ * @property {string} [avatarURL] The user's FxA avatar URL. * @property {Date} [lastSync] The last sync time. * @property {boolean} [syncing] Whether or not we are currently syncing. - * @property {boolean} [hasSyncKeys] Whether the user has sync keys available. */ -import { SCOPE_APP_SYNC } from "resource://gre/modules/FxAccountsCommon.sys.mjs"; - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { LOGIN_FAILED_LOGIN_REJECTED: "resource://services-sync/constants.sys.mjs", @@ -176,8 +173,6 @@ const UIStateInternal = { state.avatarURL = userData.avatar; state.avatarIsDefault = userData.avatarDefault; state.syncEnabled = !!syncUserName; - state.hasSyncKeys = - await this.fxAccounts.keys.hasKeysForScope(SCOPE_APP_SYNC); } state.status = status; }, diff --git a/services/sync/tests/unit/test_uistate.js b/services/sync/tests/unit/test_uistate.js @@ -74,7 +74,6 @@ add_task(async function test_refreshState_signedin() { hasLocalSession: () => Promise.resolve(true), keys: { canGetKeyForScope: () => Promise.resolve(true), - hasKeysForScope: () => Promise.resolve(true), }, }; @@ -87,7 +86,6 @@ add_task(async function test_refreshState_signedin() { equal(state.avatarURL, "https://foo/bar"); equal(state.lastSync, now); equal(state.syncing, false); - equal(state.hasSyncKeys, true); UIStateInternal.fxAccounts = fxAccountsOrig; Services.prefs.clearUserPref("services.sync.username"); @@ -136,7 +134,6 @@ add_task(async function test_refreshState_signedin_profile_unavailable() { hasLocalSession: () => Promise.resolve(true), keys: { canGetKeyForScope: () => Promise.resolve(true), - hasKeysForScope: () => Promise.resolve(true), }, _internal: { profile: { @@ -219,7 +216,6 @@ add_task(async function test_refreshState_loginFailed() { Promise.resolve({ verified: true, uid: "123", email: "foo@bar.com" }), keys: { canGetKeyForScope: () => Promise.resolve(true), - hasKeysForScope: () => Promise.resolve(true), }, }; @@ -275,7 +271,6 @@ async function configureUIState(syncing, lastSync = new Date()) { hasLocalSession: () => Promise.resolve(true), keys: { canGetKeyForScope: () => Promise.resolve(true), - hasKeysForScope: () => Promise.resolve(true), }, }; await UIState.refresh(); @@ -348,7 +343,6 @@ add_task(async function test_refreshState_signedin_with_synckeys() { hasLocalSession: () => Promise.resolve(true), keys: { canGetKeyForScope: () => Promise.resolve(true), - hasKeysForScope: () => Promise.resolve(true), }, }; @@ -377,16 +371,13 @@ add_task(async function test_refreshState_third_party_auth_no_sync() { email: "foo@bar.com", }), hasLocalSession: () => Promise.resolve(true), - keys: { - hasKeysForScope: () => Promise.resolve(false), - }, + keys: {}, }; let state = await UIState.refresh(); equal(state.status, UIState.STATUS_SIGNED_IN); equal(state.syncEnabled, false); - equal(state.hasSyncKeys, false); equal(state.uid, "123"); equal(state.email, "foo@bar.com");