Backed out 2 changesets (bug 1098661, bug 1109430) for leaking prefs windows
authorPhil Ringnalda <philringnalda@gmail.com>
Tue, 16 Dec 2014 23:57:10 -0800
changeset 220240 a76b8d5ee8dcce79138921a134005be9e99c6217
parent 220239 1b8f23ce8a7a668e9ede2ca4c2f0c3f20dbb858e
child 220241 fbe5dc1dfcfcf4654340e15ae3b5e86aae02f47f
push id53051
push userryanvm@gmail.com
push dateThu, 18 Dec 2014 02:08:11 +0000
treeherdermozilla-inbound@ffb2b4550976 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1098661, 1109430
milestone37.0a1
backs out1b8f23ce8a7a668e9ede2ca4c2f0c3f20dbb858e
069da43ec3be3987b2cb875462f99b0c12a5caa8
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1098661, bug 1109430) for leaking prefs windows CLOSED TREE Backed out changeset 1b8f23ce8a7a (bug 1109430) Backed out changeset 069da43ec3be (bug 1098661)
browser/base/content/browser-fxaccounts.js
browser/components/preferences/in-content/sync.js
browser/components/preferences/in-content/sync.xul
browser/components/preferences/sync.js
browser/locales/en-US/chrome/browser/accounts.properties
browser/locales/en-US/chrome/browser/preferences/preferences.properties
browser/locales/en-US/chrome/browser/preferences/sync.dtd
browser/themes/shared/incontentprefs/preferences.inc.css
services/sync/modules/FxaMigrator.jsm
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -326,19 +326,17 @@ let gFxAccounts = {
       break;
     case "error":
       this.openSignInAgainPage("menupanel");
       break;
     case "migrate-signup":
       fxaMigrator.createFxAccount(window);
       break;
     case "migrate-verify":
-      // Instead of using the migrator module directly here the UX calls for
-      // us to open prefs which has a "resend" button.
-      this.openPreferences();
+      fxaMigrator.resendVerificationMail();
       break;
     default:
       this.openAccountsPage(null, { entryPoint: "menupanel" });
       break;
     }
 
     PanelUI.hide();
   },
--- a/browser/components/preferences/in-content/sync.js
+++ b/browser/components/preferences/in-content/sync.js
@@ -4,38 +4,33 @@
 
 Components.utils.import("resource://services-sync/main.js");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () {
   return Components.utils.import("resource://gre/modules/FxAccountsCommon.js", {});
 });
 
-XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
-  "resource://gre/modules/FxAccounts.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "fxaMigrator",
-  "resource://services-sync/FxaMigrator.jsm");
-
 const PAGE_NO_ACCOUNT = 0;
 const PAGE_HAS_ACCOUNT = 1;
 const PAGE_NEEDS_UPDATE = 2;
 const PAGE_PLEASE_WAIT = 3;
 const FXA_PAGE_LOGGED_OUT = 4;
 const FXA_PAGE_LOGGED_IN = 5;
 
 // Indexes into the "login status" deck.
 // We are in a successful verified state - everything should work!
 const FXA_LOGIN_VERIFIED = 0;
 // We have logged in to an unverified account.
 const FXA_LOGIN_UNVERIFIED = 1;
 // We are logged in locally, but the server rejected our credentials.
 const FXA_LOGIN_FAILED = 2;
 
 let gSyncPane = {
+  _stringBundle: null,
   prefArray: ["engine.bookmarks", "engine.passwords", "engine.prefs",
               "engine.tabs", "engine.history"],
 
   get page() {
     return document.getElementById("weavePrefsDeck").selectedIndex;
   },
 
   set page(val) {
@@ -91,48 +86,31 @@ let gSyncPane = {
 
   _init: function () {
     let topics = ["weave:service:login:error",
                   "weave:service:login:finish",
                   "weave:service:start-over:finish",
                   "weave:service:setup-complete",
                   "weave:service:logout:finish",
                   FxAccountsCommon.ONVERIFIED_NOTIFICATION];
-    let migrateTopic = "fxa-migration:state-changed";
 
     // Add the observers now and remove them on unload
     //XXXzpao This should use Services.obs.* but Weave's Obs does nice handling
     //        of `this`. Fix in a followup. (bug 583347)
     topics.forEach(function (topic) {
       Weave.Svc.Obs.add(topic, this.updateWeavePrefs, this);
     }, this);
-    // The FxA migration observer is a special case.
-    Weave.Svc.Obs.add(migrateTopic, this.updateMigrationState, this);
-
     window.addEventListener("unload", function() {
       topics.forEach(function (topic) {
         Weave.Svc.Obs.remove(topic, this.updateWeavePrefs, this);
       }, gSyncPane);
-      Weave.Svc.Obs.remove(migrateTopic, this.updateMigrationState, this);
     }, false);
 
-    // ask the migration module to broadcast its current state (and nothing will
-    // happen if it's not loaded - which is good, as that means no migration
-    // is pending/necessary) - we don't want to suck that module in just to
-    // find there's nothing to do.
-    Services.obs.notifyObservers(null, "fxa-migration:state-request", null);
-
-    XPCOMUtils.defineLazyGetter(this, '_stringBundle', () => {
-      return Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
-    }),
-
-    XPCOMUtils.defineLazyGetter(this, '_accountsStringBundle', () => {
-      return Services.strings.createBundle("chrome://browser/locale/accounts.properties");
-    }),
-
+    this._stringBundle =
+      Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
     this.updateWeavePrefs();
   },
 
   _setupEventListeners: function() {
     function setEventListener(aId, aEventType, aCallback)
     {
       document.getElementById(aId)
               .addEventListener(aEventType, aCallback.bind(gSyncPane));
@@ -209,38 +187,28 @@ let gSyncPane = {
     setEventListener("rejectUnlinkFxaAccount", "click", function () {
       gSyncPane.unlinkFirefoxAccount(true);
     });
     setEventListener("fxaSyncComputerName", "change", function () {
       gSyncUtils.changeName(this);
     });
     setEventListener("tosPP-small-ToS", "click", gSyncPane.openToS);
     setEventListener("tosPP-small-PP", "click", gSyncPane.openPrivacyPolicy);
-    setEventListener("sync-migrate-upgrade", "click", function () {
-      let win = Services.wm.getMostRecentWindow("navigator:browser");
-      fxaMigrator.createFxAccount(win);
-    });
-    setEventListener("sync-migrate-forget", "click", function () {
-      fxaMigrator.forgetFxAccount();
-    });
-    setEventListener("sync-migrate-resend", "click", function () {
-      let win = Services.wm.getMostRecentWindow("navigator:browser");
-      fxaMigrator.resendVerificationMail(win);
-    });
   },
 
   updateWeavePrefs: function () {
     let service = Components.classes["@mozilla.org/weave/service;1"]
                   .getService(Components.interfaces.nsISupports)
                   .wrappedJSObject;
     // service.fxAccountsEnabled is false iff sync is already configured for
     // the legacy provider.
     if (service.fxAccountsEnabled) {
       // determine the fxa status...
       this.page = PAGE_PLEASE_WAIT;
+      Components.utils.import("resource://gre/modules/FxAccounts.jsm");
       fxAccounts.getSignedInUser().then(data => {
         if (!data) {
           this.page = FXA_PAGE_LOGGED_OUT;
           return;
         }
         this.page = FXA_PAGE_LOGGED_IN;
         // We are logged in locally, but maybe we are in a state where the
         // server rejected our credentials (eg, password changed on the server)
@@ -289,55 +257,16 @@ let gSyncPane = {
     } else {
       this.page = PAGE_HAS_ACCOUNT;
       document.getElementById("accountName").textContent = Weave.Service.identity.account;
       document.getElementById("syncComputerName").value = Weave.Service.clientsEngine.localName;
       document.getElementById("tosPP-normal").hidden = this._usingCustomServer;
     }
   },
 
-  updateMigrationState: function(subject, state) {
-    let selIndex;
-    switch (state) {
-      case fxaMigrator.STATE_USER_FXA: {
-        let sb = this._accountsStringBundle;
-        let button = document.getElementById("sync-migrate-upgrade");
-        button.setAttribute("label", sb.GetStringFromName("upgradeToFxA.label"));
-        button.setAttribute("accesskey", sb.GetStringFromName("upgradeToFxA.accessKey"));
-        selIndex = 0;
-        break;
-      }
-      case fxaMigrator.STATE_USER_FXA_VERIFIED: {
-        let sb = this._accountsStringBundle;
-        let email = subject.QueryInterface(Components.interfaces.nsISupportsString).data;
-        let label = sb.formatStringFromName("needVerifiedUserLong", [email], 1);
-        let elt = document.getElementById("sync-migrate-verify-label");
-        elt.setAttribute("value", label);
-        // The "resend" button.
-        let button = document.getElementById("sync-migrate-resend");
-        button.setAttribute("label", sb.GetStringFromName("resendVerificationEmail.label"));
-        button.setAttribute("accesskey", sb.GetStringFromName("resendVerificationEmail.accessKey"));
-        // The "forget" button.
-        button = document.getElementById("sync-migrate-forget");
-        button.setAttribute("label", sb.GetStringFromName("forgetMigration.label"));
-        button.setAttribute("accesskey", sb.GetStringFromName("forgetMigration.accessKey"));
-        selIndex = 1;
-        break;
-      }
-      default:
-        if (state) { // |null| is expected, but everything else is not.
-          Cu.reportError("updateMigrationState has unknown state: " + state);
-        }
-        document.getElementById("sync-migration").hidden = true;
-        return;
-    }
-    document.getElementById("sync-migration").hidden = false;
-    document.getElementById("sync-migration-deck").selectedIndex = selIndex;
-  },
-
   startOver: function (showDialog) {
     if (showDialog) {
       let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
                   Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL + 
                   Services.prompt.BUTTON_POS_1_DEFAULT;
       let buttonChoice =
         Services.prompt.confirmEx(window,
                                   this._stringBundle.GetStringFromName("syncUnlink.title"),
@@ -441,23 +370,24 @@ let gSyncPane = {
   },
 
   manageFirefoxAccount: function() {
     let url = Services.prefs.getCharPref("identity.fxaccounts.settings.uri");
     this.openContentInBrowser(url);
   },
 
   verifyFirefoxAccount: function() {
+    Components.utils.import("resource://gre/modules/FxAccounts.jsm");
     fxAccounts.resendVerificationEmail().then(() => {
       fxAccounts.getSignedInUser().then(data => {
-        let sb = this._accountsStringBundle;
-        let title = sb.GetStringFromName("verificationSentTitle");
-        let heading = sb.formatStringFromName("verificationSentHeading",
+        let sb = this._stringBundle;
+        let title = sb.GetStringFromName("firefoxAccountsVerificationSentTitle");
+        let heading = sb.formatStringFromName("firefoxAccountsVerificationSentHeading",
                                               [data.email], 1);
-        let description = sb.GetStringFromName("verificationSentDescription");
+        let description = sb.GetStringFromName("firefoxAccountVerificationSentDescription");
 
         let factory = Cc["@mozilla.org/prompter;1"]
                         .getService(Ci.nsIPromptFactory);
         let prompt = factory.getPrompt(window, Ci.nsIPrompt);
         let bag = prompt.QueryInterface(Ci.nsIWritablePropertyBag2);
         bag.setPropertyAsBool("allowTabModal", true);
 
         prompt.alert(title, heading + "\n\n" + description);
@@ -495,16 +425,17 @@ let gSyncPane = {
 
       let pressed = prompt.confirmEx(title, body, buttonFlags,
                                      continueLabel, null, null, null, {});
 
       if (pressed != 0) { // 0 is the "continue" button
         return;
       }
     }
+    Cu.import("resource://gre/modules/FxAccounts.jsm");
     fxAccounts.signOut().then(() => {
       this.updateWeavePrefs();
     });
   },
 
   openQuotaDialog: function () {
     let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
     if (win)
--- a/browser/components/preferences/in-content/sync.xul
+++ b/browser/components/preferences/in-content/sync.xul
@@ -32,41 +32,16 @@
 
 <hbox id="header-sync"
       class="header"
       hidden="true"
       data-category="paneSync">
   <label class="header-name">&paneSync.title;</label>
 </hbox>
 
-<hbox id="sync-migration-container"
-       data-category="paneSync"
-       hidden="true">
-
-  <vbox id="sync-migration" flex="1" hidden="true">
-
-    <deck id="sync-migration-deck">
-      <!-- When we are in the "need FxA user" state -->
-      <hbox align="center">
-        <label>&migrate.upgradeNeeded;</label>
-        <spacer flex="1"/>
-        <button id="sync-migrate-upgrade"/>
-      </hbox>
-
-      <!-- When we are in the "need the user to be verified" state -->
-      <hbox align="center">
-        <label id="sync-migrate-verify-label"/>
-        <spacer flex="1"/>
-        <button id="sync-migrate-forget"/>
-        <button id="sync-migrate-resend"/>
-      </hbox>
-    </deck>
-  </vbox>
-</hbox>
-
 <deck id="weavePrefsDeck" data-category="paneSync" hidden="true">
   <!-- These panels are for the "legacy" sync provider -->
   <vbox id="noAccount" align="center">
     <spacer flex="1"/>
     <description id="syncDesc">
       &weaveDesc.label;
     </description>
     <separator/>
--- a/browser/components/preferences/sync.js
+++ b/browser/components/preferences/sync.js
@@ -280,21 +280,21 @@ let gSyncPane = {
     let url = Services.prefs.getCharPref("identity.fxaccounts.settings.uri");
     this.openContentInBrowser(url);
   },
 
   verifyFirefoxAccount: function() {
     Components.utils.import("resource://gre/modules/FxAccounts.jsm");
     fxAccounts.resendVerificationEmail().then(() => {
       fxAccounts.getSignedInUser().then(data => {
-        let sb = Services.strings.createBundle("chrome://browser/locale/accounts.properties");
-        let title = sb.GetStringFromName("verificationSentTitle");
-        let heading = sb.formatStringFromName("verificationSentHeading",
+        let sb = this._stringBundle;
+        let title = sb.GetStringFromName("firefoxAccountsVerificationSentTitle");
+        let heading = sb.formatStringFromName("firefoxAccountsVerificationSentHeading",
                                               [data.email], 1);
-        let description = sb.GetStringFromName("verificationSentDescription");
+        let description = sb.GetStringFromName("firefoxAccountVerificationSentDescription");
 
         Services.prompt.alert(window, title, heading + "\n\n" + description);
       });
     });
   },
 
   openOldSyncSupportPage: function() {
     let url = Services.urlFormatter.formatURLPref('app.support.baseURL') + "old-sync"
--- a/browser/locales/en-US/chrome/browser/accounts.properties
+++ b/browser/locales/en-US/chrome/browser/accounts.properties
@@ -12,22 +12,8 @@ upgradeToFxA.accessKey = U
 
 # LOCALIZATION NOTE (needVerifiedUserShort, needVerifiedUserLong)
 # %S = Email address of user's Firefox Account
 needVerifiedUserShort = %S not verified
 needVerifiedUserLong = Please click the verification link in the email sent to %S
 
 resendVerificationEmail.label = Resend
 resendVerificationEmail.accessKey = R
-
-forgetMigration.label = Forget
-forgetMigration.accessKey = F
-
-# These strings are used in a dialog we display after the user requests we resend
-# a verification email.
-verificationSentTitle = Verification Sent
-# LOCALIZATION NOTE (verificationSentHeading) - %S = Email address of user's Firefox Account
-verificationSentHeading = A verification link has been sent to %S
-verificationSentDescription = Please check your email and click the link to begin syncing.
-
-verificationNotSentTitle = Unable to Send Verification
-verificationNotSentHeading = We are unable to send a verification mail at this time
-verificationNotSentDescription = Please try again later.
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -132,8 +132,14 @@ updateAutoDesktop.accessKey=A
 syncUnlink.title=Do you want to unlink your device?
 syncUnlink.label=This device will no longer be associated with your Sync account. All of your personal data, both on this device and in your Sync account, will remain intact.
 syncUnlinkConfirm.label=Unlink
 
 # LOCALIZATION NOTE (featureEnableRequiresRestart, featureDisableRequiresRestart, restartTitle): %S = brandShortName
 featureEnableRequiresRestart=%S must restart to enable this feature.
 featureDisableRequiresRestart=%S must restart to disable this feature.
 shouldRestartTitle=Restart %S
+
+###Preferences::Sync::Firefox Accounts
+firefoxAccountsVerificationSentTitle=Verification Sent
+# LOCALIZATION NOTE: %S = user's email address.
+firefoxAccountsVerificationSentHeading=A verification link has been sent to %S
+firefoxAccountVerificationSentDescription=Please check your email and click the link to begin syncing.
--- a/browser/locales/en-US/chrome/browser/preferences/sync.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/sync.dtd
@@ -73,11 +73,8 @@ both, to better adapt this sentence to t
 <!ENTITY verify.label                "Verify Email">
 <!ENTITY forget.label                "Forget this Email">
 
 <!ENTITY welcome.description "Access your tabs, bookmarks, passwords and more wherever you use &brandShortName;.">
 <!ENTITY welcome.signIn.label "Sign In">
 <!ENTITY welcome.createAccount.label "Create Account">
 
 <!ENTITY welcome.useOldSync.label "Using an older version of Sync?">
-
-<!-- Sync Migration -->
-<!ENTITY migrate.upgradeNeeded      "The sync account system is being discontinued. A new Firefox Account is required to sync.">
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -288,25 +288,8 @@ description > html|a {
   /* Default dialog dimensions */
   height: 20em;
   width: 66ch;
 }
 
 /**
  * End Dialog
  */
-
-/**
- * Sync migration
- */
-#sync-migration {
-  border: 1px solid rgba(0, 0, 0, 0.32);
-  background-color: InfoBackground;
-  color: InfoText;
-  text-shadow: none;
-  margin: 5px 0 0 0;
-  animation: fadein 3000ms;
-}
-
-@keyframes fadein {
-  from { opacity: 0; }
-  to   { opacity: 1; }
-}
--- a/services/sync/modules/FxaMigrator.jsm
+++ b/services/sync/modules/FxaMigrator.jsm
@@ -345,45 +345,22 @@ Migrator.prototype = {
     // observer notification.
   }),
 
   // Ask the FxA servers to re-send a verification mail for the currently
   // logged in user. This should only be called while we are in the
   // STATE_USER_FXA_VERIFIED state.  When the user clicks on the link in
   // the mail we should see an ONVERIFIED_NOTIFICATION which will cause us
   // to complete the migration.
-  resendVerificationMail: Task.async(function * (win) {
+  resendVerificationMail: Task.async(function * () {
     // warn if we aren't in the expected state - but go ahead anyway!
     if (this._state != this.STATE_USER_FXA_VERIFIED) {
       this.log.warn("createFxAccount called in an unexpected state: ${}", this._state);
     }
-    let ok = true;
-    try {
-      yield fxAccounts.resendVerificationEmail();
-    } catch (ex) {
-      this.log.error("Failed to resend verification mail: ${}", ex);
-      ok = false;
-    }
-    let fxauser = yield fxAccounts.getSignedInUser();
-    let sb = Services.strings.createBundle("chrome://browser/locale/accounts.properties");
-
-    let heading = ok ?
-                  sb.formatStringFromName("verificationSentHeading", [fxauser.email], 1) :
-                  sb.GetStringFromName("verificationNotSentHeading");
-    let title = sb.GetStringFromName(ok ? "verificationSentTitle" : "verificationNotSentTitle");
-    let description = sb.GetStringFromName(ok ? "verificationSentDescription"
-                                              : "verificationNotSentDescription");
-
-    let factory = Cc["@mozilla.org/prompter;1"]
-                    .getService(Ci.nsIPromptFactory);
-    let prompt = factory.getPrompt(win, Ci.nsIPrompt);
-    let bag = prompt.QueryInterface(Ci.nsIWritablePropertyBag2);
-    bag.setPropertyAsBool("allowTabModal", true);
-
-    prompt.alert(title, heading + "\n\n" + description);
+    return fxAccounts.resendVerificationEmail();
   }),
 
   // "forget" about the current Firefox account. This should only be called
   // while we are in the STATE_USER_FXA_VERIFIED state.  After this we will
   // see an ONLOGOUT_NOTIFICATION, which will cause the migrator to return back
   // to the STATE_USER_FXA state, from where they can choose a different account.
   forgetFxAccount: Task.async(function * () {
     // warn if we aren't in the expected state - but go ahead anyway!