Bug 1384057 - Stop using preprocessor in nsHelperAppDlg.js. r=paolo
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Tue, 25 Jul 2017 18:33:49 +0200
changeset 419985 68a7ead060bfd1fa8d453286362a7377d9887f42
parent 419984 e9224528ba04e008087766d6bc2d0e10eea4c195
child 419986 301acb1080e7ad0312000b3ced6c272d2b715916
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1384057
milestone56.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 1384057 - Stop using preprocessor in nsHelperAppDlg.js. r=paolo
toolkit/mozapps/downloads/moz.build
toolkit/mozapps/downloads/nsHelperAppDlg.js
--- a/toolkit/mozapps/downloads/moz.build
+++ b/toolkit/mozapps/downloads/moz.build
@@ -5,22 +5,19 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Downloads API')
 
 TEST_DIRS += ['tests']
 
 EXTRA_COMPONENTS += [
+    'nsHelperAppDlg.js',
     'nsHelperAppDlg.manifest',
 ]
 
-EXTRA_PP_COMPONENTS += [
-    'nsHelperAppDlg.js',
-]
-
 EXTRA_JS_MODULES += [
     'DownloadLastDir.jsm',
     'DownloadPaths.jsm',
     'DownloadUtils.jsm',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
--- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
+++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ -1063,34 +1063,32 @@ nsUnknownContentTypeDialog.prototype = {
                               params);
 
       if (params.handlerApp &&
           params.handlerApp.executable &&
           params.handlerApp.executable.isFile()) {
         // Remember the file they chose to run.
         this.chosenApp = params.handlerApp;
       }
-    }
-    else {
-#if MOZ_WIDGET_GTK == 3
+    } else if ("@mozilla.org/applicationchooser;1" in Components.classes) {
       var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser;
       var appChooser = Components.classes["@mozilla.org/applicationchooser;1"]
                                  .createInstance(nsIApplicationChooser);
       appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle"));
       var contentTypeDialogObj = this;
       let appChooserCallback = function appChooserCallback_done(aResult) {
         if (aResult) {
            contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp);
         }
         contentTypeDialogObj.finishChooseApp();
       };
       appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback);
       // The finishChooseApp is called from appChooserCallback
       return;
-#else
+    } else {
       var nsIFilePicker = Components.interfaces.nsIFilePicker;
       var fp = Components.classes["@mozilla.org/filepicker;1"]
                          .createInstance(nsIFilePicker);
       fp.init(this.mDialog,
               this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
               nsIFilePicker.modeOpen);
 
       fp.appendFilters(nsIFilePicker.filterApps);
@@ -1098,18 +1096,18 @@ nsUnknownContentTypeDialog.prototype = {
       if (fp.show() == nsIFilePicker.returnOK && fp.file) {
         // Remember the file they chose to run.
         var localHandlerApp =
           Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
                      createInstance(Components.interfaces.nsILocalHandlerApp);
         localHandlerApp.executable = fp.file;
         this.chosenApp = localHandlerApp;
       }
-#endif // MOZ_WIDGET_GTK == 3
     }
+
     this.finishChooseApp();
   },
 
   // Turn this on to get debugging messages.
   debug: false,
 
   // Dump text (if debug is on).
   dump: function( text ) {