Bug 981140 - Make the FxA signup uri pref and path explicitly reference signup. r=markh

This commit is contained in:
Chris Karlof 2014-03-11 15:58:27 -07:00
parent 1bf9f76377
commit 2faf3c1b66
6 changed files with 17 additions and 17 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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

View File

@ -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");
}

View File

@ -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();
});

View File

@ -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 {