Bug 1590231 - Update sync preferences panel to match decouple designs r=fluent-reviewers,markh

Differential Revision: https://phabricator.services.mozilla.com/D50931

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Vijay Budhram 2019-11-06 16:51:03 +00:00
Родитель 668a7ff148
Коммит b9c626a520
17 изменённых файлов: 33 добавлений и 64 удалений

Просмотреть файл

@ -707,7 +707,7 @@ var gSync = {
},
async openFxAEmailFirstPage(entryPoint) {
const url = await FxAccounts.config.promiseEmailFirstURI(entryPoint);
const url = await FxAccounts.config.promiseConnectAccountURI(entryPoint);
switchToTabHavingURI(url, true, { replaceQueryString: true });
},

Просмотреть файл

@ -1926,7 +1926,9 @@ class _ASRouter {
});
break;
case ra.SHOW_FIREFOX_ACCOUNTS:
const url = await FxAccounts.config.promiseSignUpURI("snippets");
const url = await FxAccounts.config.promiseConnectAccountURI(
"snippets"
);
// We want to replace the current tab.
target.browser.ownerGlobal.openLinkIn(url, "current", {
private: false,

Просмотреть файл

@ -137,7 +137,9 @@ class _BookmarkPanelHub {
recommendation.setAttribute("id", "cfrMessageContainer");
recommendation.addEventListener("click", async e => {
target.hidePopup();
const url = await FxAccounts.config.promiseEmailFirstURI("bookmark");
const url = await FxAccounts.config.promiseConnectAccountURI(
"bookmark"
);
win.ownerGlobal.openLinkIn(url, "tabshifted", {
private: false,
triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal(

Просмотреть файл

@ -2026,7 +2026,9 @@ describe("ASRouter", () => {
describe("#onMessage: SHOW_FIREFOX_ACCOUNTS", () => {
beforeEach(() => {
globals.set("FxAccounts", {
config: { promiseSignUpURI: sandbox.stub().resolves("some/url") },
config: {
promiseConnectAccountURI: sandbox.stub().resolves("some/url"),
},
});
});
it("should call openLinkIn with the correct params on OPEN_URL", async () => {

Просмотреть файл

@ -34,7 +34,7 @@ describe("OnboardingMessage", () => {
globals = new GlobalOverrider();
sandbox = sinon.createSandbox();
globals.set("FxAccountsConfig", {
promiseEmailFirstURI: sandbox.stub().resolves("some/url"),
promiseConnectAccountURI: sandbox.stub().resolves("some/url"),
});
globals.set("AddonRepository", {
getAddonsByIDs: ([content]) => [

Просмотреть файл

@ -28,7 +28,7 @@ describe("BookmarkPanelHub", () => {
return fakeL10n;
}); // eslint-disable-line prefer-arrow-callback
globals.set("FxAccounts", {
config: { promiseEmailFirstURI: sandbox.stub() },
config: { promiseConnectAccountURI: sandbox.stub() },
});
isBrowserPrivateStub = sandbox.stub().returns(false);
globals.set("PrivateBrowsingUtils", {

Просмотреть файл

@ -353,7 +353,7 @@ const TEST_GLOBAL = {
}
},
FxAccountsConfig: {
promiseEmailFirstURI(id) {
promiseConnectAccountURI(id) {
return Promise.resolve(id);
},
},

Просмотреть файл

@ -857,7 +857,9 @@ var gMainPane = {
win.openTrustedLinkIn("about:preferences#sync", "current");
return;
}
let url = await FxAccounts.config.promiseSignInURI("dev-edition-setup");
let url = await FxAccounts.config.promiseConnectAccountURI(
"dev-edition-setup"
);
let accountsTab = win.gBrowser.addWebTab(url);
win.gBrowser.selectedTab = accountsTab;
},

Просмотреть файл

@ -26,23 +26,12 @@
</vbox>
</hbox>
<hbox id="fxaNoLoginStatus" align="center" flex="1">
<vbox>
<image class="fxaProfileImage"/>
</vbox>
<vbox flex="1">
<hbox align="center" flex="1">
<hbox align="center" flex="1">
<label id="signedOutAccountBoxTitle"><html:h2 data-l10n-id="sync-signedout-account-title"/></label>
</hbox>
<button id="noFxaSignIn"
is="highlightable-button"
class="accessory-button"
data-l10n-id="sync-signedout-account-signin"/>
</hbox>
<hbox align="center" flex="1">
<html:a id="noFxaSignUp"
class="openLink"
data-l10n-id="sync-signedout-account-create" />
data-l10n-id="sync-signedout-account-signin2"/>
</hbox>
</vbox>
</hbox>

Просмотреть файл

@ -133,12 +133,6 @@ var gSyncPane = {
}
}
FxAccounts.config
.promiseSignUpURI(this._getEntryPoint())
.then(signUpURI => {
document.getElementById("noFxaSignUp").setAttribute("href", signUpURI);
});
this.updateWeavePrefs();
// Notify observers that the UI is now ready
@ -456,7 +450,9 @@ var gSyncPane = {
},
async signIn() {
const url = await FxAccounts.config.promiseSignInURI(this._getEntryPoint());
const url = await FxAccounts.config.promiseConnectAccountURI(
this._getEntryPoint()
);
this.replaceTabWithUrl(url);
},
@ -468,7 +464,7 @@ var gSyncPane = {
let entryPoint = this._getEntryPoint();
const url =
(await FxAccounts.config.promiseForceSigninURI(entryPoint)) ||
(await FxAccounts.config.promiseSignInURI(entryPoint));
(await FxAccounts.config.promiseConnectAccountURI(entryPoint));
this.replaceTabWithUrl(url);
},

Просмотреть файл

@ -20,8 +20,6 @@ add_task(async function() {
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneSync", { leaveOpen: true });
// Ensure the "Sign Up" button in the hidden child of the <xul:deck>
// is selected and displayed on the screen.
let weavePrefsDeck = gBrowser.contentDocument.getElementById(
"weavePrefsDeck"
);
@ -30,12 +28,6 @@ add_task(async function() {
0,
"Should select the #noFxaAccount child node"
);
let noFxaSignUp = weavePrefsDeck.children[0].querySelector("#noFxaSignUp");
is(
noFxaSignUp.textContent,
"Don\u2019t have an account? Get started",
"The Sign Up button should exist"
);
// Performs search.
let searchInput = gBrowser.contentDocument.getElementById("searchInput");

Просмотреть файл

@ -529,7 +529,7 @@ var UITour = {
.then(() => {
return data.email
? FxAccounts.config.promiseEmailURI(data.email, "uitour")
: FxAccounts.config.promiseSignUpURI("uitour");
: FxAccounts.config.promiseConnectAccountURI("uitour");
})
.then(uri => {
const url = new URL(uri);

Просмотреть файл

@ -67,7 +67,7 @@ add_UITour_task(async function test_firefoxAccountsNoParams() {
await BrowserTestUtils.browserLoaded(
gTestTab.linkedBrowser,
false,
"https://example.com/signup?service=sync&context=fx_desktop_v3&entrypoint=uitour"
"https://example.com/?service=sync&context=fx_desktop_v3&entrypoint=uitour&action=email"
);
});
@ -77,7 +77,7 @@ add_UITour_task(async function test_firefoxAccountsValidParams() {
await BrowserTestUtils.browserLoaded(
gTestTab.linkedBrowser,
false,
"https://example.com/signup?service=sync&context=fx_desktop_v3&entrypoint=uitour&utm_foo=foo&utm_bar=bar"
"https://example.com/?service=sync&context=fx_desktop_v3&entrypoint=uitour&action=email&utm_foo=foo&utm_bar=bar"
);
});
@ -103,7 +103,7 @@ add_UITour_task(async function test_firefoxAccountsNonAlphaValue() {
await BrowserTestUtils.browserLoaded(
gTestTab.linkedBrowser,
false,
"https://example.com/signup?service=sync&context=fx_desktop_v3&entrypoint=uitour&utm_foo=" +
"https://example.com/?service=sync&context=fx_desktop_v3&entrypoint=uitour&action=email&utm_foo=" +
expected
);
});

Просмотреть файл

@ -711,13 +711,9 @@ containers-remove-button =
sync-signedout-caption = Take Your Web With You
sync-signedout-description = Synchronize your bookmarks, history, tabs, passwords, add-ons, and preferences across all your devices.
sync-signedout-account-title = Connect with a { -fxaccount-brand-name }
sync-signedout-account-create = Dont have an account? Get started
.accesskey = c
sync-signedout-account-signin =
.label = Sign In…
.accesskey = I
sync-signedout-account-signin2 =
.label = Sign in to { -sync-brand-short-name }…
.accesskey = i
# This message contains two links and two icon images.
# `<img data-l10n-name="android-icon"/>` - Android logo icon

Просмотреть файл

@ -56,25 +56,13 @@ const CONFIG_PREFS = [
];
var FxAccountsConfig = {
async promiseSignUpURI(entrypoint, extraParams = {}) {
return this._buildURL("signup", {
extraParams: { entrypoint, ...extraParams },
});
},
async promiseSignInURI(entrypoint, extraParams = {}) {
return this._buildURL("signin", {
extraParams: { entrypoint, ...extraParams },
});
},
async promiseEmailURI(email, entrypoint, extraParams = {}) {
return this._buildURL("", {
extraParams: { entrypoint, email, ...extraParams },
});
},
async promiseEmailFirstURI(entrypoint, extraParams = {}) {
async promiseConnectAccountURI(entrypoint, extraParams = {}) {
return this._buildURL("", {
extraParams: { entrypoint, action: "email", ...extraParams },
});

Просмотреть файл

@ -15,8 +15,8 @@ add_task(
"http://example.com/"
);
Assert.equal(
await FxAccounts.config.promiseSignUpURI("test"),
"http://example.com/signup?service=sync&context=null&entrypoint=test"
await FxAccounts.config.promiseConnectAccountURI("test"),
"http://example.com/?service=sync&context=null&entrypoint=test&action=email"
);
Services.prefs.clearUserPref("identity.fxaccounts.remote.root");
@ -30,7 +30,7 @@ add_task(async function test_non_https_remote_server_uri() {
"http://example.com/"
);
await Assert.rejects(
FxAccounts.config.promiseSignUpURI(),
FxAccounts.config.promiseConnectAccountURI(),
/Firefox Accounts server must use HTTPS/
);
Services.prefs.clearUserPref("identity.fxaccounts.remote.root");

Просмотреть файл

@ -250,7 +250,7 @@ class ChromeMessagePort extends MessagePort {
// Called when the content process is requesting some data.
async handleRequest(name, data) {
if (name == "FxAccountsEndpoint") {
return FxAccounts.config.promiseEmailFirstURI(data);
return FxAccounts.config.promiseConnectAccountURI(data);
}
throw new Error(`Unknown request ${name}.`);