Bug 588151 - HelperAppDlg doesn't do anything for Nothing [r=mbrubeck]
authorMark Finkle <mfinkle@mozilla.com>
Tue, 17 Aug 2010 18:29:16 -0400
changeset 66456 09ad2b1d62e66f35dd725f7881b4d45590ed9a7e
parent 66455 3ec69509aa52a104be1f4c0a4084d59477a3aadd
child 66457 2e845f32262cfd58854d1479de378e707a8751e4
child 66594 e72162cf3b3378c0670f177cb1a09c19c6c9c3a3
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)
reviewersmbrubeck
bugs588151
Bug 588151 - HelperAppDlg doesn't do anything for Nothing [r=mbrubeck]
mobile/components/HelperAppDialog.js
--- a/mobile/components/HelperAppDialog.js
+++ b/mobile/components/HelperAppDialog.js
@@ -49,16 +49,18 @@ Cu.import("resource://gre/modules/Servic
 
 function HelperAppLauncherDialog() { }
 
 HelperAppLauncherDialog.prototype = {
   classID: Components.ID("{e9d277a0-268a-4ec2-bb8c-10fdf3e44611}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]),
 
   show: function hald_show(aLauncher, aContext, aReason) {
+    const NS_BINDING_ABORTED = 0x804b0002;
+ 
     let window = aContext.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIDOMWindowInternal);
 
     let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
 
     let flags = (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
                 (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
 
@@ -84,28 +86,41 @@ HelperAppLauncherDialog.prototype = {
     if (aLauncher.MIMEInfo.hasDefaultHandler) {
       flags += (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_2);
 
       let choice = Services.prompt.confirmEx(window,
                                              title, message,
                                              flags, save, open, nothing,
                                              null, {});
 
-      if (choice == 0)
+      if (choice == 0) {
         aLauncher.saveToDisk(null, false);
-      else if (choice == 1)
+      }
+      else if (choice == 1) {
         aLauncher.launchWithApplication(null, false);
+      }
+      else {
+        try {
+          aLauncher.cancel(NS_BINDING_ABORTED);
+        } catch(e) {} 
+      }
     } else {
       let choice = Services.prompt.confirmEx(window,
                                              title, message,
                                              flags, save, nothing, null,
                                              null, {});
 
-      if (choice == 0)
+      if (choice == 0) {
         aLauncher.saveToDisk(null, false);
+      }
+      else {
+        try {
+          aLauncher.cancel(NS_BINDING_ABORTED);
+        } catch(e) {} 
+      }
     }
   },
 
   promptForSaveToFile: function hald_promptForSaveToFile(aLauncher, aContext, aDefaultFile, aSuggestedFileExt, aForcePrompt) {
     let file = null;
 
     let prefs = Services.prefs;