Bug 1903658 - enable identity.fxaccounts.oauth.enabled pref by default. r=jonalmeida,fxview-reviewers,omc-reviewers,aminomancer,nsharpley,joschmidt,credential-management-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D228899
This commit is contained in:
Mark Hammond 2024-11-22 04:19:56 +00:00
parent ea4219bb2d
commit d5610ed8d8
10 changed files with 55 additions and 18 deletions

View File

@ -2068,10 +2068,10 @@ pref("identity.fxaccounts.enabled", true);
pref("identity.fxaccounts.remote.root", "https://accounts.firefox.com/"); pref("identity.fxaccounts.remote.root", "https://accounts.firefox.com/");
// The value of the context query parameter passed in fxa requests. // The value of the context query parameter passed in fxa requests.
pref("identity.fxaccounts.contextParam", "fx_desktop_v3"); pref("identity.fxaccounts.contextParam", "oauth_webchannel_v1");
// Whether to use the oauth flow for desktop or not // Whether to use the oauth flow for desktop or not
pref("identity.fxaccounts.oauth.enabled", false); pref("identity.fxaccounts.oauth.enabled", true);
// The remote URL of the FxA Profile Server // The remote URL of the FxA Profile Server
pref("identity.fxaccounts.remote.profile.uri", "https://profile.accounts.firefox.com/v1"); pref("identity.fxaccounts.remote.profile.uri", "https://profile.accounts.firefox.com/v1");

View File

@ -227,10 +227,12 @@ add_task(async function () {
); );
await shown; await shown;
let expectedUrl = let promiseTabOpened = BrowserTestUtils.waitForNewTab(
"https://example.com/connect_another_device?context=" + gBrowser,
"fx_desktop_v3&entrypoint=synced-tabs&service=sync&uid=uid&email=foo%40bar.com"; url =>
let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, expectedUrl); url.startsWith("https://example.com/connect_another_device") &&
url.includes("entrypoint=synced-tabs")
);
button.click(); button.click();
// the panel should have been closed. // the panel should have been closed.
ok(!isOverflowOpen(), "click closed the panel"); ok(!isOverflowOpen(), "click closed the panel");

View File

