Bug 631200 - Make sure jpake closes when sync setup closes [r=mfinkle]
authorWes Johnston <wjohnston@mozilla.com>
Tue, 08 Feb 2011 10:05:58 -0800
changeset 67353 93c03fa2431629b490726be98c910c663aeb4c01
parent 67352 1991ac5e680200abb2323cf86c3976d3e2cca8e0
child 67354 24f4ba6d3672c9e6be7c8b79f79380cb29efba8b
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs631200
Bug 631200 - Make sure jpake closes when sync setup closes [r=mfinkle]
mobile/chrome/content/browser.xul
mobile/chrome/content/sync.js
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -535,17 +535,17 @@
               <description id="syncsetup-code2" class="syncsetup-code">....</description>
               <description id="syncsetup-code3" class="syncsetup-code">....</description>
             </vbox>
             <separator/>
             <description class="syncsetup-center syncsetup-link" flex="1" onclick="WeaveGlue.openManual();">&sync.fallback;</description>
             <separator flex="1"/>
           </scrollbox>
           <hbox class="syncsetup-buttons" pack="center">
-            <button oncommand="WeaveGlue.abortEasySetup(); WeaveGlue.close();">&sync.setup.cancel;</button>
+            <button oncommand="WeaveGlue.close();">&sync.setup.cancel;</button>
           </hbox>
         </vbox>
         <vbox id="syncsetup-fallback" class="syncsetup-page" flex="1" hidden="true">
           <scrollbox class="syncsetup-scrollbox" orient="vertical" flex="1">
             <description class="syncsetup-desc syncsetup-center" flex="1">&sync.setup.manual;</description>
             <separator/>
             <textbox id="syncsetup-account" class="syncsetup-edit" placeholder="&sync.account;" oninput="WeaveGlue.canConnect();"/>
             <textbox id="syncsetup-password" class="syncsetup-edit" placeholder="&sync.password;" type="password" oninput="WeaveGlue.canConnect();"/>
--- a/mobile/chrome/content/sync.js
+++ b/mobile/chrome/content/sync.js
@@ -130,17 +130,17 @@ let WeaveGlue = {
         self.setupData = aCredentials;
         self.connect();
       },
 
       onAbort: function onAbort(aError) {
         self.jpake = null;
 
         // No error means manual abort. Ignore.
-        if (!aError)
+        if (!aError || container.hidden)
           return;
 
         // Automatically go to manual setup if we couldn't acquire a channel.
         let brandShortName = Strings.brand.GetStringFromName("brandShortName");
         let tryAgain = self._bundle.GetStringFromName("sync.setup.tryagain");
         let manualSetup = self._bundle.GetStringFromName("sync.setup.manual");
         let buttonFlags = Ci.nsIPrompt.BUTTON_POS_1_DEFAULT +
                          (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
@@ -157,17 +157,16 @@ let WeaveGlue = {
             container.hidden = true;
             self.open();
             break;
           case 1:
             self.openManual();
             break;
           case 2:
           default:
-            self.abortEasySetup();
             self.close();
             break;
         }
       }
     });
     this.jpake.receiveNoPIN();
   },
 
@@ -198,16 +197,19 @@ let WeaveGlue = {
         this._elements.customserver.value = "";
       }
     }
 
     this.canConnect();
   },
 
   close: function close() {
+    if (this.jpake)
+      this.abortEasySetup();
+
     // Reset the scroll since the previous page might have been scrolled
     this._resetScrollPosition();
 
     // Save current setup data
     this.setupData = {
       account: this._elements.account.value.trim(),
       password: this._elements.password.value.trim(),
       synckey: Weave.Utils.normalizePassphrase(this._elements.synckey.value.trim()),
@@ -518,17 +520,16 @@ let WeaveGlue = {
       uri = Weave.Utils.makeURI("https://" + aURL);
 
     if (!uri)
       return "";
     return uri.spec;
   },
 
   openTutorial: function _openTutorial() {
-    WeaveGlue.abortEasySetup();
     WeaveGlue.close();
 
     let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
     let url = formatter.formatURLPref("app.sync.tutorialURL");
     BrowserUI.newTab(url, null);
   },
 
   loadSetupData: function _loadSetupData() {