Bug 966823 - ensure checking if there is a login error doesn't initialize sync too early. r=ttaubert
authorMark Hammond <mhammond@skippinet.com.au>
Mon, 03 Feb 2014 10:47:35 +1100
changeset 182564 5e41335ed0a400968e49b96ad21a8f5c037a9fe1
parent 182563 e67fbfeab5d5499b8c5c3dc6b1c337085c0103d4
child 182565 866f05dd291cf82577508b431a0cc92c01ab6a58
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs966823
milestone29.0a1
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
Bug 966823 - ensure checking if there is a login error doesn't initialize sync too early. r=ttaubert
browser/base/content/browser-fxaccounts.js
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -43,16 +43,24 @@ let gFxAccounts = {
   },
 
   get button() {
     delete this.button;
     return this.button = document.getElementById("PanelUI-fxa-status");
   },
 
   get loginFailed() {
+    // Referencing Weave.Service will implicitly initialize sync, and we don't
+    // want to force that - so first check if it is ready.
+    let service = Cc["@mozilla.org/weave/service;1"]
+                  .getService(Components.interfaces.nsISupports)
+                  .wrappedJSObject;
+    if (!service.ready) {
+      return false;
+    }
     return Weave.Service.identity.readyToAuthenticate &&
            Weave.Status.login != Weave.LOGIN_SUCCEEDED;
   },
 
   get isActiveWindow() {
     let mostRecentNonPopupWindow =
       RecentWindow.getMostRecentBrowserWindow({allowPopups: false});
     return window == mostRecentNonPopupWindow;