Bug 668760 - Factor out method to get weave engine (r=mbrubeck)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 23 Aug 2011 09:16:03 -0700
changeset 75750 f532be24c7c85950dd1bdaf8d0a38d5909da7b56
parent 75749 ac0b1fc28e3de2cd460976f239e828aee0d39976
child 75751 4a130dda0ed837fafe3555f32aee1737d4e419b4
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersmbrubeck
bugs668760
milestone9.0a1
Bug 668760 - Factor out method to get weave engine (r=mbrubeck)
mobile/chrome/content/bindings.xml
--- a/mobile/chrome/content/bindings.xml
+++ b/mobile/chrome/content/bindings.xml
@@ -1422,26 +1422,32 @@
       </method>
 
       <field name="_children">
         document.getAnonymousElementByAttribute(this, "anonid", "child-items");
       </field>
 
       <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)
+            return null;
+
+          return Weave.Engines.get("tabs");
+        ]]></body>
+      </method>
+
       <method name="_getRemoteTabs">
         <body><![CDATA[
-          // Don't do anything if the Weave isn't ready
-          if (document.getElementById("cmd_remoteTabs").getAttribute("disabled") == "true")
-            return [];
-          if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED)
-            return [];
-
           // Don't do anything if the tabs engine isn't ready
-          let engine = Weave.Engines.get("tabs");
+          let engine = this._getWeaveEngine();
           if (!engine)
             return [];
 
           // Don't bother refetching tabs if we already did so recently
           let lastFetch = Weave.Svc.Prefs.get("lastTabFetch", 0);
           let now = Math.floor(Date.now() / 1000);
           if (now - lastFetch >= Services.prefs.getIntPref("browser.display.remotetabs.timeout")) {
             // Force a sync only for the tabs engine