Bug 1153708 - put the FxA profile fetch behind the same pref used to display the avatar. r=zaach a=lizzard
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 06 May 2015 11:38:06 +1000
changeset 265939 d485b942568944d93918780890ca4703ab69885d
parent 265938 5faa81160a2e5ee71a39152f2f32f5834c95be9e
child 265940 f0b8c5191337b3a18f9963dc93a706d1aac1017d
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszaach, lizzard
bugs1153708
milestone39.0a2
Bug 1153708 - put the FxA profile fetch behind the same pref used to display the avatar. r=zaach a=lizzard
browser/components/preferences/in-content/sync.js
--- a/browser/components/preferences/in-content/sync.js
+++ b/browser/components/preferences/in-content/sync.js
@@ -296,19 +296,25 @@ let gSyncPane = {
         }
 
         // Clear the profile image (if any) of the previously logged in account.
         document.getElementById("fxaProfileImage").style.removeProperty("background-image");
 
         // If the account is verified the next promise in the chain will
         // fetch profile data.
         return data.verified;
-      }).then(shouldGetProfile => {
-        if (shouldGetProfile) {
-          return fxAccounts.getSignedInUserProfile();
+      }).then(isVerified => {
+        if (isVerified) {
+          let enabled;
+          try {
+            enabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled");
+          } catch (ex) {}
+          if (enabled) {
+            return fxAccounts.getSignedInUserProfile();
+          }
         }
       }).then(data => {
         if (data && data.avatar) {
           // Make sure the image is available before displaying it,
           // as we don't want to overwrite the default profile image
           // with a broken/unavailable image
           let img = new Image();
           img.onload = () => {