From 2faf3c1b665d7af8544e47fa4b128286910281d0 Mon Sep 17 00:00:00 2001 From: Chris Karlof Date: Tue, 11 Mar 2014 15:58:27 -0700 Subject: [PATCH] Bug 981140 - Make the FxA signup uri pref and path explicitly reference signup. r=markh --- browser/app/profile/firefox.js | 7 +++---- browser/base/content/aboutaccounts/aboutaccounts.js | 4 ++-- .../base/content/test/general/browser_aboutAccounts.js | 8 ++++---- services/fxaccounts/FxAccounts.jsm | 6 +++--- services/fxaccounts/tests/xpcshell/test_accounts.js | 6 +++--- services/sync/modules/util.js | 3 ++- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index aae3856c214..2f29a75539c 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1384,9 +1384,8 @@ pref("browser.uiCustomization.debug", false); // CustomizableUI state of the browser's user interface pref("browser.uiCustomization.state", ""); -// The URL where remote content that composes the UI for Firefox Accounts should -// be fetched. Must use HTTPS. -pref("identity.fxaccounts.remote.uri", "https://accounts.firefox.com/?service=sync&context=fx_desktop_v1"); +// The remote content URL shown for FxA signup. Must use HTTPS. +pref("identity.fxaccounts.remote.signup.uri", "https://accounts.firefox.com/signup?service=sync&context=fx_desktop_v1"); // The URL where remote content that forces re-authentication for Firefox Accounts // should be fetched. Must use HTTPS. @@ -1397,7 +1396,7 @@ pref("identity.fxaccounts.remote.signin.uri", "https://accounts.firefox.com/sign // The URL we take the user to when they opt to "manage" their Firefox Account. // Note that this will always need to be in the same TLD as the -// "identity.fxaccounts.remote.uri" pref. +// "identity.fxaccounts.remote.signup.uri" pref. pref("identity.fxaccounts.settings.uri", "https://accounts.firefox.com/settings"); // On GTK, we now default to showing the menubar only when alt is pressed: diff --git a/browser/base/content/aboutaccounts/aboutaccounts.js b/browser/base/content/aboutaccounts/aboutaccounts.js index 641267462cf..2a77dec702b 100644 --- a/browser/base/content/aboutaccounts/aboutaccounts.js +++ b/browser/base/content/aboutaccounts/aboutaccounts.js @@ -100,7 +100,7 @@ let wrapper = { iframe.addEventListener("load", this); try { - iframe.src = url || fxAccounts.getAccountsURI(); + iframe.src = url || fxAccounts.getAccountsSignUpURI(); } catch (e) { error("Couldn't init Firefox Account wrapper: " + e.message); } @@ -223,7 +223,7 @@ let wrapper = { injectData: function (type, content) { let authUrl; try { - authUrl = fxAccounts.getAccountsURI(); + authUrl = fxAccounts.getAccountsSignUpURI(); } catch (e) { error("Couldn't inject data: " + e.message); return; diff --git a/browser/base/content/test/general/browser_aboutAccounts.js b/browser/base/content/test/general/browser_aboutAccounts.js index a1512479fd1..517cc7291e6 100644 --- a/browser/base/content/test/general/browser_aboutAccounts.js +++ b/browser/base/content/test/general/browser_aboutAccounts.js @@ -34,7 +34,7 @@ let gTests = [ }, run: function* () { - setPref("identity.fxaccounts.remote.uri", + setPref("identity.fxaccounts.remote.signup.uri", "https://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html"); yield promiseNewTabLoadEvent("about:accounts"); @@ -115,7 +115,7 @@ let gTests = [ run: function* () { const expected_url = "https://example.com/?is_sign_up"; - setPref("identity.fxaccounts.remote.uri", expected_url); + setPref("identity.fxaccounts.remote.signup.uri", expected_url); let [tab, url] = yield promiseNewTabWithIframeLoadEvent("about:accounts?action=signup"); is(url, expected_url, "action=signup got the expected URL"); // we expect the remote iframe to be shown. @@ -133,7 +133,7 @@ let gTests = [ run: function* () { const expected_url = "https://example.com/?is_sign_up"; - setPref("identity.fxaccounts.remote.uri", expected_url); + setPref("identity.fxaccounts.remote.signup.uri", expected_url); yield setSignedInUser(); let tab = yield promiseNewTabLoadEvent("about:accounts?action=signup"); yield fxAccounts.getSignedInUser(); @@ -179,7 +179,7 @@ let gTests = [ gBrowser.removeCurrentTab(); }, run: function* () { - setPref("identity.fxaccounts.remote.uri", "https://example.com/"); + setPref("identity.fxaccounts.remote.signup.uri", "https://example.com/"); yield setSignedInUser(); let tab = yield promiseNewTabLoadEvent("about:accounts"); // sign the user out - the tab should have action=signin diff --git a/services/fxaccounts/FxAccounts.jsm b/services/fxaccounts/FxAccounts.jsm index 67d3bf99c29..b09c3099c4c 100644 --- a/services/fxaccounts/FxAccounts.jsm +++ b/services/fxaccounts/FxAccounts.jsm @@ -26,7 +26,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "jwcrypto", let publicProperties = [ "getAccountsClient", "getAccountsSignInURI", - "getAccountsURI", + "getAccountsSignUpURI", "getAssertion", "getKeys", "getSignedInUser", @@ -673,8 +673,8 @@ FxAccountsInternal.prototype = { }, // Return the URI of the remote UI flows. - getAccountsURI: function() { - let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.uri"); + getAccountsSignUpURI: function() { + let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signup.uri"); if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting throw new Error("Firefox Accounts server must use HTTPS"); } diff --git a/services/fxaccounts/tests/xpcshell/test_accounts.js b/services/fxaccounts/tests/xpcshell/test_accounts.js index 549ee740986..ea49b1ed470 100644 --- a/services/fxaccounts/tests/xpcshell/test_accounts.js +++ b/services/fxaccounts/tests/xpcshell/test_accounts.js @@ -122,13 +122,13 @@ function MockFxAccounts() { add_test(function test_non_https_remote_server_uri() { Services.prefs.setCharPref( - "identity.fxaccounts.remote.uri", + "identity.fxaccounts.remote.signup.uri", "http://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html"); do_check_throws_message(function () { - fxAccounts.getAccountsURI(); + fxAccounts.getAccountsSignUpURI(); }, "Firefox Accounts server must use HTTPS"); - Services.prefs.clearUserPref("identity.fxaccounts.remote.uri"); + Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri"); run_next_test(); }); diff --git a/services/sync/modules/util.js b/services/sync/modules/util.js index c857863452c..4137d817199 100644 --- a/services/sync/modules/util.js +++ b/services/sync/modules/util.js @@ -620,7 +620,8 @@ this.Utils = { // The FxA hosts - these almost certainly all have the same hostname, but // better safe than sorry... for (let prefName of ["identity.fxaccounts.remote.force_auth.uri", - "identity.fxaccounts.remote.uri", + "identity.fxaccounts.remote.signup.uri", + "identity.fxaccounts.remote.signin.uri", "identity.fxaccounts.settings.uri"]) { let prefVal; try {