Bug 1392959 - send action=email when UITour called with email option;r=rexboy
MozReview-Commit-ID: J08pXaJwAhh
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -558,28 +558,33 @@ this.UITour = {
log.warn("openPreferences: Invalid pane specified");
return false;
}
window.openPreferences(data.pane, { origin: "UITour" });
break;
}
case "showFirefoxAccounts": {
- // 'signup' is the only action that makes sense currently, so we don't
- // accept arbitrary actions just to be safe...
- let p = new URLSearchParams("action=signup&entrypoint=uitour");
+ let p;
+ if (data.email) {
+ // With email parameter added, we need to use 'email' action to help FxA determine
+ // whether the email is registered or not and direct the user down the correct flow
+ p = new URLSearchParams("action=email&entrypoint=uitour");
+ p.append("email", data.email);
+ } else {
+ // 'signup' is the default action that makes sense currently, so we don't
+ // accept arbitrary actions just to be safe...
+ p = new URLSearchParams("action=signup&entrypoint=uitour");
+ }
// Call our helper to validate extraURLCampaignParams and populate URLSearchParams
if (!this._populateCampaignParams(p, data.extraURLCampaignParams)) {
log.warn("showFirefoxAccounts: invalid campaign args specified");
return false;
}
- if (data.email) {
- p.append("email", data.email);
- }
// We want to replace the current tab.
browser.loadURI("about:accounts?" + p.toString());
break;
}
case "resetFirefox": {
// Open a reset profile dialog window.
if (ResetProfile.resetSupported()) {
--- a/browser/components/uitour/test/browser_UITour_sync.js
+++ b/browser/components/uitour/test/browser_UITour_sync.js
@@ -64,17 +64,17 @@ add_UITour_task(async function test_fire
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
"about:accounts?action=signup&entrypoint=uitour&utm_foo=foo&utm_bar=bar");
});
add_UITour_task(async function test_firefoxAccountsWithEmail() {
info("Load about:accounts containing an iframe to https://accounts.firefox.com");
await gContentAPI.showFirefoxAccounts(null, "foo@bar.com");
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
- "about:accounts?action=signup&entrypoint=uitour&email=foo%40bar.com");
+ "about:accounts?action=email&entrypoint=uitour&email=foo%40bar.com");
});
add_UITour_task(async function test_firefoxAccountsNonAlphaValue() {
// All characters in the value are allowed, but they must be automatically escaped.
// (we throw a unicode character in there too - it's not auto-utf8 encoded,
// but that's ok, so long as it is escaped correctly.)
let value = "foo& /=?:\\\xa9";
// encodeURIComponent encodes spaces to %20 but we want "+"