@ -2,9 +2,11 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */ * http://creativecommons.org/publicdomain/zero/1.0/ */
add_setup(async function () { add_setup(async function () {
Services.prefs.setBoolPref("identity.fxaccounts.oauth.enabled", false);
registerCleanupFunction(() => { registerCleanupFunction(() => {
// reset internal state so it doesn't affect the next tests // reset internal state so it doesn't affect the next tests
TabsSetupFlowManager.resetInternalState(); TabsSetupFlowManager.resetInternalState();
Services.prefs.clearUserPref("identity.fxaccounts.oauth.enabled");
}); });
// gSync.init() is called in a requestIdleCallback. Force its initialization. // gSync.init() is called in a requestIdleCallback. Force its initialization.

View File

@ -8,9 +8,17 @@ const MOCK_FLOW_ID =
const MOCK_FLOW_BEGIN_TIME = 1590780440325; const MOCK_FLOW_BEGIN_TIME = 1590780440325;
const MOCK_DEVICE_ID = "7e450f3337d3479b8582ea1c9bb5ba6c"; const MOCK_DEVICE_ID = "7e450f3337d3479b8582ea1c9bb5ba6c";
Services.prefs.setBoolPref("identity.fxaccounts.oauth.enabled", false);
Services.prefs.setStringPref(
"identity.fxaccounts.contextParam",
"fx_desktop_v3"
);
registerCleanupFunction(function () { registerCleanupFunction(function () {
Services.prefs.clearUserPref("identity.fxaccounts.remote.root"); Services.prefs.clearUserPref("identity.fxaccounts.remote.root");
Services.prefs.clearUserPref("services.sync.username"); Services.prefs.clearUserPref("services.sync.username");
Services.prefs.clearUserPref("identity.fxaccounts.oauth.enabled");
Services.prefs.clearUserPref("identity.fxaccounts.contextParam");
}); });
add_task(setup_UITourTest); add_task(setup_UITourTest);

View File

@ -392,6 +392,7 @@ add_test(function test_client_mock() {
// Polling should detect that the email is verified, and eventually // Polling should detect that the email is verified, and eventually
// 'onverified' should be observed // 'onverified' should be observed
add_test(function test_verification_poll() { add_test(function test_verification_poll() {
ensureOauthNotConfigured();
let fxa = new MockFxAccounts(); let fxa = new MockFxAccounts();
let test_user = getTestUser("francine"); let test_user = getTestUser("francine");
let login_notification_received = false; let login_notification_received = false;
@ -436,6 +437,7 @@ add_test(function test_verification_poll() {
// poll should time out. No verifiedlogin event should be observed, and the // poll should time out. No verifiedlogin event should be observed, and the
// internal whenVerified promise should be rejected // internal whenVerified promise should be rejected
add_test(function test_polling_timeout() { add_test(function test_polling_timeout() {
ensureOauthNotConfigured();
// This test could be better - the onverified observer might fire on // This test could be better - the onverified observer might fire on
// somebody else's stack, and we're not making sure that we're not receiving // somebody else's stack, and we're not making sure that we're not receiving
// such a message. In other words, this tests either failure, or success, but // such a message. In other words, this tests either failure, or success, but
@ -1010,6 +1012,7 @@ add_test(function test_fetchAndUnwrapAndDeriveKeys_no_token() {
// signs in with a verified email. Ensure that no sign-in events are triggered // signs in with a verified email. Ensure that no sign-in events are triggered
// on Alice's behalf. In the end, Bob should be the signed-in user. // on Alice's behalf. In the end, Bob should be the signed-in user.
add_test(function test_overlapping_signins() { add_test(function test_overlapping_signins() {
ensureOauthNotConfigured();
let fxa = new MockFxAccounts(); let fxa = new MockFxAccounts();
let alice = getTestUser("alice"); let alice = getTestUser("alice");
let bob = getTestUser("bob"); let bob = getTestUser("bob");

View File

@ -630,6 +630,7 @@ add_task(
{ skip_if: () => CLIENT_IS_THUNDERBIRD }, { skip_if: () => CLIENT_IS_THUNDERBIRD },
async function test_verification_updates_registration() { async function test_verification_updates_registration() {
const deviceName = "foo"; const deviceName = "foo";
ensureOauthNotConfigured();
const credentials = getTestUser("baz"); const credentials = getTestUser("baz");
const fxa = await MockFxAccounts(credentials, { const fxa = await MockFxAccounts(credentials, {

View File

@ -692,6 +692,7 @@ add_task(async function test_helpers_login_with_customize_sync() {
add_task( add_task(
{ skip_if: () => CLIENT_IS_THUNDERBIRD }, { skip_if: () => CLIENT_IS_THUNDERBIRD },
async function test_helpers_login_with_customize_sync_and_declined_engines() { async function test_helpers_login_with_customize_sync_and_declined_engines() {
ensureOauthNotConfigured();
let configured = false; let configured = false;
let helpers = new FxAccountsWebChannelHelpers({ let helpers = new FxAccountsWebChannelHelpers({
fxAccounts: { fxAccounts: {

View File

@ -729,6 +729,9 @@ add_task(async function test_getHAWKErrors() {
add_task(async function test_getGetKeysFailing401() { add_task(async function test_getGetKeysFailing401() {
_("SyncAuthManager correctly handles 401 responses fetching keys."); _("SyncAuthManager correctly handles 401 responses fetching keys.");
if (Services.prefs.getBoolPref("identity.fxaccounts.oauth.enabled", false)) {
return;
}
_("Arrange for a 401 - Sync should reflect an auth error."); _("Arrange for a 401 - Sync should reflect an auth error.");
let config = makeIdentityConfig(); let config = makeIdentityConfig();
@ -752,6 +755,9 @@ add_task(async function test_getGetKeysFailing401() {
add_task(async function test_getGetKeysFailing503() { add_task(async function test_getGetKeysFailing503() {
_("SyncAuthManager correctly handles 5XX responses fetching keys."); _("SyncAuthManager correctly handles 5XX responses fetching keys.");
if (Services.prefs.getBoolPref("identity.fxaccounts.oauth.enabled", false)) {
return;
}
_("Arrange for a 503 - Sync should reflect a network error."); _("Arrange for a 503 - Sync should reflect a network error.");
let config = makeIdentityConfig(); let config = makeIdentityConfig();
@ -781,6 +787,9 @@ add_task(async function test_getKeysMissing() {
_( _(
"SyncAuthManager correctly handles getKeyForScope succeeding but not returning the key." "SyncAuthManager correctly handles getKeyForScope succeeding but not returning the key."
); );
if (Services.prefs.getBoolPref("identity.fxaccounts.oauth.enabled", false)) {
return;
}
let syncAuthManager = new SyncAuthManager(); let syncAuthManager = new SyncAuthManager();
let identityConfig = makeIdentityConfig(); let identityConfig = makeIdentityConfig();
@ -822,6 +831,10 @@ add_task(async function test_getKeysUnexpecedError() {
"SyncAuthManager correctly handles getKeyForScope throwing an unexpected error." "SyncAuthManager correctly handles getKeyForScope throwing an unexpected error."
); );
if (Services.prefs.getBoolPref("identity.fxaccounts.oauth.enabled", false)) {
return;
}
let syncAuthManager = new SyncAuthManager(); let syncAuthManager = new SyncAuthManager();
let identityConfig = makeIdentityConfig(); let identityConfig = makeIdentityConfig();
// our mock identity config already has scopedKeys - remove them or we never // our mock identity config already has scopedKeys - remove them or we never

View File

@ -11,9 +11,8 @@ add_task(async function test_SHOW_FIREFOX_ACCOUNTS() {
type: "SHOW_FIREFOX_ACCOUNTS", type: "SHOW_FIREFOX_ACCOUNTS",
data: { entrypoint: "snippets" }, data: { entrypoint: "snippets" },
}); });
Assert.equal( Assert.ok(
await loaded, (await loaded).includes("entrypoint=snippets"),
"https://example.com/?context=fx_desktop_v3&entrypoint=snippets&action=email&service=sync",
"should load fxa with endpoint=snippets" "should load fxa with endpoint=snippets"
); );
@ -24,9 +23,8 @@ add_task(async function test_SHOW_FIREFOX_ACCOUNTS() {
data: { entrypoint: "aboutwelcome" }, data: { entrypoint: "aboutwelcome" },
}); });
Assert.equal( Assert.ok(
await loaded, (await loaded).includes("entrypoint=aboutwelcome"),
"https://example.com/?context=fx_desktop_v3&entrypoint=aboutwelcome&action=email&service=sync",
"should load fxa with a custom endpoint" "should load fxa with a custom endpoint"
); );
@ -37,10 +35,12 @@ add_task(async function test_SHOW_FIREFOX_ACCOUNTS() {
data: { entrypoint: "test", extraParams: { foo: "bar" } }, data: { entrypoint: "test", extraParams: { foo: "bar" } },
}); });
Assert.equal( let url = await loaded;
await loaded, Assert.ok(
"https://example.com/?context=fx_desktop_v3&entrypoint=test&action=email&service=sync&foo=bar", url.includes("entrypoint=test") &&
"should load fxa with a custom endpoint and extra parameters in url" url.includes("foo=bar") &&
url.includes("service=sync"),
"should have correct url params"
); );
}); });
@ -55,7 +55,10 @@ add_task(async function test_SHOW_FIREFOX_ACCOUNTS() {
}; };
const tabPromise = BrowserTestUtils.waitForNewTab( const tabPromise = BrowserTestUtils.waitForNewTab(
gBrowser, gBrowser,
"https://example.com/?context=fx_desktop_v3&entrypoint=activity-stream-firstrun&action=email&service=sync" url =>
url.startsWith("https://example.com") &&
url.includes("entrypoint=activity-stream-firstrun") &&
url.includes("service=sync")
); );
await SpecialMessageActions.handleAction(action, gBrowser); await SpecialMessageActions.handleAction(action, gBrowser);

View File

@ -7,7 +7,11 @@ Services.scriptloader.loadSubScript(
add_setup(async () => { add_setup(async () => {
await SpecialPowers.pushPrefEnv({ await SpecialPowers.pushPrefEnv({
set: [["signon.firefoxRelay.showToAllBrowsers", true]], set: [
["signon.firefoxRelay.showToAllBrowsers", true],
["identity.fxaccounts.oauth.enabled", false],
["identity.fxaccounts.contextParam", "fx_desktop_v3"],
],
}); });
}); });