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