Bug 1383663 part 1 - Revert bug 1385191 changes. r?markh draft
authorEdouard Oger <eoger@fastmail.com>
Mon, 21 Aug 2017 17:06:06 -0400
changeset 665955 e0510ea461479f03747f7ec89144cc6171b57ec4
parent 665954 34e2566a71f160eb3c5c3d92626453852e818f18
child 665956 2c3efe762d7a46dae42dd0aef4613bb16054dfc6
push id80234
push userbmo:eoger@fastmail.com
push dateSat, 16 Sep 2017 19:17:57 +0000
reviewersmarkh
bugs1383663, 1385191
milestone57.0a1
Bug 1383663 part 1 - Revert bug 1385191 changes. r?markh This reverts commit 3f279247b875becd0c617fa6dc31cdf9f1349374. MozReview-Commit-ID: FuCMewhO20z
browser/components/preferences/in-content/sync.js
services/sync/modules/UIState.jsm
services/sync/tests/unit/test_uistate.js
--- a/browser/components/preferences/in-content/sync.js
+++ b/browser/components/preferences/in-content/sync.js
@@ -314,23 +314,16 @@ var gSyncPane = {
     }).then(isVerified => {
       if (isVerified) {
         return fxAccounts.getSignedInUserProfile();
       }
       return null;
     }).then(data => {
       let fxaLoginStatus = document.getElementById("fxaLoginStatus");
       if (data) {
-        if (data.email) {
-          // A hack to handle that the user's email address may have changed.
-          // This can probably be removed as part of bug 1383663.
-          fxaEmailAddressLabels.forEach((label) => {
-            label.value = data.email;
-          });
-        }
         if (data.displayName) {
           fxaLoginStatus.setAttribute("hasName", true);
           displayNameLabel.hidden = false;
           displayNameLabel.textContent = data.displayName;
         } else {
           fxaLoginStatus.removeAttribute("hasName");
         }
         if (data.avatar) {
--- a/services/sync/modules/UIState.jsm
+++ b/services/sync/modules/UIState.jsm
@@ -157,19 +157,16 @@ const UIStateInternal = {
       state.email = userData.email;
     }
     state.status = status;
   },
 
   _populateWithProfile(state, profile) {
     state.displayName = profile.displayName;
     state.avatarURL = profile.avatar;
-    // A hack to handle that the user's email address may have changed.
-    // This can probably be removed as part of bug 1383663.
-    state.email = profile.email;
   },
 
   async _getUserData() {
     try {
       return await this.fxAccounts.getSignedInUser();
     } catch (e) {
       // This is most likely in tests, where we quickly log users in and out.
       // The most likely scenario is a user logged out, so reflect that.
--- a/services/sync/tests/unit/test_uistate.js
+++ b/services/sync/tests/unit/test_uistate.js
@@ -48,58 +48,32 @@ add_task(async function test_refreshStat
   const fxAccountsOrig = UIStateInternal.fxAccounts;
 
   const now = new Date().toString();
   Services.prefs.setCharPref("services.sync.lastSync", now);
   UIStateInternal.syncing = false;
 
   UIStateInternal.fxAccounts = {
     getSignedInUser: () => Promise.resolve({ verified: true, email: "foo@bar.com" }),
-    getSignedInUserProfile: () => Promise.resolve({ displayName: "Foo Bar", avatar: "https://foo/bar", email: "foo@bar.com" }),
+    getSignedInUserProfile: () => Promise.resolve({ displayName: "Foo Bar", avatar: "https://foo/bar" }),
     hasLocalSession: () => Promise.resolve(true),
   }
 
   let state = await UIState.refresh();
 
   equal(state.status, UIState.STATUS_SIGNED_IN);
   equal(state.email, "foo@bar.com");
   equal(state.displayName, "Foo Bar");
   equal(state.avatarURL, "https://foo/bar");
   equal(state.lastSync, now);
   equal(state.syncing, false);
 
   UIStateInternal.fxAccounts = fxAccountsOrig;
 });
 
-add_task(async function test_refreshState_preferProfileEmail() {
-  UIState.reset();
-  const fxAccountsOrig = UIStateInternal.fxAccounts;
-
-  const now = new Date().toString();
-  Services.prefs.setCharPref("services.sync.lastSync", now);
-  UIStateInternal.syncing = false;
-
-  UIStateInternal.fxAccounts = {
-    getSignedInUser: () => Promise.resolve({ verified: true, email: "foo@bar.com" }),
-    getSignedInUserProfile: () => Promise.resolve({ displayName: "Foo Bar", avatar: "https://foo/bar", email: "bar@foo.com" }),
-    hasLocalSession: () => Promise.resolve(true),
-  }
-
-  let state = await UIState.refresh();
-
-  equal(state.status, UIState.STATUS_SIGNED_IN);
-  equal(state.email, "bar@foo.com");
-  equal(state.displayName, "Foo Bar");
-  equal(state.avatarURL, "https://foo/bar");
-  equal(state.lastSync, now);
-  equal(state.syncing, false);
-
-  UIStateInternal.fxAccounts = fxAccountsOrig;
-});
-
 add_task(async function test_refreshState_signedin_profile_unavailable() {
   UIState.reset();
   const fxAccountsOrig = UIStateInternal.fxAccounts;
 
   const now = new Date().toString();
   Services.prefs.setCharPref("services.sync.lastSync", now);
   UIStateInternal.syncing = false;