Bug 688574 - Check sync username prefs key instead of using sync's API (r=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Wed, 12 Oct 2011 15:13:25 +0100
changeset 78622 17d34b5fd9290efb3620573b438e41881454210e
parent 78621 3eb62b784a659a14414e0e03e22cc93c19c866dc
child 78623 bbf1f86fc5c100e36ff711414a66d3ea69c0f7f0
push id21321
push usermak77@bonardo.net
push dateThu, 13 Oct 2011 13:50:30 +0000
treeherdermozilla-central@d6d3a1f90e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs688574
milestone10.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 688574 - Check sync username prefs key instead of using sync's API (r=mfinkle)
mobile/chrome/content/bindings.xml
mobile/chrome/content/browser-ui.js
mobile/chrome/content/sanitize.js
mobile/chrome/content/sync.js
--- a/mobile/chrome/content/bindings.xml
+++ b/mobile/chrome/content/bindings.xml
@@ -1472,17 +1472,17 @@
 
       <field name="scrollBoxObject">this._children.scrollBoxObject</field>
 
       <method name="_getWeaveEngine">
         <body><![CDATA[
           // Return null if the Weave isn't ready
           if (document.getElementById("cmd_remoteTabs").getAttribute("disabled") ==     "true")
             return null;
-          if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED)
+          if (!Services.prefs.prefHasUserValue("services.sync.username")) {
             return null;
 
           return Weave.Engines.get("tabs");
         ]]></body>
       </method>
 
       <method name="_getRemoteTabs">
         <parameter name="aEngine"/>
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -1225,17 +1225,17 @@ var BrowserUI = {
         break;
       case "cmd_bookmarks":
         AwesomeScreen.activePanel = BookmarkList;
         break;
       case "cmd_history":
         AwesomeScreen.activePanel = HistoryList;
         break;
       case "cmd_remoteTabs":
-        if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
+        if (!Services.prefs.prefHasUserValue("services.sync.username")) {
           // We have to set activePanel before showing sync's dialog
           // to make the sure the dialog stacking is correct.
           AwesomeScreen.activePanel = RemoteTabsList;
           WeaveGlue.open();
         } else {
           AwesomeScreen.activePanel = RemoteTabsList;
         }
 
--- a/mobile/chrome/content/sanitize.js
+++ b/mobile/chrome/content/sanitize.js
@@ -96,17 +96,17 @@ Sanitizer.prototype = {
     syncAccount: {
       clear: function ()
       {
         WeaveGlue.disconnect();
       },
 
       get canClear()
       {
-        return (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED);
+        return (Services.prefs.prefHasUserValue("services.sync.username"));
       }
     },
 
     cache: {
       clear: function ()
       {
         var cacheService = Cc["@mozilla.org/network/cache-service;1"].getService(Ci.nsICacheService);
         try {
--- a/mobile/chrome/content/sync.js
+++ b/mobile/chrome/content/sync.js
@@ -48,17 +48,17 @@ let WeaveGlue = {
     this._bundle = Services.strings.createBundle("chrome://browser/locale/sync.properties");
     this._msg = document.getElementById("prefs-messages");
 
     this._addListeners();
 
     this.setupData = { account: "", password: "" , synckey: "", serverURL: "" };
 
     // Generating keypairs is expensive on mobile, so disable it
-    if (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED) {
+    if (Services.prefs.prefHasUserValue("services.sync.username")) {
       // Put the settings UI into a state of "connecting..." if we are going to auto-connect
       this._elements.connect.firstChild.disabled = true;
       this._elements.connect.setAttribute("title", this._bundle.GetStringFromName("connecting.label"));
 
       try {
         this._elements.device.value = Services.prefs.getCharPref("services.sync.client.name");
       } catch(e) {}
     } else if (Weave.Status.login != Weave.LOGIN_FAILED_NO_USERNAME) {
@@ -254,17 +254,17 @@ let WeaveGlue = {
     this._elements.details.checked = show;
     this._elements.sync.collapsed = !show;
     this._elements.device.collapsed = !show;
     this._elements.disconnect.collapsed = !show;
   },
 
   tryConnect: function login() {
     // If Sync is not configured, simply show the setup dialog
-    if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
+    if (!Services.prefs.prefHasUserValue("services.sync.username")) {
       this.open();
       return;
     }
 
     // No setup data, do nothing
     if (!this.setupData)
       return;