mozilla-kde.patch
branchfirefox60
changeset 1080 e8d4a33582b8
parent 1050 bf0d08380dcf
child 1090 554cd9503f75
equal deleted inserted replaced
1064:af29b3ac33ae 1080:e8d4a33582b8
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
     5 Author: Lubos Lunak <lunak@suse.com>
     5 Author: Lubos Lunak <lunak@suse.com>
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
     7      https://bugzilla.novell.com/show_bug.cgi?id=170055
     8 
     8 
     9 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
     9 Index: firefox-60.2.0/modules/libpref/Preferences.cpp
    10 --- a/modules/libpref/Preferences.cpp
    10 ===================================================================
    11 +++ b/modules/libpref/Preferences.cpp
    11 --- firefox-60.2.0.orig/modules/libpref/Preferences.cpp	2018-09-05 21:49:23.102829401 +0200
    12 @@ -76,16 +76,17 @@
    12 +++ firefox-60.2.0/modules/libpref/Preferences.cpp	2018-09-05 21:49:31.498872824 +0200
    13  #include "nsXPCOMCID.h"
    13 @@ -81,6 +81,7 @@
    14  #include "nsXPCOM.h"
       
    15  #include "nsXULAppAPI.h"
       
    16  #include "nsZipArchive.h"
       
    17  #include "plbase64.h"
       
    18  #include "PLDHashTable.h"
    14  #include "PLDHashTable.h"
    19  #include "plstr.h"
    15  #include "plstr.h"
    20  #include "prlink.h"
    16  #include "prlink.h"
    21 +#include "nsKDEUtils.h"
    17 +#include "nsKDEUtils.h"
    22  
    18  
    23  #ifdef XP_WIN
    19  #ifdef XP_WIN
    24  #include "windows.h"
    20  #include "windows.h"
    25  #endif
    21 @@ -3873,6 +3874,7 @@ Preferences::InitInitialObjects()
    26  
       
    27  using namespace mozilla;
       
    28  
       
    29  #ifdef DEBUG
       
    30 @@ -3868,25 +3869,37 @@ Preferences::InitInitialObjects()
       
    31    // application pref files for backwards compatibility.
       
    32    static const char* specialFiles[] = {
       
    33  #if defined(XP_MACOSX)
       
    34      "macprefs.js"
       
    35  #elif defined(XP_WIN)
       
    36      "winpref.js"
    22      "winpref.js"
    37  #elif defined(XP_UNIX)
    23  #elif defined(XP_UNIX)
    38      "unix.js"
    24      "unix.js"
    39 +    , "" // placeholder for KDE  (empty is otherwise harmless)
    25 +    , "" // placeholder for KDE  (empty is otherwise harmless)
    40  #if defined(_AIX)
    26  #if defined(_AIX)
    41      ,
    27      ,
    42      "aix.js"
    28      "aix.js"
    43  #endif
    29 @@ -3882,6 +3884,17 @@ Preferences::InitInitialObjects()
    44  #elif defined(XP_BEOS)
       
    45      "beos.js"
       
    46  #endif
    30  #endif
    47    };
    31    };
    48  
    32  
    49 +  if(nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
    33 +  if(nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper?
    50 +    for(int i = 0;
    34 +    for(int i = 0;
    58 +  }
    42 +  }
    59 +
    43 +
    60    rv = pref_LoadPrefsInDir(
    44    rv = pref_LoadPrefsInDir(
    61      defaultPrefDir, specialFiles, ArrayLength(specialFiles));
    45      defaultPrefDir, specialFiles, ArrayLength(specialFiles));
    62    if (NS_FAILED(rv)) {
    46    if (NS_FAILED(rv)) {
    63      NS_WARNING("Error parsing application default preferences.");
    47 @@ -3940,7 +3953,7 @@ Preferences::InitInitialObjects()
    64    }
       
    65  
       
    66    // Load jar:$app/omni.jar!/defaults/preferences/*.js
       
    67    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
       
    68 @@ -3935,17 +3948,17 @@ Preferences::InitInitialObjects()
       
    69        }
       
    70  
       
    71        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
       
    72        if (!path) {
       
    73          continue;
       
    74        }
    48        }
    75  
    49  
    76        // Do we care if a file provided by this process fails to load?
    50        // Do we care if a file provided by this process fails to load?
    77 -      pref_LoadPrefsInDir(path, nullptr, 0);
    51 -      pref_LoadPrefsInDir(path, nullptr, 0);
    78 +      pref_LoadPrefsInDir(path, specialFiles, ArrayLength(specialFiles));
    52 +      pref_LoadPrefsInDir(path, specialFiles, ArrayLength(specialFiles));
    79      }
    53      }
    80    }
    54    }
    81  
    55  
    82  #ifdef MOZ_WIDGET_ANDROID
    56 Index: firefox-60.2.0/modules/libpref/moz.build
    83    // Set up the correct default for toolkit.telemetry.enabled. If this build
    57 ===================================================================
    84    // has MOZ_TELEMETRY_ON_BY_DEFAULT *or* we're on the beta channel, telemetry
    58 --- firefox-60.2.0.orig/modules/libpref/moz.build	2018-09-05 21:49:23.106829422 +0200
    85    // is on by default, otherwise not. This is necessary so that beta users who
    59 +++ firefox-60.2.0/modules/libpref/moz.build	2018-09-05 21:49:31.498872824 +0200
    86    // are testing final release builds don't flipflop defaults.
    60 @@ -32,6 +32,10 @@ UNIFIED_SOURCES += [
    87 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
       
    88 --- a/modules/libpref/moz.build
       
    89 +++ b/modules/libpref/moz.build
       
    90 @@ -27,16 +27,20 @@ XPIDL_MODULE = 'pref'
       
    91  EXPORTS.mozilla += [
       
    92      'Preferences.h',
       
    93  ]
       
    94  
       
    95  UNIFIED_SOURCES += [
       
    96      'Preferences.cpp',
    61      'Preferences.cpp',
    97  ]
    62  ]
    98  
    63  
    99 +LOCAL_INCLUDES += [
    64 +LOCAL_INCLUDES += [
   100 +     '/toolkit/xre'
    65 +     '/toolkit/xre'
   101 +]
    66 +]
   102 +
    67 +
   103  include('/ipc/chromium/chromium-config.mozbuild')
    68  include('/ipc/chromium/chromium-config.mozbuild')
   104  
    69  
   105  FINAL_LIBRARY = 'xul'
    70  FINAL_LIBRARY = 'xul'
   106  
    71 Index: firefox-60.2.0/python/mozbuild/mozpack/chrome/flags.py
   107  DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
    72 ===================================================================
   108  DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
    73 --- firefox-60.2.0.orig/python/mozbuild/mozpack/chrome/flags.py	2018-09-05 21:49:23.106829422 +0200
   109  if CONFIG['MOZ_ENABLE_WEBRENDER']:
    74 +++ firefox-60.2.0/python/mozbuild/mozpack/chrome/flags.py	2018-09-05 21:49:31.498872824 +0200
   110      DEFINES['MOZ_ENABLE_WEBRENDER'] = True
    75 @@ -225,6 +225,7 @@ class Flags(OrderedDict):
   111 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
       
   112 --- a/python/mozbuild/mozpack/chrome/flags.py
       
   113 +++ b/python/mozbuild/mozpack/chrome/flags.py
       
   114 @@ -220,16 +220,17 @@ class Flags(OrderedDict):
       
   115          'contentaccessible': Flag,
       
   116          'os': StringFlag,
       
   117          'osversion': VersionFlag,
       
   118          'abi': StringFlag,
       
   119          'platform': Flag,
       
   120          'xpcnativewrappers': Flag,
    76          'xpcnativewrappers': Flag,
   121          'tablet': Flag,
    77          'tablet': Flag,
   122          'process': StringFlag,
    78          'process': StringFlag,
   123 +        'desktop': StringFlag,
    79 +        'desktop': StringFlag,
   124      }
    80      }
   125      RE = re.compile(r'([!<>=]+)')
    81      RE = re.compile(r'([!<>=]+)')
   126  
    82  
   127      def __init__(self, *flags):
    83 Index: firefox-60.2.0/python/mozbuild/mozpack/chrome/manifest.py
   128          '''
    84 ===================================================================
   129          Initialize a set of flags given in string form.
    85 --- firefox-60.2.0.orig/python/mozbuild/mozpack/chrome/manifest.py	2018-09-05 21:49:23.106829422 +0200
   130             flags = Flags('contentaccessible=yes', 'appversion>=3.5')
    86 +++ firefox-60.2.0/python/mozbuild/mozpack/chrome/manifest.py	2018-09-05 21:49:31.498872824 +0200
   131          '''
    87 @@ -39,6 +39,7 @@ class ManifestEntry(object):
   132 diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
       
   133 --- a/python/mozbuild/mozpack/chrome/manifest.py
       
   134 +++ b/python/mozbuild/mozpack/chrome/manifest.py
       
   135 @@ -34,16 +34,17 @@ class ManifestEntry(object):
       
   136          'platformversion',
       
   137          'os',
       
   138          'osversion',
       
   139          'abi',
       
   140          'xpcnativewrappers',
       
   141          'tablet',
    88          'tablet',
   142          'process',
    89          'process',
   143          'contentaccessible',
    90          'contentaccessible',
   144 +	'desktop',
    91 +	'desktop',
   145      ]
    92      ]
   146  
    93  
   147      def __init__(self, base, *flags):
    94      def __init__(self, base, *flags):
   148          '''
    95 Index: firefox-60.2.0/toolkit/components/downloads/moz.build
   149          Initialize a manifest entry with the given base path and flags.
    96 ===================================================================
   150          '''
    97 --- firefox-60.2.0.orig/toolkit/components/downloads/moz.build	2018-09-05 21:49:23.106829422 +0200
   151          self.base = base
    98 +++ firefox-60.2.0/toolkit/components/downloads/moz.build	2018-09-05 21:49:31.498872824 +0200
   152          self.flags = Flags(*flags)
    99 @@ -46,5 +46,9 @@ if CONFIG['MOZ_PLACES']:
   153 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
       
   154 --- a/toolkit/components/downloads/moz.build
       
   155 +++ b/toolkit/components/downloads/moz.build
       
   156 @@ -41,10 +41,14 @@ EXTRA_JS_MODULES += [
       
   157  
       
   158  if CONFIG['MOZ_PLACES']:
       
   159      EXTRA_JS_MODULES += [
       
   160          'DownloadHistory.jsm',
       
   161      ]
       
   162  
   100  
   163  FINAL_LIBRARY = 'xul'
   101  FINAL_LIBRARY = 'xul'
   164  
   102  
   165 +LOCAL_INCLUDES += [
   103 +LOCAL_INCLUDES += [
   166 +    '/toolkit/xre'
   104 +    '/toolkit/xre'
   167 +]
   105 +]
   168 +
   106 +
   169  with Files('**'):
   107  with Files('**'):
   170      BUG_COMPONENT = ('Toolkit', 'Download Manager')
   108      BUG_COMPONENT = ('Toolkit', 'Download Manager')
   171 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   109 Index: firefox-60.2.0/toolkit/content/jar.mn
   172 --- a/toolkit/content/jar.mn
   110 ===================================================================
   173 +++ b/toolkit/content/jar.mn
   111 --- firefox-60.2.0.orig/toolkit/content/jar.mn	2018-09-05 21:49:23.106829422 +0200
   174 @@ -69,16 +69,18 @@ toolkit.jar:
   112 +++ firefox-60.2.0/toolkit/content/jar.mn	2018-09-05 21:49:31.498872824 +0200
   175     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   113 @@ -74,6 +74,8 @@ toolkit.jar:
   176     content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
       
   177     content/global/bindings/datekeeper.js       (widgets/datekeeper.js)
       
   178     content/global/bindings/datepicker.js       (widgets/datepicker.js)
       
   179     content/global/bindings/datetimepopup.xml   (widgets/datetimepopup.xml)
       
   180     content/global/bindings/datetimebox.xml     (widgets/datetimebox.xml)
   114     content/global/bindings/datetimebox.xml     (widgets/datetimebox.xml)
   181     content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
   115     content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
   182  *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
   116  *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
   183 +*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
   117 +*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
   184 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
   118 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
   185     content/global/bindings/editor.xml          (widgets/editor.xml)
   119     content/global/bindings/editor.xml          (widgets/editor.xml)
   186     content/global/bindings/filefield.xml       (widgets/filefield.xml)
   120     content/global/bindings/filefield.xml       (widgets/filefield.xml)
   187  *  content/global/bindings/findbar.xml         (widgets/findbar.xml)
   121  *  content/global/bindings/findbar.xml         (widgets/findbar.xml)
   188     content/global/bindings/general.xml         (widgets/general.xml)
   122 Index: firefox-60.2.0/toolkit/content/widgets/dialog-kde.xml
   189     content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
   123 ===================================================================
   190     content/global/bindings/listbox.xml         (widgets/listbox.xml)
   124 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   191     content/global/bindings/menu.xml            (widgets/menu.xml)
   125 +++ firefox-60.2.0/toolkit/content/widgets/dialog-kde.xml	2018-09-05 21:49:31.498872824 +0200
   192     content/global/bindings/menulist.xml        (widgets/menulist.xml)
       
   193 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
       
   194 new file mode 100644
       
   195 --- /dev/null
       
   196 +++ b/toolkit/content/widgets/dialog-kde.xml
       
   197 @@ -0,0 +1,478 @@
   126 @@ -0,0 +1,478 @@
   198 +<?xml version="1.0"?>
   127 +<?xml version="1.0"?>
   199 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
   128 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
   200 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
   129 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
   201 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
   130 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
   671 +    </handlers>
   600 +    </handlers>
   672 +
   601 +
   673 +  </binding>
   602 +  </binding>
   674 +
   603 +
   675 +</bindings>
   604 +</bindings>
   676 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
   605 Index: firefox-60.2.0/toolkit/mozapps/downloads/nsHelperAppDlg.js
   677 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
   606 ===================================================================
   678 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
   607 --- firefox-60.2.0.orig/toolkit/mozapps/downloads/nsHelperAppDlg.js	2018-09-05 21:49:23.106829422 +0200
   679 @@ -627,17 +627,17 @@ nsUnknownContentTypeDialog.prototype = {
   608 +++ firefox-60.2.0/toolkit/mozapps/downloads/nsHelperAppDlg.js	2018-09-05 21:49:31.498872824 +0200
   680        else
   609 @@ -632,7 +632,7 @@ nsUnknownContentTypeDialog.prototype = {
   681          typeString = mimeInfo.MIMEType;
       
   682      }
       
   683      // When the length is unknown, contentLength would be -1
       
   684      if (this.mLauncher.contentLength >= 0) {
       
   685        let [size, unit] = DownloadUtils.
   610        let [size, unit] = DownloadUtils.
   686                           convertByteUnits(this.mLauncher.contentLength);
   611                           convertByteUnits(this.mLauncher.contentLength);
   687        type.value = this.dialogElement("strings")
   612        type.value = this.dialogElement("strings")
   688 -                       .getFormattedString("orderedFileSizeWithType", 
   613 -                       .getFormattedString("orderedFileSizeWithType", 
   689 +                       .getFormattedString("orderedFileSizeWithType",
   614 +                       .getFormattedString("orderedFileSizeWithType",
   690                                             [typeString, size, unit]);
   615                                             [typeString, size, unit]);
   691      }
   616      }
   692      else {
   617      else {
   693        type.value = typeString;
   618 @@ -806,7 +806,7 @@ nsUnknownContentTypeDialog.prototype = {
   694      }
       
   695    },
       
   696  
       
   697    // Returns true if opening the default application makes sense.
       
   698 @@ -801,17 +801,17 @@ nsUnknownContentTypeDialog.prototype = {
       
   699        switch (this.dialogElement("openHandler").selectedIndex) {
       
   700        case 0:
       
   701          // No app need be specified in this case.
       
   702          ok = true;
       
   703          break;
       
   704        case 1:
   619        case 1:
   705          // only enable the OK button if we have a default app to use or if
   620          // only enable the OK button if we have a default app to use or if
   706          // the user chose an app....
   621          // the user chose an app....
   707 -        ok = this.chosenApp || /\S/.test(this.dialogElement("otherHandler").getAttribute("path")); 
   622 -        ok = this.chosenApp || /\S/.test(this.dialogElement("otherHandler").getAttribute("path")); 
   708 +        ok = this.chosenApp || /\S/.test(this.dialogElement("otherHandler").getAttribute("path"));
   623 +        ok = this.chosenApp || /\S/.test(this.dialogElement("otherHandler").getAttribute("path"));
   709          break;
   624          break;
   710        }
   625        }
   711      }
   626      }
   712  
   627 @@ -1071,20 +1071,50 @@ nsUnknownContentTypeDialog.prototype = {
   713      // Enable Ok button if ok to press.
       
   714      this.mDialog.document.documentElement.getButton("accept").disabled = !ok;
       
   715    },
       
   716  
       
   717 @@ -1066,30 +1066,60 @@ nsUnknownContentTypeDialog.prototype = {
       
   718  
       
   719        if (params.handlerApp &&
       
   720            params.handlerApp.executable &&
       
   721            params.handlerApp.executable.isFile()) {
       
   722          // Remember the file they chose to run.
       
   723          this.chosenApp = params.handlerApp;
   628          this.chosenApp = params.handlerApp;
   724        }
   629        }
   725      } else if ("@mozilla.org/applicationchooser;1" in Cc) {
   630      } else if ("@mozilla.org/applicationchooser;1" in Cc) {
   726 -      var nsIApplicationChooser = Ci.nsIApplicationChooser;
   631 -      var nsIApplicationChooser = Ci.nsIApplicationChooser;
   727 -      var appChooser = Cc["@mozilla.org/applicationchooser;1"]
   632 -      var appChooser = Cc["@mozilla.org/applicationchooser;1"]
   782 +        return;
   687 +        return;
   783 +      }
   688 +      }
   784      } else {
   689      } else {
   785        var nsIFilePicker = Ci.nsIFilePicker;
   690        var nsIFilePicker = Ci.nsIFilePicker;
   786        var fp = Cc["@mozilla.org/filepicker;1"]
   691        var fp = Cc["@mozilla.org/filepicker;1"]
   787                   .createInstance(nsIFilePicker);
   692 Index: firefox-60.2.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   788        fp.init(this.mDialog,
   693 ===================================================================
   789                this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
   694 --- firefox-60.2.0.orig/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	2018-09-05 21:49:23.106829422 +0200
   790                nsIFilePicker.modeOpen);
   695 +++ firefox-60.2.0/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	2018-09-05 21:49:31.498872824 +0200
   791  
   696 @@ -20,6 +20,7 @@
   792 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
       
   793 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
       
   794 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
       
   795 @@ -15,16 +15,17 @@
       
   796  #include "nsPrintfCString.h"
       
   797  #include "nsNetCID.h"
       
   798  #include "nsNetUtil.h"
       
   799  #include "nsISupportsPrimitives.h"
       
   800  #include "nsIGSettingsService.h"
       
   801  #include "nsInterfaceHashtable.h"
   697  #include "nsInterfaceHashtable.h"
   802  #include "mozilla/Attributes.h"
   698  #include "mozilla/Attributes.h"
   803  #include "nsIURI.h"
   699  #include "nsIURI.h"
   804 +#include "nsKDEUtils.h"
   700 +#include "nsKDEUtils.h"
   805  
   701  
   806  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   702  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   807  public:
   703  public:
   808    NS_DECL_ISUPPORTS
   704 @@ -44,6 +45,7 @@ private:
   809    NS_DECL_NSISYSTEMPROXYSETTINGS
       
   810  
       
   811    nsUnixSystemProxySettings()
       
   812      : mSchemeProxySettings(4)
       
   813 @@ -39,16 +40,17 @@ private:
       
   814    nsCOMPtr<nsIGSettingsService> mGSettings;
       
   815    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
       
   816    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
       
   817    bool IsProxyMode(const char* aMode);
       
   818    nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
       
   819    nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
   705    nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
   820    nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
   706    nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
   821    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult);
   707    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult);
   822 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
   708 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
   823  };
   709  };
   824  
   710  
   825  NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
   711  NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
   826  
   712 @@ -510,6 +512,9 @@ nsUnixSystemProxySettings::GetProxyForUR
   827  NS_IMETHODIMP
       
   828  nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly)
       
   829  {
       
   830    // dbus prevents us from being threadsafe, but this routine should not block anyhow
       
   831 @@ -505,16 +507,19 @@ nsUnixSystemProxySettings::GetProxyFromG
       
   832  
       
   833  nsresult
       
   834  nsUnixSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
       
   835                                            const nsACString & aScheme,
       
   836                                            const nsACString & aHost,
       
   837                                            const int32_t      aPort,
   713                                            const int32_t      aPort,
   838                                            nsACString & aResult)
   714                                            nsACString & aResult)
   839  {
   715  {
   840 +  if (nsKDEUtils::kdeSupport())
   716 +  if (nsKDEUtils::kdeSupport())
   841 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
   717 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
   842 +
   718 +
   843    if (mProxySettings) {
   719    if (mProxySettings) {
   844      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   720      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   845      if (NS_SUCCEEDED(rv))
   721      if (NS_SUCCEEDED(rv))
   846        return rv;
   722 @@ -545,3 +550,29 @@ static const mozilla::Module kUnixProxyM
   847    }
       
   848    if (mGConf)
       
   849      return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
       
   850  
       
   851 @@ -540,8 +545,34 @@ static const mozilla::Module::ContractID
       
   852  
       
   853  static const mozilla::Module kUnixProxyModule = {
       
   854    mozilla::Module::kVersion,
       
   855    kUnixProxyCIDs,
       
   856    kUnixProxyContracts
       
   857  };
   723  };
   858  
   724  
   859  NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
   725  NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
   860 +
   726 +
   861 +nsresult
   727 +nsresult
   881 +    return NS_ERROR_FAILURE;
   747 +    return NS_ERROR_FAILURE;
   882 +  aResult = result[0];
   748 +  aResult = result[0];
   883 +  return NS_OK;
   749 +  return NS_OK;
   884 +}
   750 +}
   885 +
   751 +
   886 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
   752 Index: firefox-60.2.0/toolkit/xre/moz.build
   887 --- a/toolkit/xre/moz.build
   753 ===================================================================
   888 +++ b/toolkit/xre/moz.build
   754 --- firefox-60.2.0.orig/toolkit/xre/moz.build	2018-09-05 21:49:23.106829422 +0200
   889 @@ -65,17 +65,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
   755 +++ firefox-60.2.0/toolkit/xre/moz.build	2018-09-05 21:49:31.498872824 +0200
   890          '../components/printingui',
   756 @@ -70,7 +70,9 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
   891      ]
       
   892  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
       
   893      UNIFIED_SOURCES += [
       
   894          'nsNativeAppSupportDefault.cpp',
       
   895          'UIKitDirProvider.mm',
   757          'UIKitDirProvider.mm',
   896      ]
   758      ]
   897  elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
   759  elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
   898 +    EXPORTS += ['nsKDEUtils.h']
   760 +    EXPORTS += ['nsKDEUtils.h']
   899      UNIFIED_SOURCES += [
   761      UNIFIED_SOURCES += [
   900 +        'nsKDEUtils.cpp',
   762 +        'nsKDEUtils.cpp',
   901          'nsNativeAppSupportUnix.cpp',
   763          'nsNativeAppSupportUnix.cpp',
   902      ]
   764      ]
   903  else:
   765  else:
   904      UNIFIED_SOURCES += [
   766 Index: firefox-60.2.0/toolkit/xre/nsKDEUtils.cpp
   905          'nsNativeAppSupportDefault.cpp',
   767 ===================================================================
   906      ]
   768 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
   907  
   769 +++ firefox-60.2.0/toolkit/xre/nsKDEUtils.cpp	2018-09-05 21:49:31.498872824 +0200
   908  if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
       
   909 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
       
   910 new file mode 100644
       
   911 --- /dev/null
       
   912 +++ b/toolkit/xre/nsKDEUtils.cpp
       
   913 @@ -0,0 +1,344 @@
   770 @@ -0,0 +1,344 @@
   914 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
   771 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
   915 +/* This Source Code Form is subject to the terms of the Mozilla Public
   772 +/* This Source Code Form is subject to the terms of the Mozilla Public
   916 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   773 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   917 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
   774 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1253 +        fputs( "\n", commandFile );
  1110 +        fputs( "\n", commandFile );
  1254 +        }
  1111 +        }
  1255 +    fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data
  1112 +    fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data
  1256 +    fflush( commandFile );
  1113 +    fflush( commandFile );
  1257 +    }
  1114 +    }
  1258 diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h
  1115 Index: firefox-60.2.0/toolkit/xre/nsKDEUtils.h
  1259 new file mode 100644
  1116 ===================================================================
  1260 --- /dev/null
  1117 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  1261 +++ b/toolkit/xre/nsKDEUtils.h
  1118 +++ firefox-60.2.0/toolkit/xre/nsKDEUtils.h	2018-09-05 21:49:31.498872824 +0200
  1262 @@ -0,0 +1,48 @@
  1119 @@ -0,0 +1,48 @@
  1263 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1120 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1264 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1121 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1265 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1122 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1266 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1123 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1306 +        FILE* commandFile;
  1163 +        FILE* commandFile;
  1307 +        FILE* replyFile;
  1164 +        FILE* replyFile;
  1308 +    };
  1165 +    };
  1309 +
  1166 +
  1310 +#endif // nsKDEUtils
  1167 +#endif // nsKDEUtils
  1311 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
  1168 Index: firefox-60.2.0/uriloader/exthandler/HandlerServiceParent.cpp
  1312 --- a/uriloader/exthandler/HandlerServiceParent.cpp
  1169 ===================================================================
  1313 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
  1170 --- firefox-60.2.0.orig/uriloader/exthandler/HandlerServiceParent.cpp	2018-09-05 21:49:23.106829422 +0200
  1314 @@ -1,16 +1,16 @@
  1171 +++ firefox-60.2.0/uriloader/exthandler/HandlerServiceParent.cpp	2018-09-05 21:49:31.502872845 +0200
  1315  #include "mozilla/Logging.h"
  1172 @@ -5,7 +5,7 @@
  1316  #include "HandlerServiceParent.h"
       
  1317  #include "nsIHandlerService.h"
       
  1318  #include "nsIMIMEInfo.h"
       
  1319  #include "ContentHandlerService.h"
  1173  #include "ContentHandlerService.h"
  1320  #include "nsStringEnumerator.h"
  1174  #include "nsStringEnumerator.h"
  1321  #ifdef MOZ_WIDGET_GTK
  1175  #ifdef MOZ_WIDGET_GTK
  1322 -#include "unix/nsGNOMERegistry.h"
  1176 -#include "unix/nsGNOMERegistry.h"
  1323 +#include "unix/nsCommonRegistry.h"
  1177 +#include "unix/nsCommonRegistry.h"
  1324  #endif
  1178  #endif
  1325  
  1179  
  1326  using mozilla::dom::HandlerInfo;
  1180  using mozilla::dom::HandlerInfo;
  1327  using mozilla::dom::HandlerApp;
  1181 @@ -269,7 +269,7 @@ HandlerServiceParent::RecvExistsForProto
  1328  using mozilla::dom::ContentHandlerService;
       
  1329  using mozilla::dom::RemoteHandlerApp;
       
  1330  
       
  1331  namespace {
       
  1332 @@ -264,17 +264,17 @@ HandlerServiceParent::RecvExists(const H
       
  1333  }
       
  1334  
       
  1335  mozilla::ipc::IPCResult
       
  1336  HandlerServiceParent::RecvExistsForProtocol(const nsCString& aProtocolScheme,
       
  1337                                              bool* aHandlerExists)
       
  1338  {
  1182  {
  1339  #ifdef MOZ_WIDGET_GTK
  1183  #ifdef MOZ_WIDGET_GTK
  1340    // Check the GNOME registry for a protocol handler
  1184    // Check the GNOME registry for a protocol handler
  1341 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
  1185 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
  1342 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
  1186 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
  1343  #else
  1187  #else
  1344    *aHandlerExists = false;
  1188    *aHandlerExists = false;
  1345  #endif
  1189  #endif
  1346    return IPC_OK();
  1190 Index: firefox-60.2.0/uriloader/exthandler/moz.build
  1347  }
  1191 ===================================================================
  1348  
  1192 --- firefox-60.2.0.orig/uriloader/exthandler/moz.build	2018-09-05 21:49:23.106829422 +0200
  1349  mozilla::ipc::IPCResult
  1193 +++ firefox-60.2.0/uriloader/exthandler/moz.build	2018-09-05 21:49:31.502872845 +0200
  1350  HandlerServiceParent::RecvGetTypeFromExtension(const nsCString& aFileExtension,
  1194 @@ -82,7 +82,9 @@ else:
  1351 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
       
  1352 --- a/uriloader/exthandler/moz.build
       
  1353 +++ b/uriloader/exthandler/moz.build
       
  1354 @@ -77,17 +77,19 @@ else:
       
  1355      SOURCES += [
       
  1356          osdir + '/nsOSHelperAppService.cpp',
       
  1357      ]
       
  1358      if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
       
  1359          CXXFLAGS += ['-Wno-error=shadow']
       
  1360  
  1195  
  1361  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  1196  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  1362      UNIFIED_SOURCES += [
  1197      UNIFIED_SOURCES += [
  1363 +        'unix/nsCommonRegistry.cpp',
  1198 +        'unix/nsCommonRegistry.cpp',
  1364          'unix/nsGNOMERegistry.cpp',
  1199          'unix/nsGNOMERegistry.cpp',
  1365 +        'unix/nsKDERegistry.cpp',
  1200 +        'unix/nsKDERegistry.cpp',
  1366          'unix/nsMIMEInfoUnix.cpp',
  1201          'unix/nsMIMEInfoUnix.cpp',
  1367      ]
  1202      ]
  1368  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
  1203  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
  1369      UNIFIED_SOURCES += [
  1204 @@ -129,6 +131,7 @@ LOCAL_INCLUDES += [
  1370          'android/nsAndroidHandlerApp.cpp',
       
  1371          'android/nsExternalSharingAppService.cpp',
       
  1372          'android/nsExternalURLHandlerService.cpp',
       
  1373          'android/nsMIMEInfoAndroid.cpp',
       
  1374 @@ -124,16 +126,17 @@ include('/ipc/chromium/chromium-config.m
       
  1375  FINAL_LIBRARY = 'xul'
       
  1376  
       
  1377  LOCAL_INCLUDES += [
       
  1378      '/docshell/base',
       
  1379      '/dom/base',
       
  1380      '/dom/ipc',
  1205      '/dom/ipc',
  1381      '/netwerk/base',
  1206      '/netwerk/base',
  1382      '/netwerk/protocol/http',
  1207      '/netwerk/protocol/http',
  1383 +    '/toolkit/xre',
  1208 +    '/toolkit/xre',
  1384  ]
  1209  ]
  1385  
  1210  
  1386  if CONFIG['MOZ_ENABLE_DBUS']:
  1211  if CONFIG['MOZ_ENABLE_DBUS']:
  1387      CXXFLAGS += CONFIG['TK_CFLAGS']
  1212 Index: firefox-60.2.0/uriloader/exthandler/unix/nsCommonRegistry.cpp
  1388      CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
  1213 ===================================================================
  1389  
  1214 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  1390  if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
  1215 +++ firefox-60.2.0/uriloader/exthandler/unix/nsCommonRegistry.cpp	2018-09-05 21:49:31.502872845 +0200
  1391      CXXFLAGS += CONFIG['TK_CFLAGS']
       
  1392 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
       
  1393 new file mode 100644
       
  1394 --- /dev/null
       
  1395 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
       
  1396 @@ -0,0 +1,53 @@
  1216 @@ -0,0 +1,53 @@
  1397 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1217 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1398 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1218 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1399 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1219 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1400 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1220 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1445 +{
  1265 +{
  1446 +    if( nsKDEUtils::kdeSupport())
  1266 +    if( nsKDEUtils::kdeSupport())
  1447 +        return nsKDERegistry::GetFromType( aMIMEType );
  1267 +        return nsKDERegistry::GetFromType( aMIMEType );
  1448 +    return nsGNOMERegistry::GetFromType( aMIMEType );
  1268 +    return nsGNOMERegistry::GetFromType( aMIMEType );
  1449 +}
  1269 +}
  1450 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h
  1270 Index: firefox-60.2.0/uriloader/exthandler/unix/nsCommonRegistry.h
  1451 new file mode 100644
  1271 ===================================================================
  1452 --- /dev/null
  1272 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  1453 +++ b/uriloader/exthandler/unix/nsCommonRegistry.h
  1273 +++ firefox-60.2.0/uriloader/exthandler/unix/nsCommonRegistry.h	2018-09-05 21:49:31.502872845 +0200
  1454 @@ -0,0 +1,28 @@
  1274 @@ -0,0 +1,28 @@
  1455 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1275 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1456 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1276 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1457 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1277 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1458 +
  1278 +
  1478 +
  1298 +
  1479 +  static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType);
  1299 +  static already_AddRefed<nsMIMEInfoBase> GetFromType(const nsACString& aMIMEType);
  1480 +};
  1300 +};
  1481 +
  1301 +
  1482 +#endif
  1302 +#endif
  1483 diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp
  1303 Index: firefox-60.2.0/uriloader/exthandler/unix/nsKDERegistry.cpp
  1484 new file mode 100644
  1304 ===================================================================
  1485 --- /dev/null
  1305 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  1486 +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
  1306 +++ firefox-60.2.0/uriloader/exthandler/unix/nsKDERegistry.cpp	2018-09-05 21:49:31.502872845 +0200
  1487 @@ -0,0 +1,87 @@
  1307 @@ -0,0 +1,87 @@
  1488 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1308 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  1489 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1309 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1490 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1310 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1491 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1311 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1570 +        mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
  1390 +        mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault);
  1571 +        return mimeInfo.forget();
  1391 +        return mimeInfo.forget();
  1572 +        }
  1392 +        }
  1573 +    return nullptr;
  1393 +    return nullptr;
  1574 +}
  1394 +}
  1575 diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h
  1395 Index: firefox-60.2.0/uriloader/exthandler/unix/nsKDERegistry.h
  1576 new file mode 100644
  1396 ===================================================================
  1577 --- /dev/null
  1397 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
  1578 +++ b/uriloader/exthandler/unix/nsKDERegistry.h
  1398 +++ firefox-60.2.0/uriloader/exthandler/unix/nsKDERegistry.h	2018-09-05 21:49:31.502872845 +0200
  1579 @@ -0,0 +1,34 @@
  1399 @@ -0,0 +1,34 @@
  1580 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1400 +/* This Source Code Form is subject to the terms of the Mozilla Public
  1581 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1401 + * License, v. 2.0. If a copy of the MPL was not distributed with this
  1582 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1402 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1583 +
  1403 +
  1609 +  static already_AddRefed<nsMIMEInfoBase> GetFromHelper(const nsTArray<nsCString>& command);
  1429 +  static already_AddRefed<nsMIMEInfoBase> GetFromHelper(const nsTArray<nsCString>& command);
  1610 +
  1430 +
  1611 +};
  1431 +};
  1612 +
  1432 +
  1613 +#endif //nsKDERegistry_h__
  1433 +#endif //nsKDERegistry_h__
  1614 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1434 Index: firefox-60.2.0/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1615 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1435 ===================================================================
  1616 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1436 --- firefox-60.2.0.orig/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp	2018-09-05 21:49:23.106829422 +0200
  1617 @@ -1,50 +1,53 @@
  1437 +++ firefox-60.2.0/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp	2018-09-05 21:49:31.502872845 +0200
  1618  /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  1438 @@ -5,7 +5,7 @@
  1619   *
       
  1620   * This Source Code Form is subject to the terms of the Mozilla Public
       
  1621   * License, v. 2.0. If a copy of the MPL was not distributed with this
       
  1622   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1439   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1623  
  1440  
  1624  #include "nsMIMEInfoUnix.h"
  1441  #include "nsMIMEInfoUnix.h"
  1625 -#include "nsGNOMERegistry.h"
  1442 -#include "nsGNOMERegistry.h"
  1626 +#include "nsCommonRegistry.h"
  1443 +#include "nsCommonRegistry.h"
  1627  #include "nsIGIOService.h"
  1444  #include "nsIGIOService.h"
  1628  #include "nsNetCID.h"
  1445  #include "nsNetCID.h"
  1629  #include "nsIIOService.h"
  1446  #include "nsIIOService.h"
  1630  #include "nsAutoPtr.h"
  1447 @@ -13,11 +13,14 @@
  1631  #ifdef MOZ_ENABLE_DBUS
  1448  #ifdef MOZ_ENABLE_DBUS
  1632  #include "nsDBusHandlerApp.h"
  1449  #include "nsDBusHandlerApp.h"
  1633  #endif
  1450  #endif
  1634 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  1451 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  1635 +#include "nsKDEUtils.h"
  1452 +#include "nsKDEUtils.h"
  1641 -  return nsGNOMERegistry::LoadURL(aURI);
  1458 -  return nsGNOMERegistry::LoadURL(aURI);
  1642 +  return nsCommonRegistry::LoadURL(aURI);
  1459 +  return nsCommonRegistry::LoadURL(aURI);
  1643  }
  1460  }
  1644  
  1461  
  1645  NS_IMETHODIMP
  1462  NS_IMETHODIMP
  1646  nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval)
  1463 @@ -32,14 +35,14 @@ nsMIMEInfoUnix::GetHasDefaultHandler(boo
  1647  {
       
  1648    // if mDefaultApplication is set, it means the application has been set from
       
  1649    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
       
  1650    // give the GNOME answer.
       
  1651    if (mDefaultApplication)
       
  1652      return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
       
  1653  
       
  1654    *_retval = false;
  1464    *_retval = false;
  1655  
  1465  
  1656    if (mClass == eProtocolInfo) {
  1466    if (mClass == eProtocolInfo) {
  1657 -    *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get());
  1467 -    *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get());
  1658 +    *_retval = nsCommonRegistry::HandlerExists(mSchemeOrType.get());
  1468 +    *_retval = nsCommonRegistry::HandlerExists(mSchemeOrType.get());
  1666 -        mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  1476 -        mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  1667 +        mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  1477 +        mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  1668        }
  1478        }
  1669      }
  1479      }
  1670      if (mimeInfo)
  1480      if (mimeInfo)
  1671        *_retval = true;
  1481 @@ -64,6 +67,23 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
  1672    }
       
  1673  
       
  1674    if (*_retval)
       
  1675      return NS_OK;
       
  1676 @@ -59,16 +62,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
       
  1677    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
       
  1678    // give the GNOME answer.
       
  1679    if (mDefaultApplication)
       
  1680      return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
       
  1681  
       
  1682    nsAutoCString nativePath;
  1482    nsAutoCString nativePath;
  1683    aFile->GetNativePath(nativePath);
  1483    aFile->GetNativePath(nativePath);
  1684  
  1484  
  1685 +  if( nsKDEUtils::kdeSupport()) {
  1485 +  if( nsKDEUtils::kdeSupport()) {
  1686 +    bool supports;
  1486 +    bool supports;
  1700 +  }
  1500 +  }
  1701 +
  1501 +
  1702    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1502    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1703    if (!giovfs) {
  1503    if (!giovfs) {
  1704      return NS_ERROR_FAILURE;
  1504      return NS_ERROR_FAILURE;
  1705    }
  1505 Index: firefox-60.2.0/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1706  
  1506 ===================================================================
  1707    // nsGIOMimeApp->Launch wants a URI string instead of local file
  1507 --- firefox-60.2.0.orig/uriloader/exthandler/unix/nsOSHelperAppService.cpp	2018-09-05 21:49:23.106829422 +0200
  1708    nsresult rv;
  1508 +++ firefox-60.2.0/uriloader/exthandler/unix/nsOSHelperAppService.cpp	2018-09-05 21:49:31.502872845 +0200
  1709    nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
  1509 @@ -10,7 +10,7 @@
  1710 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
       
  1711 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
       
  1712 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
       
  1713 @@ -5,17 +5,17 @@
       
  1714   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       
  1715  
       
  1716  #include <sys/types.h>
       
  1717  #include <sys/stat.h>
       
  1718  
       
  1719  #include "nsOSHelperAppService.h"
  1510  #include "nsOSHelperAppService.h"
  1720  #include "nsMIMEInfoUnix.h"
  1511  #include "nsMIMEInfoUnix.h"
  1721  #ifdef MOZ_WIDGET_GTK
  1512  #ifdef MOZ_WIDGET_GTK
  1722 -#include "nsGNOMERegistry.h"
  1513 -#include "nsGNOMERegistry.h"
  1723 +#include "nsCommonRegistry.h"
  1514 +#include "nsCommonRegistry.h"
  1724  #endif
  1515  #endif
  1725  #include "nsISupports.h"
  1516  #include "nsISupports.h"
  1726  #include "nsString.h"
  1517  #include "nsString.h"
  1727  #include "nsReadableUtils.h"
  1518 @@ -1133,7 +1133,7 @@ nsresult nsOSHelperAppService::OSProtoco
  1728  #include "nsUnicharUtils.h"
       
  1729  #include "nsIURL.h"
       
  1730  #include "nsIFileStreams.h"
       
  1731  #include "nsILineInputStream.h"
       
  1732 @@ -1128,17 +1128,17 @@ nsOSHelperAppService::GetHandlerAndDescr
       
  1733  
       
  1734  nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolScheme, bool * aHandlerExists)
       
  1735  {
       
  1736    nsresult rv = NS_OK;
       
  1737  
       
  1738    if (!XRE_IsContentProcess()) {
  1519    if (!XRE_IsContentProcess()) {
  1739  #ifdef MOZ_WIDGET_GTK
  1520  #ifdef MOZ_WIDGET_GTK
  1740      // Check the GNOME registry for a protocol handler
  1521      // Check the GNOME registry for a protocol handler
  1741 -    *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
  1522 -    *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
  1742 +    *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
  1523 +    *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
  1743  #else
  1524  #else
  1744      *aHandlerExists = false;
  1525      *aHandlerExists = false;
  1745  #endif
  1526  #endif
  1746    } else {
  1527 @@ -1151,7 +1151,7 @@ nsresult nsOSHelperAppService::OSProtoco
  1747      *aHandlerExists = false;
       
  1748      nsCOMPtr<nsIHandlerService> handlerSvc = do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv);
       
  1749      if (NS_SUCCEEDED(rv) && handlerSvc) {
       
  1750        rv = handlerSvc->ExistsForProtocol(nsCString(aProtocolScheme), aHandlerExists);
       
  1751 @@ -1146,17 +1146,17 @@ nsresult nsOSHelperAppService::OSProtoco
       
  1752    }
       
  1753  
       
  1754    return rv;
       
  1755  }
       
  1756  
       
  1757  NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
  1528  NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
  1758  {
  1529  {
  1759  #ifdef MOZ_WIDGET_GTK
  1530  #ifdef MOZ_WIDGET_GTK
  1760 -  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
  1531 -  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
  1761 +  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
  1532 +  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
  1762    return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
  1533    return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
  1763  #else
  1534  #else
  1764    return NS_ERROR_NOT_AVAILABLE;
  1535    return NS_ERROR_NOT_AVAILABLE;
  1765  #endif
  1536 @@ -1248,7 +1248,7 @@ nsOSHelperAppService::GetFromExtension(c
  1766  }
       
  1767  
       
  1768  nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile)
       
  1769  {
       
  1770 @@ -1243,17 +1243,17 @@ nsOSHelperAppService::GetFromExtension(c
       
  1771                                           mime_types_description,
       
  1772                                           true);
       
  1773  
       
  1774    if (NS_FAILED(rv) || majorType.IsEmpty()) {
       
  1775  
       
  1776  #ifdef MOZ_WIDGET_GTK
  1537  #ifdef MOZ_WIDGET_GTK
  1777      LOG(("Looking in GNOME registry\n"));
  1538      LOG(("Looking in GNOME registry\n"));
  1778      RefPtr<nsMIMEInfoBase> gnomeInfo =
  1539      RefPtr<nsMIMEInfoBase> gnomeInfo =
  1779 -      nsGNOMERegistry::GetFromExtension(aFileExt);
  1540 -      nsGNOMERegistry::GetFromExtension(aFileExt);
  1780 +      nsCommonRegistry::GetFromExtension(aFileExt);
  1541 +      nsCommonRegistry::GetFromExtension(aFileExt);
  1781      if (gnomeInfo) {
  1542      if (gnomeInfo) {
  1782        LOG(("Got MIMEInfo from GNOME registry\n"));
  1543        LOG(("Got MIMEInfo from GNOME registry\n"));
  1783        return gnomeInfo.forget();
  1544        return gnomeInfo.forget();
  1784      }
  1545 @@ -1369,7 +1369,7 @@ nsOSHelperAppService::GetFromType(const
  1785  #endif
       
  1786  
       
  1787      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt),
       
  1788                                    majorType,
       
  1789 @@ -1364,17 +1364,17 @@ nsOSHelperAppService::GetFromType(const 
       
  1790    nsAutoString extensions, mime_types_description;
       
  1791    LookUpExtensionsAndDescription(majorType,
       
  1792                                   minorType,
       
  1793                                   extensions,
       
  1794                                   mime_types_description);
       
  1795  
  1546  
  1796  #ifdef MOZ_WIDGET_GTK
  1547  #ifdef MOZ_WIDGET_GTK
  1797    if (handler.IsEmpty()) {
  1548    if (handler.IsEmpty()) {
  1798 -    RefPtr<nsMIMEInfoBase> gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
  1549 -    RefPtr<nsMIMEInfoBase> gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
  1799 +    RefPtr<nsMIMEInfoBase> gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType);
  1550 +    RefPtr<nsMIMEInfoBase> gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType);
  1800      if (gnomeInfo) {
  1551      if (gnomeInfo) {
  1801        LOG(("Got MIMEInfo from GNOME registry without extensions; setting them "
  1552        LOG(("Got MIMEInfo from GNOME registry without extensions; setting them "
  1802             "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get()));
  1553             "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get()));
  1803  
  1554 Index: firefox-60.2.0/widget/gtk/moz.build
  1804        NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
  1555 ===================================================================
  1805        gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
  1556 --- firefox-60.2.0.orig/widget/gtk/moz.build	2018-09-05 21:49:23.106829422 +0200
  1806        return gnomeInfo.forget();
  1557 +++ firefox-60.2.0/widget/gtk/moz.build	2018-09-05 21:49:31.502872845 +0200
  1807      }
  1558 @@ -126,6 +126,7 @@ LOCAL_INCLUDES += [
  1808 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
       
  1809 --- a/widget/gtk/moz.build
       
  1810 +++ b/widget/gtk/moz.build
       
  1811 @@ -121,16 +121,17 @@ else:
       
  1812  include('/ipc/chromium/chromium-config.mozbuild')
       
  1813  
       
  1814  FINAL_LIBRARY = 'xul'
       
  1815  
       
  1816  LOCAL_INCLUDES += [
       
  1817      '/layout/generic',
  1559      '/layout/generic',
  1818      '/layout/xul',
  1560      '/layout/xul',
  1819      '/other-licenses/atk-1.0',
  1561      '/other-licenses/atk-1.0',
  1820 +    '/toolkit/xre',
  1562 +    '/toolkit/xre',
  1821      '/widget',
  1563      '/widget',
  1822      '/widget/headless',
  1564      '/widget/headless',
  1823  ]
  1565  ]
  1824  
  1566 Index: firefox-60.2.0/widget/gtk/nsFilePicker.cpp
  1825  if CONFIG['MOZ_X11']:
  1567 ===================================================================
  1826      LOCAL_INCLUDES += [
  1568 --- firefox-60.2.0.orig/widget/gtk/nsFilePicker.cpp	2018-09-05 21:49:23.106829422 +0200
  1827          '/widget/x11',
  1569 +++ firefox-60.2.0/widget/gtk/nsFilePicker.cpp	2018-09-05 21:49:31.502872845 +0200
  1828      ]
  1570 @@ -9,6 +9,7 @@
  1829 diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
       
  1830 --- a/widget/gtk/nsFilePicker.cpp
       
  1831 +++ b/widget/gtk/nsFilePicker.cpp
       
  1832 @@ -4,32 +4,34 @@
       
  1833   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       
  1834  
       
  1835  #include "mozilla/Types.h"
       
  1836  #include <sys/types.h>
       
  1837  #include <sys/stat.h>
       
  1838  #include <unistd.h>
  1571  #include <unistd.h>
  1839  
  1572  
  1840  #include <gtk/gtk.h>
  1573  #include <gtk/gtk.h>
  1841 +#include <gdk/gdkx.h>
  1574 +#include <gdk/gdkx.h>
  1842  
  1575  
  1843  #include "nsGtkUtils.h"
  1576  #include "nsGtkUtils.h"
  1844  #include "nsIFileURL.h"
  1577  #include "nsIFileURL.h"
  1845  #include "nsIURI.h"
  1578 @@ -25,6 +26,7 @@
  1846  #include "nsIWidget.h"
       
  1847  #include "nsIFile.h"
       
  1848  #include "nsIStringBundle.h"
       
  1849  
       
  1850  #include "nsArrayEnumerator.h"
       
  1851  #include "nsMemory.h"
       
  1852  #include "nsEnumeratorUtils.h"
       
  1853  #include "nsNetUtil.h"
       
  1854  #include "nsReadableUtils.h"
       
  1855  #include "mozcontainer.h"
  1579  #include "mozcontainer.h"
  1856  
  1580  
  1857  #include "nsFilePicker.h"
  1581  #include "nsFilePicker.h"
  1858 +#include "nsKDEUtils.h"
  1582 +#include "nsKDEUtils.h"
  1859  
  1583  
  1860  using namespace mozilla;
  1584  using namespace mozilla;
  1861  
  1585  
  1862  #define MAX_PREVIEW_SIZE 180
  1586 @@ -251,7 +253,9 @@ nsFilePicker::AppendFilter(const nsAStri
  1863  // bug 1184009
       
  1864  #define MAX_PREVIEW_SOURCE_SIZE 4096
       
  1865  
       
  1866  nsIFile *nsFilePicker::mPrevDisplayDirectory = nullptr;
       
  1867 @@ -246,17 +248,19 @@ nsFilePicker::AppendFilters(int32_t aFil
       
  1868    return nsBaseFilePicker::AppendFilters(aFilterMask);
       
  1869  }
       
  1870  
       
  1871  NS_IMETHODIMP
       
  1872  nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter)
       
  1873  {
  1587  {
  1874    if (aFilter.EqualsLiteral("..apps")) {
  1588    if (aFilter.EqualsLiteral("..apps")) {
  1875      // No platform specific thing we can do here, really....
  1589      // No platform specific thing we can do here, really....
  1876 -    return NS_OK;
  1590 -    return NS_OK;
  1877 +    // Unless it's KDE.
  1591 +    // Unless it's KDE.
  1878 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  1592 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  1879 +      return NS_OK;
  1593 +      return NS_OK;
  1880    }
  1594    }
  1881  
  1595  
  1882    nsAutoCString filter, name;
  1596    nsAutoCString filter, name;
  1883    CopyUTF16toUTF8(aFilter, filter);
  1597 @@ -376,6 +380,29 @@ nsFilePicker::Open(nsIFilePickerShownCal
  1884    CopyUTF16toUTF8(aTitle, name);
       
  1885  
       
  1886    mFilters.AppendElement(filter);
       
  1887    mFilterNames.AppendElement(name);
       
  1888 @@ -371,16 +375,39 @@ nsFilePicker::Show(int16_t *aReturn)
       
  1889  
       
  1890  NS_IMETHODIMP
       
  1891  nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
       
  1892  {
       
  1893    // Can't show two dialogs concurrently with the same filepicker
       
  1894    if (mRunning)
  1598    if (mRunning)
  1895      return NS_ERROR_NOT_AVAILABLE;
  1599      return NS_ERROR_NOT_AVAILABLE;
  1896  
  1600  
  1897 +  // KDE file picker is not handled via callback
  1601 +  // KDE file picker is not handled via callback
  1898 +  if( nsKDEUtils::kdeSupport()) {
  1602 +  if( nsKDEUtils::kdeSupport()) {
  1918 +  }
  1622 +  }
  1919 +
  1623 +
  1920    nsCString title;
  1624    nsCString title;
  1921    title.Adopt(ToNewUTF8String(mTitle));
  1625    title.Adopt(ToNewUTF8String(mTitle));
  1922  
  1626  
  1923    GtkWindow *parent_widget =
  1627 @@ -613,3 +640,228 @@ nsFilePicker::Done(GtkWidget* file_choos
  1924      GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
       
  1925  
       
  1926    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
       
  1927  
       
  1928 @@ -608,8 +635,233 @@ nsFilePicker::Done(GtkWidget* file_choos
       
  1929    if (mCallback) {
       
  1930      mCallback->Done(result);
       
  1931      mCallback = nullptr;
       
  1932    } else {
       
  1933      mResult = result;
       
  1934    }
  1628    }
  1935    NS_RELEASE_THIS();
  1629    NS_RELEASE_THIS();
  1936  }
  1630  }
  1937 +
  1631 +
  1938 +nsCString nsFilePicker::kdeMakeFilter( int index )
  1632 +nsCString nsFilePicker::kdeMakeFilter( int index )
  2157 +        *aReturn = nsIFilePicker::returnCancel;
  1851 +        *aReturn = nsIFilePicker::returnCancel;
  2158 +        }
  1852 +        }
  2159 +    return NS_OK;
  1853 +    return NS_OK;
  2160 +    }
  1854 +    }
  2161 +
  1855 +
  2162 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  1856 Index: firefox-60.2.0/widget/gtk/nsFilePicker.h
  2163 --- a/widget/gtk/nsFilePicker.h
  1857 ===================================================================
  2164 +++ b/widget/gtk/nsFilePicker.h
  1858 --- firefox-60.2.0.orig/widget/gtk/nsFilePicker.h	2018-09-05 21:49:23.106829422 +0200
  2165 @@ -69,14 +69,20 @@ protected:
  1859 +++ firefox-60.2.0/widget/gtk/nsFilePicker.h	2018-09-05 21:49:31.502872845 +0200
  2166    nsString  mDefaultExtension;
  1860 @@ -74,6 +74,12 @@ protected:
  2167  
       
  2168    nsTArray<nsCString> mFilters;
       
  2169    nsTArray<nsCString> mFilterNames;
       
  2170  
       
  2171  private:
  1861  private:
  2172    static nsIFile *mPrevDisplayDirectory;
  1862    static nsIFile *mPrevDisplayDirectory;
  2173  
  1863  
  2174 +  bool kdeRunning();
  1864 +  bool kdeRunning();
  2175 +  bool getKdeRunning();
  1865 +  bool getKdeRunning();
  2178 +  nsCString kdeMakeFilter( int index );
  1868 +  nsCString kdeMakeFilter( int index );
  2179 +
  1869 +
  2180  #ifdef MOZ_WIDGET_GTK
  1870  #ifdef MOZ_WIDGET_GTK
  2181    GtkFileChooserWidget *mFileChooserDelegate;
  1871    GtkFileChooserWidget *mFileChooserDelegate;
  2182  #endif
  1872  #endif
  2183  };
  1873 Index: firefox-60.2.0/xpcom/components/ManifestParser.cpp
  2184  
  1874 ===================================================================
  2185  #endif
  1875 --- firefox-60.2.0.orig/xpcom/components/ManifestParser.cpp	2018-09-05 21:49:23.106829422 +0200
  2186 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  1876 +++ firefox-60.2.0/xpcom/components/ManifestParser.cpp	2018-09-05 21:49:31.502872845 +0200
  2187 --- a/xpcom/components/ManifestParser.cpp
  1877 @@ -38,6 +38,7 @@
  2188 +++ b/xpcom/components/ManifestParser.cpp
       
  2189 @@ -33,16 +33,17 @@
       
  2190  #include "nsTextFormatter.h"
       
  2191  #include "nsVersionComparator.h"
       
  2192  #include "nsXPCOMCIDInternal.h"
       
  2193  
       
  2194  #include "nsIConsoleService.h"
       
  2195  #include "nsIScriptError.h"
  1878  #include "nsIScriptError.h"
  2196  #include "nsIXULAppInfo.h"
  1879  #include "nsIXULAppInfo.h"
  2197  #include "nsIXULRuntime.h"
  1880  #include "nsIXULRuntime.h"
  2198 +#include "nsKDEUtils.h"
  1881 +#include "nsKDEUtils.h"
  2199  
  1882  
  2200  using namespace mozilla;
  1883  using namespace mozilla;
  2201  
  1884  
  2202  struct ManifestDirective
  1885 @@ -449,6 +450,7 @@ ParseManifest(NSLocationType aType, File
  2203  {
       
  2204    const char* directive;
       
  2205    int argc;
       
  2206  
       
  2207 @@ -444,16 +445,17 @@ ParseManifest(NSLocationType aType, File
       
  2208    NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
       
  2209    NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
       
  2210    NS_NAMED_LITERAL_STRING(kApplication, "application");
       
  2211    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
       
  2212    NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
       
  2213    NS_NAMED_LITERAL_STRING(kOs, "os");
  1886    NS_NAMED_LITERAL_STRING(kOs, "os");
  2214    NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
  1887    NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
  2215    NS_NAMED_LITERAL_STRING(kABI, "abi");
  1888    NS_NAMED_LITERAL_STRING(kABI, "abi");
  2216 +  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
  1889 +  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
  2217    NS_NAMED_LITERAL_STRING(kProcess, "process");
  1890    NS_NAMED_LITERAL_STRING(kProcess, "process");
  2218  #if defined(MOZ_WIDGET_ANDROID)
  1891  #if defined(MOZ_WIDGET_ANDROID)
  2219    NS_NAMED_LITERAL_STRING(kTablet, "tablet");
  1892    NS_NAMED_LITERAL_STRING(kTablet, "tablet");
  2220  #endif
  1893 @@ -504,6 +506,7 @@ ParseManifest(NSLocationType aType, File
  2221  
       
  2222    NS_NAMED_LITERAL_STRING(kMain, "main");
       
  2223    NS_NAMED_LITERAL_STRING(kContent, "content");
       
  2224  
       
  2225 @@ -499,44 +501,49 @@ ParseManifest(NSLocationType aType, File
       
  2226          CopyUTF8toUTF16(s, abi);
       
  2227          abi.Insert(char16_t('_'), 0);
       
  2228          abi.Insert(osTarget, 0);
       
  2229        }
       
  2230      }
       
  2231    }
  1894    }
  2232  
  1895  
  2233    nsAutoString osVersion;
  1896    nsAutoString osVersion;
  2234 +  nsAutoString desktop;
  1897 +  nsAutoString desktop;
  2235  #if defined(XP_WIN)
  1898  #if defined(XP_WIN)
  2236  #pragma warning(push)
  1899  #pragma warning(push)
  2237  #pragma warning(disable:4996) // VC12+ deprecates GetVersionEx
  1900  #pragma warning(disable:4996) // VC12+ deprecates GetVersionEx
  2238    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
  1901 @@ -513,6 +516,7 @@ ParseManifest(NSLocationType aType, File
  2239    if (GetVersionEx(&info)) {
       
  2240      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
       
  2241                                info.dwMajorVersion,
  1902                                info.dwMajorVersion,
  2242                                info.dwMinorVersion);
  1903                                info.dwMinorVersion);
  2243    }
  1904    }
  2244 +  desktop = NS_LITERAL_STRING("win");
  1905 +  desktop = NS_LITERAL_STRING("win");
  2245  #pragma warning(pop)
  1906  #pragma warning(pop)
  2246  #elif defined(MOZ_WIDGET_COCOA)
  1907  #elif defined(MOZ_WIDGET_COCOA)
  2247    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
  1908    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
  2248    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
  1909 @@ -520,10 +524,12 @@ ParseManifest(NSLocationType aType, File
  2249    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  1910    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  2250                              majorVersion,
  1911                              majorVersion,
  2251                              minorVersion);
  1912                              minorVersion);
  2252 +  desktop = NS_LITERAL_STRING("macosx");
  1913 +  desktop = NS_LITERAL_STRING("macosx");
  2253  #elif defined(MOZ_WIDGET_GTK)
  1914  #elif defined(MOZ_WIDGET_GTK)
  2256                              gtk_minor_version);
  1917                              gtk_minor_version);
  2257 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
  1918 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
  2258  #elif defined(MOZ_WIDGET_ANDROID)
  1919  #elif defined(MOZ_WIDGET_ANDROID)
  2259    bool isTablet = false;
  1920    bool isTablet = false;
  2260    if (mozilla::AndroidBridge::Bridge()) {
  1921    if (mozilla::AndroidBridge::Bridge()) {
  2261      mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
  1922 @@ -532,6 +538,7 @@ ParseManifest(NSLocationType aType, File
  2262                                                             "RELEASE",
       
  2263                                                             osVersion);
  1923                                                             osVersion);
  2264      isTablet = java::GeckoAppShell::IsTablet();
  1924      isTablet = java::GeckoAppShell::IsTablet();
  2265    }
  1925    }
  2266 +  desktop = NS_LITERAL_STRING("android");
  1926 +  desktop = NS_LITERAL_STRING("android");
  2267  #endif
  1927  #endif
  2268  
  1928  
  2269    if (XRE_IsContentProcess()) {
  1929    if (XRE_IsContentProcess()) {
  2270      process = kContent;
  1930 @@ -643,6 +650,7 @@ ParseManifest(NSLocationType aType, File
  2271    } else {
       
  2272      process = kMain;
       
  2273    }
       
  2274  
       
  2275 @@ -638,25 +645,27 @@ ParseManifest(NSLocationType aType, File
       
  2276      TriState stOsVersion = eUnspecified;
       
  2277      TriState stOs = eUnspecified;
       
  2278      TriState stABI = eUnspecified;
       
  2279      TriState stProcess = eUnspecified;
       
  2280  #if defined(MOZ_WIDGET_ANDROID)
       
  2281      TriState stTablet = eUnspecified;
  1931      TriState stTablet = eUnspecified;
  2282  #endif
  1932  #endif
  2283      int flags = 0;
  1933      int flags = 0;
  2284 +    TriState stDesktop = eUnspecified;
  1934 +    TriState stDesktop = eUnspecified;
  2285  
  1935  
  2286      while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
  1936      while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
  2287             ok) {
  1937             ok) {
  2288        ToLowerCase(token);
  1938 @@ -652,6 +660,7 @@ ParseManifest(NSLocationType aType, File
  2289        NS_ConvertASCIItoUTF16 wtoken(token);
       
  2290  
       
  2291        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
  1939        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
  2292            CheckOsFlag(kOs, wtoken, osTarget, stOs) ||
  1940            CheckOsFlag(kOs, wtoken, osTarget, stOs) ||
  2293            CheckStringFlag(kABI, wtoken, abi, stABI) ||
  1941            CheckStringFlag(kABI, wtoken, abi, stABI) ||
  2294 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
  1942 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
  2295            CheckStringFlag(kProcess, wtoken, process, stProcess) ||
  1943            CheckStringFlag(kProcess, wtoken, process, stProcess) ||
  2296            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
  1944            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
  2297            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
  1945            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
  2298            CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion)) {
  1946 @@ -706,6 +715,7 @@ ParseManifest(NSLocationType aType, File
  2299          continue;
       
  2300        }
       
  2301  
       
  2302  #if defined(MOZ_WIDGET_ANDROID)
       
  2303 @@ -701,16 +710,17 @@ ParseManifest(NSLocationType aType, File
       
  2304      }
       
  2305  
       
  2306      if (!ok ||
       
  2307          stApp == eBad ||
       
  2308          stAppVersion == eBad ||
       
  2309          stGeckoVersion == eBad ||
  1947          stGeckoVersion == eBad ||
  2310          stOs == eBad ||
  1948          stOs == eBad ||
  2311          stOsVersion == eBad ||
  1949          stOsVersion == eBad ||
  2312 +        stDesktop == eBad ||
  1950 +        stDesktop == eBad ||
  2313  #ifdef MOZ_WIDGET_ANDROID
  1951  #ifdef MOZ_WIDGET_ANDROID
  2314          stTablet == eBad ||
  1952          stTablet == eBad ||
  2315  #endif
  1953  #endif
  2316          stABI == eBad ||
  1954 Index: firefox-60.2.0/xpcom/components/moz.build
  2317          stProcess == eBad) {
  1955 ===================================================================
  2318        continue;
  1956 --- firefox-60.2.0.orig/xpcom/components/moz.build	2018-09-05 21:49:23.110829442 +0200
  2319      }
  1957 +++ firefox-60.2.0/xpcom/components/moz.build	2018-09-05 21:49:31.502872845 +0200
  2320  
  1958 @@ -49,6 +49,7 @@ LOCAL_INCLUDES += [
  2321 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
       
  2322 --- a/xpcom/components/moz.build
       
  2323 +++ b/xpcom/components/moz.build
       
  2324 @@ -44,12 +44,13 @@ FINAL_LIBRARY = 'xul'
       
  2325  LOCAL_INCLUDES += [
       
  2326      '!..',
       
  2327      '../base',
       
  2328      '../build',
       
  2329      '../ds',
       
  2330      '../reflect/xptinfo',
  1959      '../reflect/xptinfo',
  2331      '/chrome',
  1960      '/chrome',
  2332      '/modules/libjar',
  1961      '/modules/libjar',
  2333 +    '/toolkit/xre'
  1962 +    '/toolkit/xre'
  2334  ]
  1963  ]
  2335  
  1964  
  2336  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  1965  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2337      CXXFLAGS += CONFIG['TK_CFLAGS']
  1966 Index: firefox-60.2.0/xpcom/io/nsLocalFileUnix.cpp
  2338 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  1967 ===================================================================
  2339 --- a/xpcom/io/nsLocalFileUnix.cpp
  1968 --- firefox-60.2.0.orig/xpcom/io/nsLocalFileUnix.cpp	2018-09-05 21:49:23.110829442 +0200
  2340 +++ b/xpcom/io/nsLocalFileUnix.cpp
  1969 +++ firefox-60.2.0/xpcom/io/nsLocalFileUnix.cpp	2018-09-05 21:56:47.649117623 +0200
  2341 @@ -46,16 +46,17 @@
  1970 @@ -52,6 +52,7 @@
  2342  #include "prproces.h"
       
  2343  #include "nsIDirectoryEnumerator.h"
       
  2344  #include "nsISimpleEnumerator.h"
       
  2345  #include "private/pprio.h"
       
  2346  #include "prlink.h"
       
  2347  
  1971  
  2348  #ifdef MOZ_WIDGET_GTK
  1972  #ifdef MOZ_WIDGET_GTK
  2349  #include "nsIGIOService.h"
  1973  #include "nsIGIOService.h"
  2350 +#include "nsKDEUtils.h"
  1974 +#include "nsKDEUtils.h"
  2351  #endif
  1975  #endif
  2352  
  1976  
  2353  #ifdef MOZ_WIDGET_COCOA
  1977  #ifdef MOZ_WIDGET_COCOA
  2354  #include <Carbon/Carbon.h>
  1978 @@ -2010,18 +2011,16 @@ nsLocalFile::Reveal()
  2355  #include "CocoaFileUtils.h"
  1979    }
  2356  #include "prmem.h"
  1980  
  2357  #include "plbase64.h"
       
  2358  
       
  2359 @@ -1955,59 +1956,74 @@ nsLocalFile::SetPersistentDescriptor(con
       
  2360    return InitWithNativePath(aPersistentDescriptor);
       
  2361  #endif
       
  2362  }
       
  2363  
       
  2364  NS_IMETHODIMP
       
  2365  nsLocalFile::Reveal()
       
  2366  {
       
  2367  #ifdef MOZ_WIDGET_GTK
  1981  #ifdef MOZ_WIDGET_GTK
  2368 -  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1982 -  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  2369 -  if (!giovfs) {
  1983 -  if (!giovfs) {
  2370 -    return NS_ERROR_FAILURE;
  1984 -    return NS_ERROR_FAILURE;
  2371 -  }
  1985 -  }
  2381 -    return giovfs->ShowURIForInput(mPath);
  1995 -    return giovfs->ShowURIForInput(mPath);
  2382 +    url = mPath;
  1996 +    url = mPath;
  2383    }
  1997    }
  2384    if (NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
  1998    if (NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
  2385      return NS_OK;
  1999      return NS_OK;
  2386    }
  2000 @@ -2035,7 +2034,7 @@ nsLocalFile::Reveal()
  2387    nsCOMPtr<nsIFile> parentDir;
       
  2388    nsAutoCString dirPath;
       
  2389    if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) {
       
  2390      return NS_ERROR_FAILURE;
       
  2391    }
       
  2392    if (NS_FAILED(parentDir->GetNativePath(dirPath))) {
       
  2393      return NS_ERROR_FAILURE;
  2001      return NS_ERROR_FAILURE;
  2394    }
  2002    }
  2395  
  2003  
  2396 -  return giovfs->ShowURIForInput(dirPath);
  2004 -  return giovfs->ShowURIForInput(dirPath);
  2397 +  url = dirPath;
  2005 +  url = dirPath;
  2398  #elif defined(MOZ_WIDGET_COCOA)
  2006  #elif defined(MOZ_WIDGET_COCOA)
  2399    CFURLRef url;
  2007    CFURLRef url;
  2400    if (NS_SUCCEEDED(GetCFURL(&url))) {
  2008    if (NS_SUCCEEDED(GetCFURL(&url))) {
  2401      nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
  2009 @@ -2047,6 +2046,17 @@ nsLocalFile::Reveal()
  2402      ::CFRelease(url);
       
  2403      return rv;
       
  2404    }
       
  2405    return NS_ERROR_FAILURE;
       
  2406  #else
  2010  #else
  2407    return NS_ERROR_FAILURE;
  2011    return NS_ERROR_FAILURE;
  2408  #endif
  2012  #endif
  2409 +  if(nsKDEUtils::kdeSupport()) {
  2013 +  if(nsKDEUtils::kdeSupport()) {
  2410 +    nsTArray<nsCString> command;
  2014 +    nsTArray<nsCString> command;
  2418 +
  2022 +
  2419 +  return giovfs->ShowURIForInput(url);
  2023 +  return giovfs->ShowURIForInput(url);
  2420  }
  2024  }
  2421  
  2025  
  2422  NS_IMETHODIMP
  2026  NS_IMETHODIMP
  2423  nsLocalFile::Launch()
  2027 @@ -2057,6 +2067,12 @@ nsLocalFile::Launch()
  2424  {
  2028    }
       
  2029  
  2425  #ifdef MOZ_WIDGET_GTK
  2030  #ifdef MOZ_WIDGET_GTK
  2426 +  if( nsKDEUtils::kdeSupport()) {
  2031 +  if( nsKDEUtils::kdeSupport()) {
  2427 +    nsTArray<nsCString> command;
  2032 +    nsTArray<nsCString> command;
  2428 +    command.AppendElement( NS_LITERAL_CSTRING("OPEN") );
  2033 +    command.AppendElement( NS_LITERAL_CSTRING("OPEN") );
  2429 +    command.AppendElement( mPath );
  2034 +    command.AppendElement( mPath );
  2430 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  2035 +    return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE;
  2431 +  }
  2036 +  }
  2432    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  2037    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  2433    if (!giovfs) {
  2038    if (!giovfs) {
  2434      return NS_ERROR_FAILURE;
  2039      return NS_ERROR_FAILURE;
  2435    }
       
  2436  
       
  2437    return giovfs->ShowURIForInput(mPath);
       
  2438  #elif defined(MOZ_WIDGET_ANDROID)
       
  2439    // Try to get a mimetype, if this fails just use the file uri alone