mozilla-kde.patch
branchfirefox120
changeset 1199 4c520ebe1ad7
parent 1196 954851a35787
child 1200 2a0735b1eb92
equal deleted inserted replaced
1198:de5582739a05 1199:4c520ebe1ad7
    46  create mode 100644 uriloader/exthandler/unix/nsCommonRegistry.h
    46  create mode 100644 uriloader/exthandler/unix/nsCommonRegistry.h
    47  create mode 100644 uriloader/exthandler/unix/nsKDERegistry.cpp
    47  create mode 100644 uriloader/exthandler/unix/nsKDERegistry.cpp
    48  create mode 100644 uriloader/exthandler/unix/nsKDERegistry.h
    48  create mode 100644 uriloader/exthandler/unix/nsKDERegistry.h
    49 
    49 
    50 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
    50 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
    51 index 94a5aa0f3f169563d570e18fc1a525994293ad99..c1cf316d05b742502f7b07da1b7f25024b09f4e8 100644
       
    52 --- a/modules/libpref/Preferences.cpp
    51 --- a/modules/libpref/Preferences.cpp
    53 +++ b/modules/libpref/Preferences.cpp
    52 +++ b/modules/libpref/Preferences.cpp
    54 @@ -95,6 +95,7 @@
    53 @@ -91,16 +91,17 @@
       
    54  #include "PLDHashTable.h"
       
    55  #include "prdtoa.h"
       
    56  #include "prlink.h"
       
    57  #include "xpcpublic.h"
       
    58  #include "js/RootingAPI.h"
    55  #ifdef MOZ_BACKGROUNDTASKS
    59  #ifdef MOZ_BACKGROUNDTASKS
    56  #  include "mozilla/BackgroundTasks.h"
    60  #  include "mozilla/BackgroundTasks.h"
    57  #endif
    61  #endif
    58 +#include "nsKDEUtils.h"
    62 +#include "nsKDEUtils.h"
    59  
    63  
    60  #ifdef DEBUG
    64  #ifdef DEBUG
    61  #  include <map>
    65  #  include <map>
       
    66  #endif
       
    67  
       
    68  #ifdef MOZ_MEMORY
       
    69  #  include "mozmemory.h"
       
    70  #endif
    62 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
    71 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
    63 index e8f8b97170d32c1d3ac342dd93da7265bf707c8f..831001cee4b1eb33171d83d524ee9e453a800257 100644
       
    64 --- a/modules/libpref/moz.build
    72 --- a/modules/libpref/moz.build
    65 +++ b/modules/libpref/moz.build
    73 +++ b/modules/libpref/moz.build
    66 @@ -126,6 +126,10 @@ UNIFIED_SOURCES += [
    74 @@ -121,16 +121,20 @@ EXPORTS.mozilla += [
       
    75  ]
       
    76  EXPORTS.mozilla += sorted(["!" + g for g in gen_h])
       
    77  
       
    78  UNIFIED_SOURCES += [
       
    79      "Preferences.cpp",
    67      "SharedPrefMap.cpp",
    80      "SharedPrefMap.cpp",
    68  ]
    81  ]
    69  
    82  
    70 +LOCAL_INCLUDES += [
    83 +LOCAL_INCLUDES += [
    71 +    '/toolkit/xre'
    84 +    '/toolkit/xre'
    72 +]
    85 +]
    73 +
    86 +
    74  gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)
    87  gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)
    75  
    88  
    76  GeneratedFile(
    89  GeneratedFile(
       
    90      *gen_all_tuple,
       
    91      script="init/generate_static_pref_list.py",
       
    92      entry_point="emit_code",
       
    93      inputs=["init/StaticPrefList.yaml"]
       
    94  )
    77 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
    95 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
    78 index 6b096c862aaac5e02d9d7dacda42d9321d5e89cc..2b46d9294b93fda17117e9c84b240c52f96c9b74 100644
       
    79 --- a/python/mozbuild/mozpack/chrome/flags.py
    96 --- a/python/mozbuild/mozpack/chrome/flags.py
    80 +++ b/python/mozbuild/mozpack/chrome/flags.py
    97 +++ b/python/mozbuild/mozpack/chrome/flags.py
    81 @@ -234,6 +234,7 @@ class Flags(OrderedDict):
    98 @@ -229,16 +229,17 @@ class Flags(OrderedDict):
       
    99          "os": StringFlag,
       
   100          "osversion": VersionFlag,
       
   101          "abi": StringFlag,
       
   102          "platform": Flag,
       
   103          "xpcnativewrappers": Flag,
    82          "tablet": Flag,
   104          "tablet": Flag,
    83          "process": StringFlag,
   105          "process": StringFlag,
    84          "backgroundtask": StringFlag,
   106          "backgroundtask": StringFlag,
    85 +        "desktop": StringFlag,
   107 +        "desktop": StringFlag,
    86      }
   108      }
    87      RE = re.compile(r"([!<>=]+)")
   109      RE = re.compile(r"([!<>=]+)")
    88  
   110  
       
   111      def __init__(self, *flags):
       
   112          """
       
   113          Initialize a set of flags given in string form.
       
   114             flags = Flags('contentaccessible=yes', 'appversion>=3.5')
       
   115          """
    89 diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
   116 diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
    90 index 14c11d4c1daa8cbb03abf3cd2e1a7b60a981abc8..41b9969e7277fa2400f299863c83145342cd7b43 100644
       
    91 --- a/python/mozbuild/mozpack/chrome/manifest.py
   117 --- a/python/mozbuild/mozpack/chrome/manifest.py
    92 +++ b/python/mozbuild/mozpack/chrome/manifest.py
   118 +++ b/python/mozbuild/mozpack/chrome/manifest.py
    93 @@ -43,6 +43,7 @@ class ManifestEntry(object):
   119 @@ -38,16 +38,17 @@ class ManifestEntry(object):
       
   120          "os",
       
   121          "osversion",
       
   122          "abi",
       
   123          "xpcnativewrappers",
       
   124          "tablet",
    94          "process",
   125          "process",
    95          "contentaccessible",
   126          "contentaccessible",
    96          "backgroundtask",
   127          "backgroundtask",
    97 +        "desktop",
   128 +        "desktop",
    98      ]
   129      ]
    99  
   130  
   100      def __init__(self, base, *flags):
   131      def __init__(self, base, *flags):
       
   132          """
       
   133          Initialize a manifest entry with the given base path and flags.
       
   134          """
       
   135          self.base = base
       
   136          self.flags = Flags(*flags)
   101 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
   137 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
   102 index 3818e8c0db1ed3cfc068d89b18b1fe2f1bf750a9..b70986db811191952919531cfb79e04b801491a2 100644
       
   103 --- a/toolkit/components/downloads/moz.build
   138 --- a/toolkit/components/downloads/moz.build
   104 +++ b/toolkit/components/downloads/moz.build
   139 +++ b/toolkit/components/downloads/moz.build
   105 @@ -51,5 +51,9 @@ if CONFIG["MOZ_PLACES"]:
   140 @@ -46,10 +46,14 @@ XPCOM_MANIFESTS += [
       
   141  
       
   142  if CONFIG["MOZ_PLACES"]:
       
   143      EXTRA_JS_MODULES += [
       
   144          "DownloadHistory.sys.mjs",
       
   145      ]
   106  
   146  
   107  FINAL_LIBRARY = "xul"
   147  FINAL_LIBRARY = "xul"
   108  
   148  
   109 +LOCAL_INCLUDES += [
   149 +LOCAL_INCLUDES += [
   110 +    '/toolkit/xre'
   150 +    '/toolkit/xre'
   111 +]
   151 +]
   112 +
   152 +
   113  with Files("**"):
   153  with Files("**"):
   114      BUG_COMPONENT = ("Toolkit", "Downloads API")
   154      BUG_COMPONENT = ("Toolkit", "Downloads API")
   115 diff --git a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
   155 diff --git a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
   116 index 66f77d38e4ed7b3802303194e8df675a5db81272..f8839c446683620d6df6c6eb2ea0a0ca3549af95 100644
       
   117 --- a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
   156 --- a/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
   118 +++ b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
   157 +++ b/toolkit/mozapps/downloads/HelperAppDlg.sys.mjs
   119 @@ -1246,26 +1246,56 @@ nsUnknownContentTypeDialog.prototype = {
   158 @@ -1241,36 +1241,66 @@ nsUnknownContentTypeDialog.prototype = {
       
   159          params.handlerApp &&
       
   160          params.handlerApp.executable &&
       
   161          params.handlerApp.executable.isFile()
       
   162        ) {
       
   163          // Remember the file they chose to run.
   120          this.chosenApp = params.handlerApp;
   164          this.chosenApp = params.handlerApp;
   121        }
   165        }
   122      } else if ("@mozilla.org/applicationchooser;1" in Cc) {
   166      } else if ("@mozilla.org/applicationchooser;1" in Cc) {
   123 -      var nsIApplicationChooser = Ci.nsIApplicationChooser;
   167 -      var nsIApplicationChooser = Ci.nsIApplicationChooser;
   124 -      var appChooser = Cc["@mozilla.org/applicationchooser;1"].createInstance(
   168 -      var appChooser = Cc["@mozilla.org/applicationchooser;1"].createInstance(
   191 +        return;
   235 +        return;
   192 +      }
   236 +      }
   193      } else {
   237      } else {
   194        var nsIFilePicker = Ci.nsIFilePicker;
   238        var nsIFilePicker = Ci.nsIFilePicker;
   195        var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
   239        var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
       
   240        fp.init(
       
   241          this.mDialog,
       
   242          this.dialogElement("strings").getString("chooseAppFilePickerTitle"),
       
   243          nsIFilePicker.modeOpen
       
   244        );
   196 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   245 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   197 index 185dc1e22a903cec95b212d1713dddf764b9b198..bdb4ed6f9f86583d02dd80278f858d064584f82a 100644
       
   198 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   246 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   199 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   247 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
   200 @@ -16,6 +16,8 @@
   248 @@ -11,16 +11,18 @@
       
   249  #include "prenv.h"
       
   250  #include "nsInterfaceHashtable.h"
       
   251  #include "nsHashtablesFwd.h"
       
   252  #include "nsHashKeys.h"
       
   253  #include "nsNetUtil.h"
   201  #include "nsISupportsPrimitives.h"
   254  #include "nsISupportsPrimitives.h"
   202  #include "nsIGSettingsService.h"
   255  #include "nsIGSettingsService.h"
   203  #include "nsReadableUtils.h"
   256  #include "nsReadableUtils.h"
   204 +#include "nsPrintfCString.h"
   257 +#include "nsPrintfCString.h"
   205 +#include "nsKDEUtils.h"
   258 +#include "nsKDEUtils.h"
   206  
   259  
   207  using namespace mozilla;
   260  using namespace mozilla;
   208  
   261  
   209 @@ -39,6 +41,8 @@ class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   262  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
       
   263   public:
       
   264    NS_DECL_ISUPPORTS
       
   265    NS_DECL_NSISYSTEMPROXYSETTINGS
       
   266  
       
   267 @@ -34,16 +36,18 @@ class nsUnixSystemProxySettings final : 
       
   268    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
       
   269    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection>
       
   270        mSchemeProxySettings;
       
   271    nsresult GetProxyFromGSettings(const nsACString& aScheme,
       
   272                                   const nsACString& aHost, int32_t aPort,
   210                                   nsACString& aResult);
   273                                   nsACString& aResult);
   211    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
   274    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
   212                                         nsACString& aResult);
   275                                         nsACString& aResult);
   213 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost,
   276 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost,
   214 +                           PRInt32 aPort, nsACString& aResult);
   277 +                           PRInt32 aPort, nsACString& aResult);
   215  };
   278  };
   216  
   279  
   217  NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
   280  NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
   218 @@ -397,6 +401,9 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
   281  
       
   282  NS_IMETHODIMP
       
   283  nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
       
   284    // dbus prevents us from being threadsafe, but this routine should not block
       
   285    // anyhow
       
   286 @@ -391,21 +395,46 @@ nsresult nsUnixSystemProxySettings::GetP
       
   287    return NS_OK;
       
   288  }
       
   289  
       
   290  nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
       
   291                                                     const nsACString& aScheme,
   219                                                     const nsACString& aHost,
   292                                                     const nsACString& aHost,
   220                                                     const int32_t aPort,
   293                                                     const int32_t aPort,
   221                                                     nsACString& aResult) {
   294                                                     nsACString& aResult) {
   222 +  if (nsKDEUtils::kdeSupport())
   295 +  if (nsKDEUtils::kdeSupport())
   223 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
   296 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
   224 +
   297 +
   225    if (mProxySettings) {
   298    if (mProxySettings) {
   226      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   299      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   227      if (NS_SUCCEEDED(rv)) return rv;
   300      if (NS_SUCCEEDED(rv)) return rv;
   228 @@ -405,6 +412,28 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
   301    }
       
   302  
   229    return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
   303    return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
   230  }
   304  }
   231  
   305  
   232 +nsresult nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
   306 +nsresult nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
   233 +                                                    const nsACString& aHost,
   307 +                                                    const nsACString& aHost,
   252 +}
   326 +}
   253 +
   327 +
   254  NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
   328  NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
   255    auto result = MakeRefPtr<nsUnixSystemProxySettings>();
   329    auto result = MakeRefPtr<nsUnixSystemProxySettings>();
   256    result->Init();
   330    result->Init();
       
   331    return result.forget().downcast<nsISupports>();
       
   332  }
   257 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
   333 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
   258 index de05e0cc29752855138b4d189ce6a13c2121d715..c89faad7bfca4ab1d60390766b2e7befd9e3831d 100644
       
   259 --- a/toolkit/xre/moz.build
   334 --- a/toolkit/xre/moz.build
   260 +++ b/toolkit/xre/moz.build
   335 +++ b/toolkit/xre/moz.build
   261 @@ -96,7 +96,9 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
   336 @@ -91,17 +91,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "co
       
   337          "../components/printingui",
       
   338      ]
       
   339  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
       
   340      UNIFIED_SOURCES += [
       
   341          "nsNativeAppSupportDefault.cpp",
   262          "UIKitDirProvider.mm",
   342          "UIKitDirProvider.mm",
   263      ]
   343      ]
   264  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
   344  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
   265 +    EXPORTS += ['nsKDEUtils.h']
   345 +    EXPORTS += ['nsKDEUtils.h']
   266      UNIFIED_SOURCES += [
   346      UNIFIED_SOURCES += [
   267 +        "nsKDEUtils.cpp",
   347 +        "nsKDEUtils.cpp",
   268          "nsNativeAppSupportUnix.cpp",
   348          "nsNativeAppSupportUnix.cpp",
   269      ]
   349      ]
   270      CXXFLAGS += CONFIG["MOZ_X11_SM_CFLAGS"]
   350      CXXFLAGS += CONFIG["MOZ_X11_SM_CFLAGS"]
       
   351  else:
       
   352      UNIFIED_SOURCES += [
       
   353          "nsNativeAppSupportDefault.cpp",
       
   354      ]
       
   355  
   271 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
   356 diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
   272 new file mode 100644
   357 new file mode 100644
   273 index 0000000000000000000000000000000000000000..e282de40618e0be06a4247891d9ab1a26cba2126
       
   274 --- /dev/null
   358 --- /dev/null
   275 +++ b/toolkit/xre/nsKDEUtils.cpp
   359 +++ b/toolkit/xre/nsKDEUtils.cpp
   276 @@ -0,0 +1,286 @@
   360 @@ -0,0 +1,286 @@
   277 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
   361 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
   278 +/* This Source Code Form is subject to the terms of the Mozilla Public
   362 +/* This Source Code Form is subject to the terms of the Mozilla Public
   294 +#include <sys/resource.h>
   378 +#include <sys/resource.h>
   295 +#include <unistd.h>
   379 +#include <unistd.h>
   296 +#include <X11/Xlib.h>
   380 +#include <X11/Xlib.h>
   297 +// copied from X11/X.h as a hack since for an unknown
   381 +// copied from X11/X.h as a hack since for an unknown
   298 +// reason it's not picked up from X11/X.h
   382 +// reason it's not picked up from X11/X.h
   299 +#ifndef None
   383 +//#ifndef None
   300 +#  define None 0L /* universal null resource or null atom */
   384 +//#  define None 0L /* universal null resource or null atom */
   301 +#endif
   385 +//#endif
   302 +
   386 +
   303 +// #define DEBUG_KDE
   387 +// #define DEBUG_KDE
   304 +#ifdef DEBUG_KDE
   388 +#ifdef DEBUG_KDE
   305 +#  define KMOZILLAHELPER "kmozillahelper"
   389 +#  define KMOZILLAHELPER "kmozillahelper"
   306 +#else
   390 +#else
   560 +        commandFile);  // done as \E, so it cannot happen in normal data
   644 +        commandFile);  // done as \E, so it cannot happen in normal data
   561 +  fflush(commandFile);
   645 +  fflush(commandFile);
   562 +}
   646 +}
   563 diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h
   647 diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h
   564 new file mode 100644
   648 new file mode 100644
   565 index 0000000000000000000000000000000000000000..7fa6eb8e83b32c8e2c62a0035d253e06e135e3d2
       
   566 --- /dev/null
   649 --- /dev/null
   567 +++ b/toolkit/xre/nsKDEUtils.h
   650 +++ b/toolkit/xre/nsKDEUtils.h
   568 @@ -0,0 +1,53 @@
   651 @@ -0,0 +1,53 @@
   569 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   652 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   570 +/* This Source Code Form is subject to the terms of the Mozilla Public
   653 +/* This Source Code Form is subject to the terms of the Mozilla Public
   618 +  FILE* replyFile;
   701 +  FILE* replyFile;
   619 +};
   702 +};
   620 +
   703 +
   621 +#endif  // nsKDEUtils
   704 +#endif  // nsKDEUtils
   622 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
   705 diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp
   623 index ab77657dd5f378af0955c43ef958a8abea620134..18b4d85560699bbc3c69b82ee91dfb5cbe700e7b 100644
       
   624 --- a/uriloader/exthandler/HandlerServiceParent.cpp
   706 --- a/uriloader/exthandler/HandlerServiceParent.cpp
   625 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
   707 +++ b/uriloader/exthandler/HandlerServiceParent.cpp
   626 @@ -18,7 +18,7 @@
   708 @@ -13,17 +13,17 @@
       
   709  #include "ContentHandlerService.h"
       
   710  #include "nsIExternalProtocolService.h"
       
   711  #include "nsStringEnumerator.h"
       
   712  #include "nsIMutableArray.h"
       
   713  #include "nsCExternalHandlerService.h"
   627  #include "nsComponentManagerUtils.h"
   714  #include "nsComponentManagerUtils.h"
   628  #include "nsServiceManagerUtils.h"
   715  #include "nsServiceManagerUtils.h"
   629  #ifdef MOZ_WIDGET_GTK
   716  #ifdef MOZ_WIDGET_GTK
   630 -#  include "unix/nsGNOMERegistry.h"
   717 -#  include "unix/nsGNOMERegistry.h"
   631 +#  include "unix/nsCommonRegistry.h"
   718 +#  include "unix/nsCommonRegistry.h"
   632  #endif
   719  #endif
   633  
   720  
   634  using mozilla::dom::ContentHandlerService;
   721  using mozilla::dom::ContentHandlerService;
   635 @@ -310,8 +310,8 @@ mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS(
   722  using mozilla::dom::HandlerApp;
       
   723  using mozilla::dom::HandlerInfo;
       
   724  using mozilla::dom::RemoteHandlerApp;
       
   725  
       
   726  namespace {
       
   727 @@ -305,18 +305,18 @@ mozilla::ipc::IPCResult HandlerServicePa
       
   728  mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocolOS(
       
   729      const nsACString& aProtocolScheme, bool* aHandlerExists) {
       
   730    if (aProtocolScheme.Length() > MAX_SCHEME_LENGTH) {
       
   731      *aHandlerExists = false;
       
   732      return IPC_OK();
   636    }
   733    }
   637  #ifdef MOZ_WIDGET_GTK
   734  #ifdef MOZ_WIDGET_GTK
   638    // Check the GNOME registry for a protocol handler
   735    // Check the GNOME registry for a protocol handler
   639 -  *aHandlerExists =
   736 -  *aHandlerExists =
   640 -      nsGNOMERegistry::HandlerExists(PromiseFlatCString(aProtocolScheme).get());
   737 -      nsGNOMERegistry::HandlerExists(PromiseFlatCString(aProtocolScheme).get());
   641 +  *aHandlerExists = nsCommonRegistry::HandlerExists(
   738 +  *aHandlerExists = nsCommonRegistry::HandlerExists(
   642 +      PromiseFlatCString(aProtocolScheme).get());
   739 +      PromiseFlatCString(aProtocolScheme).get());
   643  #else
   740  #else
   644    *aHandlerExists = false;
   741    *aHandlerExists = false;
   645  #endif
   742  #endif
       
   743    return IPC_OK();
       
   744  }
       
   745  
       
   746  /*
       
   747   * Check if a handler exists for the provided protocol. Check the datastore
   646 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
   748 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
   647 index 0fb126a7f3f7a45d53e6fb81aef74147c711cb77..8cc0006f3045e14e83fd51926ac7856eacbe7357 100644
       
   648 --- a/uriloader/exthandler/moz.build
   749 --- a/uriloader/exthandler/moz.build
   649 +++ b/uriloader/exthandler/moz.build
   750 +++ b/uriloader/exthandler/moz.build
   650 @@ -86,7 +86,9 @@ else:
   751 @@ -81,17 +81,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "ui
       
   752  else:
       
   753      # These files can't be built in unified mode because they redefine LOG.
       
   754      SOURCES += [
       
   755          osdir + "/nsOSHelperAppService.cpp",
       
   756      ]
   651  
   757  
   652  if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
   758  if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
   653      UNIFIED_SOURCES += [
   759      UNIFIED_SOURCES += [
   654 +        "unix/nsCommonRegistry.cpp",
   760 +        "unix/nsCommonRegistry.cpp",
   655          "unix/nsGNOMERegistry.cpp",
   761          "unix/nsGNOMERegistry.cpp",
   656 +        "unix/nsKDERegistry.cpp",
   762 +        "unix/nsKDERegistry.cpp",
   657          "unix/nsMIMEInfoUnix.cpp",
   763          "unix/nsMIMEInfoUnix.cpp",
   658      ]
   764      ]
   659  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
   765  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
   660 @@ -134,6 +136,7 @@ LOCAL_INCLUDES += [
   766      UNIFIED_SOURCES += [
       
   767          "android/nsMIMEInfoAndroid.cpp",
       
   768      ]
       
   769  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
       
   770      UNIFIED_SOURCES += [
       
   771 @@ -129,15 +131,16 @@ include("/ipc/chromium/chromium-config.m
       
   772  FINAL_LIBRARY = "xul"
       
   773  
       
   774  LOCAL_INCLUDES += [
       
   775      "/docshell/base",
       
   776      "/dom/base",
   661      "/dom/ipc",
   777      "/dom/ipc",
   662      "/netwerk/base",
   778      "/netwerk/base",
   663      "/netwerk/protocol/http",
   779      "/netwerk/protocol/http",
   664 +    "/toolkit/xre",
   780 +    "/toolkit/xre",
   665  ]
   781  ]
   666  
   782  
   667  if CONFIG["MOZ_ENABLE_DBUS"]:
   783  if CONFIG["MOZ_ENABLE_DBUS"]:
       
   784      CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"]
       
   785  
       
   786  if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
       
   787      CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
   668 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
   788 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
   669 new file mode 100644
   789 new file mode 100644
   670 index 0000000000000000000000000000000000000000..3371a756e2c240bfe5fe31ef0ee9c393368dab60
       
   671 --- /dev/null
   790 --- /dev/null
   672 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
   791 +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp
   673 @@ -0,0 +1,42 @@
   792 @@ -0,0 +1,42 @@
   674 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   793 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   675 +/* This Source Code Form is subject to the terms of the Mozilla Public
   794 +/* This Source Code Form is subject to the terms of the Mozilla Public
   713 +  if (nsKDEUtils::kdeSupport()) return nsKDERegistry::GetFromType(aMIMEType);
   832 +  if (nsKDEUtils::kdeSupport()) return nsKDERegistry::GetFromType(aMIMEType);
   714 +  return nsGNOMERegistry::GetFromType(aMIMEType);
   833 +  return nsGNOMERegistry::GetFromType(aMIMEType);
   715 +}
   834 +}
   716 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h
   835 diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h
   717 new file mode 100644
   836 new file mode 100644
   718 index 0000000000000000000000000000000000000000..075413e2fbb165862956c7753a750bfdfb5d389b
       
   719 --- /dev/null
   837 --- /dev/null
   720 +++ b/uriloader/exthandler/unix/nsCommonRegistry.h
   838 +++ b/uriloader/exthandler/unix/nsCommonRegistry.h
   721 @@ -0,0 +1,28 @@
   839 @@ -0,0 +1,28 @@
   722 +/* This Source Code Form is subject to the terms of the Mozilla Public
   840 +/* This Source Code Form is subject to the terms of the Mozilla Public
   723 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   841 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   747 +};
   865 +};
   748 +
   866 +
   749 +#endif
   867 +#endif
   750 diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp
   868 diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp
   751 new file mode 100644
   869 new file mode 100644
   752 index 0000000000000000000000000000000000000000..082035566f0b82c14f866c2fbed34c0884f27d34
       
   753 --- /dev/null
   870 --- /dev/null
   754 +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
   871 +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
   755 @@ -0,0 +1,75 @@
   872 @@ -0,0 +1,75 @@
   756 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   873 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
   757 +/* This Source Code Form is subject to the terms of the Mozilla Public
   874 +/* This Source Code Form is subject to the terms of the Mozilla Public
   828 +  }
   945 +  }
   829 +  return nullptr;
   946 +  return nullptr;
   830 +}
   947 +}
   831 diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h
   948 diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h
   832 new file mode 100644
   949 new file mode 100644
   833 index 0000000000000000000000000000000000000000..c6a41b331b2b5ead6142171f08d8b8a7872ca516
       
   834 --- /dev/null
   950 --- /dev/null
   835 +++ b/uriloader/exthandler/unix/nsKDERegistry.h
   951 +++ b/uriloader/exthandler/unix/nsKDERegistry.h
   836 @@ -0,0 +1,35 @@
   952 @@ -0,0 +1,35 @@
   837 +/* This Source Code Form is subject to the terms of the Mozilla Public
   953 +/* This Source Code Form is subject to the terms of the Mozilla Public
   838 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   954 + * License, v. 2.0. If a copy of the MPL was not distributed with this
   868 +      const nsTArray<nsCString>& command);
   984 +      const nsTArray<nsCString>& command);
   869 +};
   985 +};
   870 +
   986 +
   871 +#endif  // nsKDERegistry_h__
   987 +#endif  // nsKDERegistry_h__
   872 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
   988 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
   873 index 330c4411597f1a19105601e256a2c3bc71c61780..c96c1f3ca5a05c3b6bce321d7a975aa040865fa8 100644
       
   874 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
   989 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
   875 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
   990 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
   876 @@ -5,16 +5,19 @@
   991 @@ -1,48 +1,51 @@
       
   992  /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       
   993   *
       
   994   * This Source Code Form is subject to the terms of the Mozilla Public
       
   995   * License, v. 2.0. If a copy of the MPL was not distributed with this
   877   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
   996   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
   878  
   997  
   879  #include "nsMIMEInfoUnix.h"
   998  #include "nsMIMEInfoUnix.h"
   880 -#include "nsGNOMERegistry.h"
   999 -#include "nsGNOMERegistry.h"
   881 +#include "nsCommonRegistry.h"
  1000 +#include "nsCommonRegistry.h"
   893 -  return nsGNOMERegistry::LoadURL(aURI);
  1012 -  return nsGNOMERegistry::LoadURL(aURI);
   894 +  return nsCommonRegistry::LoadURL(aURI);
  1013 +  return nsCommonRegistry::LoadURL(aURI);
   895  }
  1014  }
   896  
  1015  
   897  NS_IMETHODIMP
  1016  NS_IMETHODIMP
   898 @@ -29,15 +32,15 @@ nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) {
  1017  nsMIMEInfoUnix::GetHasDefaultHandler(bool* _retval) {
       
  1018    // if a default app is set, it means the application has been set from
       
  1019    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
       
  1020    // give the GNOME answer.
       
  1021    if (GetDefaultApplication()) {
       
  1022      return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
       
  1023    }
       
  1024  
   899    *_retval = false;
  1025    *_retval = false;
   900  
  1026  
   901    if (mClass == eProtocolInfo) {
  1027    if (mClass == eProtocolInfo) {
   902 -    *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get());
  1028 -    *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get());
   903 +    *_retval = nsCommonRegistry::HandlerExists(mSchemeOrType.get());
  1029 +    *_retval = nsCommonRegistry::HandlerExists(mSchemeOrType.get());
   912 -        mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  1038 -        mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
   913 +        mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  1039 +        mimeInfo = nsCommonRegistry::GetFromExtension(ext);
   914        }
  1040        }
   915      }
  1041      }
   916      if (mimeInfo) *_retval = true;
  1042      if (mimeInfo) *_retval = true;
   917 @@ -59,6 +62,21 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile* aFile) {
  1043    }
       
  1044  
       
  1045    if (*_retval) return NS_OK;
       
  1046  
       
  1047    return NS_OK;
       
  1048 @@ -54,16 +57,31 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWi
       
  1049    // give the GNOME answer.
       
  1050    if (GetDefaultApplication()) {
       
  1051      return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
       
  1052    }
       
  1053  
   918    nsAutoCString nativePath;
  1054    nsAutoCString nativePath;
   919    aFile->GetNativePath(nativePath);
  1055    aFile->GetNativePath(nativePath);
   920  
  1056  
   921 +  if (nsKDEUtils::kdeSupport()) {
  1057 +  if (nsKDEUtils::kdeSupport()) {
   922 +    bool supports;
  1058 +    bool supports;
   934 +  }
  1070 +  }
   935 +
  1071 +
   936    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1072    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
   937    if (!giovfs) {
  1073    if (!giovfs) {
   938      return NS_ERROR_FAILURE;
  1074      return NS_ERROR_FAILURE;
       
  1075    }
       
  1076  
       
  1077    // nsGIOMimeApp->Launch wants a URI string instead of local file
       
  1078    nsresult rv;
       
  1079    nsCOMPtr<nsIIOService> ioservice =
   939 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1080 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
   940 index 7f6eaa46f2ee0d5155b83bfb07d8040584935772..f7627e790c47e1ae007b072b4bb47b18de1ae417 100644
       
   941 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1081 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
   942 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1082 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
   943 @@ -10,7 +10,7 @@
  1083 @@ -5,17 +5,17 @@
       
  1084   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       
  1085  
       
  1086  #include <sys/types.h>
       
  1087  #include <sys/stat.h>
       
  1088  
   944  #include "nsOSHelperAppService.h"
  1089  #include "nsOSHelperAppService.h"
   945  #include "nsMIMEInfoUnix.h"
  1090  #include "nsMIMEInfoUnix.h"
   946  #ifdef MOZ_WIDGET_GTK
  1091  #ifdef MOZ_WIDGET_GTK
   947 -#  include "nsGNOMERegistry.h"
  1092 -#  include "nsGNOMERegistry.h"
   948 +#  include "nsCommonRegistry.h"
  1093 +#  include "nsCommonRegistry.h"
   949  #  ifdef MOZ_BUILD_APP_IS_BROWSER
  1094  #  ifdef MOZ_BUILD_APP_IS_BROWSER
   950  #    include "nsIToolkitShellService.h"
  1095  #    include "nsIToolkitShellService.h"
   951  #    include "nsIGNOMEShellService.h"
  1096  #    include "nsIGNOMEShellService.h"
   952 @@ -1106,7 +1106,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(
  1097  #  endif
       
  1098  #endif
       
  1099  #include "nsISupports.h"
       
  1100  #include "nsString.h"
       
  1101  #include "nsReadableUtils.h"
       
  1102 @@ -1101,17 +1101,17 @@ nsresult nsOSHelperAppService::GetHandle
       
  1103  
       
  1104  nsresult nsOSHelperAppService::OSProtocolHandlerExists(
       
  1105      const char* aProtocolScheme, bool* aHandlerExists) {
       
  1106    nsresult rv = NS_OK;
       
  1107  
   953    if (!XRE_IsContentProcess()) {
  1108    if (!XRE_IsContentProcess()) {
   954  #ifdef MOZ_WIDGET_GTK
  1109  #ifdef MOZ_WIDGET_GTK
   955      // Check the GNOME registry for a protocol handler
  1110      // Check the GNOME registry for a protocol handler
   956 -    *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
  1111 -    *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
   957 +    *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
  1112 +    *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme);
   958  #else
  1113  #else
   959      *aHandlerExists = false;
  1114      *aHandlerExists = false;
   960  #endif
  1115  #endif
   961 @@ -1126,7 +1126,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(
  1116    } else {
       
  1117      *aHandlerExists = false;
       
  1118      nsCOMPtr<nsIHandlerService> handlerSvc =
       
  1119          do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv);
       
  1120      if (NS_SUCCEEDED(rv) && handlerSvc) {
       
  1121 @@ -1121,17 +1121,17 @@ nsresult nsOSHelperAppService::OSProtoco
       
  1122    }
       
  1123  
       
  1124    return rv;
       
  1125  }
       
  1126  
   962  NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(
  1127  NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(
   963      const nsACString& aScheme, nsAString& _retval) {
  1128      const nsACString& aScheme, nsAString& _retval) {
   964  #ifdef MOZ_WIDGET_GTK
  1129  #ifdef MOZ_WIDGET_GTK
   965 -  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
  1130 -  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
   966 +  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
  1131 +  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
   967    return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
  1132    return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
   968  #else
  1133  #else
   969    return NS_ERROR_NOT_AVAILABLE;
  1134    return NS_ERROR_NOT_AVAILABLE;
   970 @@ -1231,7 +1231,7 @@ already_AddRefed<nsMIMEInfoBase> nsOSHelperAppService::GetFromExtension(
  1135  #endif
       
  1136  }
       
  1137  
       
  1138  NS_IMETHODIMP nsOSHelperAppService::IsCurrentAppOSDefaultForProtocol(
       
  1139      const nsACString& aScheme, bool* _retval) {
       
  1140 @@ -1226,17 +1226,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
       
  1141    nsresult rv =
       
  1142        LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
       
  1143                                 minorType, mime_types_description, true);
       
  1144  
       
  1145    if (NS_FAILED(rv) || majorType.IsEmpty()) {
   971  #ifdef MOZ_WIDGET_GTK
  1146  #ifdef MOZ_WIDGET_GTK
   972      LOG("Looking in GNOME registry\n");
  1147      LOG("Looking in GNOME registry\n");
   973      RefPtr<nsMIMEInfoBase> gnomeInfo =
  1148      RefPtr<nsMIMEInfoBase> gnomeInfo =
   974 -        nsGNOMERegistry::GetFromExtension(aFileExt);
  1149 -        nsGNOMERegistry::GetFromExtension(aFileExt);
   975 +        nsCommonRegistry::GetFromExtension(aFileExt);
  1150 +        nsCommonRegistry::GetFromExtension(aFileExt);
   976      if (gnomeInfo) {
  1151      if (gnomeInfo) {
   977        LOG("Got MIMEInfo from GNOME registry\n");
  1152        LOG("Got MIMEInfo from GNOME registry\n");
   978        return gnomeInfo.forget();
  1153        return gnomeInfo.forget();
   979 @@ -1344,7 +1344,7 @@ already_AddRefed<nsMIMEInfoBase> nsOSHelperAppService::GetFromType(
  1154      }
       
  1155  #endif
       
  1156  
       
  1157      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
       
  1158                                    minorType, mime_types_description, false);
       
  1159 @@ -1339,17 +1339,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
       
  1160  
       
  1161    // Now look up our extensions
       
  1162    nsAutoString extensions, mime_types_description;
       
  1163    LookUpExtensionsAndDescription(majorType, minorType, extensions,
       
  1164                                   mime_types_description);
   980  
  1165  
   981  #ifdef MOZ_WIDGET_GTK
  1166  #ifdef MOZ_WIDGET_GTK
   982    if (handler.IsEmpty()) {
  1167    if (handler.IsEmpty()) {
   983 -    RefPtr<nsMIMEInfoBase> gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
  1168 -    RefPtr<nsMIMEInfoBase> gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
   984 +    RefPtr<nsMIMEInfoBase> gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType);
  1169 +    RefPtr<nsMIMEInfoBase> gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType);
   985      if (gnomeInfo) {
  1170      if (gnomeInfo) {
   986        LOG("Got MIMEInfo from GNOME registry without extensions; setting them "
  1171        LOG("Got MIMEInfo from GNOME registry without extensions; setting them "
   987            "to %s\n",
  1172            "to %s\n",
       
  1173            NS_LossyConvertUTF16toASCII(extensions).get());
       
  1174  
       
  1175        NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
       
  1176        gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
       
  1177        return gnomeInfo.forget();
   988 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
  1178 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
   989 index c6a765df9e5a4c95f77e9ee1b4ebbf9913a81e15..6e9028169ac594a24f90a4f58dc493c8332c6bf8 100644
       
   990 --- a/widget/gtk/moz.build
  1179 --- a/widget/gtk/moz.build
   991 +++ b/widget/gtk/moz.build
  1180 +++ b/widget/gtk/moz.build
   992 @@ -161,6 +161,7 @@ LOCAL_INCLUDES += [
  1181 @@ -146,16 +146,17 @@ FINAL_LIBRARY = "xul"
       
  1182  
       
  1183  LOCAL_INCLUDES += [
       
  1184      "/layout/base",
       
  1185      "/layout/forms",
       
  1186      "/layout/generic",
   993      "/layout/xul",
  1187      "/layout/xul",
   994      "/other-licenses/atk-1.0",
  1188      "/other-licenses/atk-1.0",
   995      "/third_party/cups/include",
  1189      "/third_party/cups/include",
   996 +    "/toolkit/xre",
  1190 +    "/toolkit/xre",
   997      "/widget",
  1191      "/widget",
   998      "/widget/headless",
  1192      "/widget/headless",
   999      "/widget/x11",
  1193      "/widget/x11",
       
  1194  ]
       
  1195  
       
  1196  DEFINES["CAIRO_GFX"] = True
       
  1197  
       
  1198  DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"]
  1000 diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
  1199 diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
  1001 index 22d0f46b9563734c7afb4292417124f3cd171a12..b2a68711eb344d5ac41a7133751b2c19d574f532 100644
       
  1002 --- a/widget/gtk/nsFilePicker.cpp
  1200 --- a/widget/gtk/nsFilePicker.cpp
  1003 +++ b/widget/gtk/nsFilePicker.cpp
  1201 +++ b/widget/gtk/nsFilePicker.cpp
  1004 @@ -5,6 +5,7 @@
  1202 @@ -1,15 +1,16 @@
       
  1203  /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       
  1204  /* This Source Code Form is subject to the terms of the Mozilla Public
       
  1205   * License, v. 2.0. If a copy of the MPL was not distributed with this
       
  1206   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1005  
  1207  
  1006  #include <dlfcn.h>
  1208  #include <dlfcn.h>
  1007  #include <gtk/gtk.h>
  1209  #include <gtk/gtk.h>
  1008 +#include <gdk/gdkx.h>
  1210 +#include <gdk/gdkx.h>
  1009  #include <sys/types.h>
  1211  #include <sys/types.h>
  1010  #include <sys/stat.h>
  1212  #include <sys/stat.h>
  1011  #include <unistd.h>
  1213  #include <unistd.h>
  1012 @@ -28,6 +29,8 @@
  1214  
       
  1215  #include "mozilla/Types.h"
       
  1216  #include "AsyncDBus.h"
       
  1217  #include "nsGtkUtils.h"
       
  1218  #include "nsIFileURL.h"
       
  1219 @@ -25,16 +26,18 @@
       
  1220  #include "nsArrayEnumerator.h"
       
  1221  #include "nsEnumeratorUtils.h"
       
  1222  #include "nsNetUtil.h"
       
  1223  #include "nsReadableUtils.h"
       
  1224  #include "MozContainer.h"
  1013  #include "WidgetUtilsGtk.h"
  1225  #include "WidgetUtilsGtk.h"
  1014  
  1226  
  1015  #include "nsFilePicker.h"
  1227  #include "nsFilePicker.h"
  1016 +#include "nsKDEUtils.h"
  1228 +#include "nsKDEUtils.h"
  1017 +#include "nsURLHelper.h"
  1229 +#include "nsURLHelper.h"
  1018  
  1230  
  1019  #undef LOG
  1231  #undef LOG
  1020  #ifdef MOZ_LOGGING
  1232  #ifdef MOZ_LOGGING
  1021 @@ -242,7 +245,8 @@ NS_IMETHODIMP
  1233  #  include "mozilla/Logging.h"
       
  1234  #  include "nsTArray.h"
       
  1235  #  include "Units.h"
       
  1236  extern mozilla::LazyLogModule gWidgetLog;
       
  1237  #  define LOG(args) MOZ_LOG(gWidgetLog, mozilla::LogLevel::Debug, args)
       
  1238 @@ -305,17 +308,18 @@ nsFilePicker::AppendFilters(int32_t aFil
       
  1239    mAllowURLs = !!(aFilterMask & filterAllowURLs);
       
  1240    return nsBaseFilePicker::AppendFilters(aFilterMask);
       
  1241  }
       
  1242  
       
  1243  NS_IMETHODIMP
  1022  nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) {
  1244  nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) {
  1023    if (aFilter.EqualsLiteral("..apps")) {
  1245    if (aFilter.EqualsLiteral("..apps")) {
  1024      // No platform specific thing we can do here, really....
  1246      // No platform specific thing we can do here, really....
  1025 -    return NS_OK;
  1247 -    return NS_OK;
  1026 +    // Unless it's KDE.
  1248 +    // Unless it's KDE.
  1027 +    if (mMode != modeOpen || !nsKDEUtils::kdeSupport()) return NS_OK;
  1249 +    if (mMode != modeOpen || !nsKDEUtils::kdeSupport()) return NS_OK;
  1028    }
  1250    }
  1029  
  1251  
  1030    nsAutoCString filter, name;
  1252    nsAutoCString filter, name;
  1031 @@ -352,6 +356,31 @@ nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
  1253    CopyUTF16toUTF8(aFilter, filter);
       
  1254    CopyUTF16toUTF8(aTitle, name);
       
  1255  
       
  1256    mFilters.AppendElement(filter);
       
  1257    mFilterNames.AppendElement(name);
       
  1258 @@ -415,16 +419,41 @@ nsresult nsFilePicker::Show(nsIFilePicke
       
  1259    return NS_OK;
       
  1260  }
       
  1261  
       
  1262  NS_IMETHODIMP
       
  1263  nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
  1032    // Can't show two dialogs concurrently with the same filepicker
  1264    // Can't show two dialogs concurrently with the same filepicker
  1033    if (mRunning) return NS_ERROR_NOT_AVAILABLE;
  1265    if (mRunning) return NS_ERROR_NOT_AVAILABLE;
  1034  
  1266  
  1035 +  // KDE file picker is not handled via callback
  1267 +  // KDE file picker is not handled via callback
  1036 +  if (nsKDEUtils::kdeSupport()) {
  1268 +  if (nsKDEUtils::kdeSupport()) {
  1058 +  }
  1290 +  }
  1059 +
  1291 +
  1060    NS_ConvertUTF16toUTF8 title(mTitle);
  1292    NS_ConvertUTF16toUTF8 title(mTitle);
  1061  
  1293  
  1062    GtkWindow* parent_widget =
  1294    GtkWindow* parent_widget =
  1063 @@ -633,6 +662,205 @@ void nsFilePicker::Done(void* file_chooser, gint response) {
  1295        GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
       
  1296  
       
  1297    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
       
  1298  
       
  1299    const gchar* accept_button;
       
  1300 @@ -696,16 +725,215 @@ void nsFilePicker::Done(void* file_choos
       
  1301      mCallback->Done(result);
       
  1302      mCallback = nullptr;
       
  1303    } else {
       
  1304      mResult = result;
       
  1305    }
  1064    NS_RELEASE_THIS();
  1306    NS_RELEASE_THIS();
  1065  }
  1307  }
  1066  
  1308  
  1067 +nsCString nsFilePicker::kdeMakeFilter(int index) {
  1309 +nsCString nsFilePicker::kdeMakeFilter(int index) {
  1068 +  nsCString buf = mFilters[index];
  1310 +  nsCString buf = mFilters[index];
  1264 +}
  1506 +}
  1265 +
  1507 +
  1266  // All below functions available as of GTK 3.20+
  1508  // All below functions available as of GTK 3.20+
  1267  void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent,
  1509  void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent,
  1268                                        GtkFileChooserAction action,
  1510                                        GtkFileChooserAction action,
       
  1511                                        const gchar* accept_label) {
       
  1512    static auto sGtkFileChooserNativeNewPtr =
       
  1513        (void* (*)(const gchar*, GtkWindow*, GtkFileChooserAction, const gchar*,
       
  1514                   const gchar*))dlsym(RTLD_DEFAULT,
       
  1515                                       "gtk_file_chooser_native_new");
  1269 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  1516 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  1270 index 496df4937277d96485376176296ee836aa261ec7..a4c1862ec042f4465d53bc95f138afb87260ba07 100644
       
  1271 --- a/widget/gtk/nsFilePicker.h
  1517 --- a/widget/gtk/nsFilePicker.h
  1272 +++ b/widget/gtk/nsFilePicker.h
  1518 +++ b/widget/gtk/nsFilePicker.h
  1273 @@ -74,6 +74,12 @@ class nsFilePicker : public nsBaseFilePicker {
  1519 @@ -71,16 +71,22 @@ class nsFilePicker : public nsBaseFilePi
       
  1520    nsString mDefaultExtension;
       
  1521  
       
  1522    nsTArray<nsCString> mFilters;
       
  1523    nsTArray<nsCString> mFilterNames;
       
  1524  
  1274   private:
  1525   private:
  1275    static nsIFile* mPrevDisplayDirectory;
  1526    static nsIFile* mPrevDisplayDirectory;
  1276  
  1527  
  1277 +  bool kdeRunning();
  1528 +  bool kdeRunning();
  1278 +  bool getKdeRunning();
  1529 +  bool getKdeRunning();
  1281 +  nsCString kdeMakeFilter(int index);
  1532 +  nsCString kdeMakeFilter(int index);
  1282 +
  1533 +
  1283    void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
  1534    void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
  1284                            GtkFileChooserAction action,
  1535                            GtkFileChooserAction action,
  1285                            const gchar* accept_label);
  1536                            const gchar* accept_label);
       
  1537    void GtkFileChooserShow(void* file_chooser);
       
  1538    void GtkFileChooserDestroy(void* file_chooser);
       
  1539    void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget,
       
  1540                                gboolean modal);
       
  1541  
  1286 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  1542 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  1287 index 88ee06d78db60a84343fd3d23c16e163aead37c3..834d6a2d353cc1bd11916de8a28f5d05a86d9031 100644
       
  1288 --- a/xpcom/components/ManifestParser.cpp
  1543 --- a/xpcom/components/ManifestParser.cpp
  1289 +++ b/xpcom/components/ManifestParser.cpp
  1544 +++ b/xpcom/components/ManifestParser.cpp
  1290 @@ -43,6 +43,7 @@
  1545 @@ -38,16 +38,17 @@
       
  1546  #include "nsTextFormatter.h"
       
  1547  #include "nsVersionComparator.h"
       
  1548  #include "nsXPCOMCIDInternal.h"
       
  1549  
       
  1550  #include "nsIConsoleService.h"
  1291  #include "nsIScriptError.h"
  1551  #include "nsIScriptError.h"
  1292  #include "nsIXULAppInfo.h"
  1552  #include "nsIXULAppInfo.h"
  1293  #include "nsIXULRuntime.h"
  1553  #include "nsIXULRuntime.h"
  1294 +#include "nsKDEUtils.h"
  1554 +#include "nsKDEUtils.h"
  1295  
  1555  
  1296  using namespace mozilla;
  1556  using namespace mozilla;
  1297  
  1557  
  1298 @@ -394,6 +395,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1558  struct ManifestDirective {
       
  1559    const char* directive;
       
  1560    int argc;
       
  1561  
       
  1562    bool ischrome;
       
  1563 @@ -389,16 +390,17 @@ void ParseManifest(NSLocationType aType,
       
  1564    constexpr auto kRemoteEnabled = u"remoteenabled"_ns;
       
  1565    constexpr auto kRemoteRequired = u"remoterequired"_ns;
       
  1566    constexpr auto kApplication = u"application"_ns;
       
  1567    constexpr auto kAppVersion = u"appversion"_ns;
       
  1568    constexpr auto kGeckoVersion = u"platformversion"_ns;
  1299    constexpr auto kOs = u"os"_ns;
  1569    constexpr auto kOs = u"os"_ns;
  1300    constexpr auto kOsVersion = u"osversion"_ns;
  1570    constexpr auto kOsVersion = u"osversion"_ns;
  1301    constexpr auto kABI = u"abi"_ns;
  1571    constexpr auto kABI = u"abi"_ns;
  1302 +  constexpr auto kDesktop = u"desktop"_ns;
  1572 +  constexpr auto kDesktop = u"desktop"_ns;
  1303    constexpr auto kProcess = u"process"_ns;
  1573    constexpr auto kProcess = u"process"_ns;
  1304  #if defined(MOZ_WIDGET_ANDROID)
  1574  #if defined(MOZ_WIDGET_ANDROID)
  1305    constexpr auto kTablet = u"tablet"_ns;
  1575    constexpr auto kTablet = u"tablet"_ns;
  1306 @@ -453,6 +455,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1576  #endif
       
  1577    // You might expect this to be guarded by MOZ_BACKGROUNDTASKS, but it's not
       
  1578    // possible to have conditional manifest contents, so we need to recognize and
       
  1579    // discard these tokens even when MOZ_BACKGROUNDTASKS is not set.
       
  1580    constexpr auto kBackgroundTask = u"backgroundtask"_ns;
       
  1581 @@ -448,39 +450,44 @@ void ParseManifest(NSLocationType aType,
       
  1582          CopyUTF8toUTF16(s, abi);
       
  1583          abi.Insert(char16_t('_'), 0);
       
  1584          abi.Insert(osTarget, 0);
       
  1585        }
       
  1586      }
  1307    }
  1587    }
  1308  
  1588  
  1309    nsAutoString osVersion;
  1589    nsAutoString osVersion;
  1310 +  nsAutoString desktop;
  1590 +  nsAutoString desktop;
  1311  #if defined(XP_WIN)
  1591  #if defined(XP_WIN)
  1312  #  pragma warning(push)
  1592  #  pragma warning(push)
  1313  #  pragma warning(disable : 4996)  // VC12+ deprecates GetVersionEx
  1593  #  pragma warning(disable : 4996)  // VC12+ deprecates GetVersionEx
  1314 @@ -461,14 +464,17 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1594    OSVERSIONINFO info = {sizeof(OSVERSIONINFO)};
       
  1595    if (GetVersionEx(&info)) {
  1315      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion,
  1596      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion,
  1316                                info.dwMinorVersion);
  1597                                info.dwMinorVersion);
  1317    }
  1598    }
  1318 +  desktop = u"win"_ns;
  1599 +  desktop = u"win"_ns;
  1319  #  pragma warning(pop)
  1600  #  pragma warning(pop)
  1327                              gtk_minor_version);
  1608                              gtk_minor_version);
  1328 +  desktop = nsKDEUtils::kdeSession() ? u"kde"_ns : u"gnome"_ns;
  1609 +  desktop = nsKDEUtils::kdeSession() ? u"kde"_ns : u"gnome"_ns;
  1329  #elif defined(MOZ_WIDGET_ANDROID)
  1610  #elif defined(MOZ_WIDGET_ANDROID)
  1330    bool isTablet = false;
  1611    bool isTablet = false;
  1331    if (jni::IsAvailable()) {
  1612    if (jni::IsAvailable()) {
  1332 @@ -476,6 +482,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1613      jni::String::LocalRef release = java::sdk::Build::VERSION::RELEASE();
  1333      osVersion.Assign(release->ToString());
  1614      osVersion.Assign(release->ToString());
  1334      isTablet = java::GeckoAppShell::IsTablet();
  1615      isTablet = java::GeckoAppShell::IsTablet();
  1335    }
  1616    }
  1336 +  desktop = u"android"_ns;
  1617 +  desktop = u"android"_ns;
  1337  #endif
  1618  #endif
  1338  
  1619  
  1339    if (XRE_IsContentProcess()) {
  1620    if (XRE_IsContentProcess()) {
  1340 @@ -576,6 +583,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1621      process = kContent;
       
  1622    } else {
       
  1623      process = kMain;
       
  1624    }
       
  1625  
       
  1626 @@ -571,25 +578,27 @@ void ParseManifest(NSLocationType aType,
       
  1627      // When in background task mode, default to not registering
       
  1628      // category directivies unless backgroundtask=1 is specified.
       
  1629      TriState stBackgroundTask = (BackgroundTasks::IsBackgroundTaskMode() &&
       
  1630                                   strcmp("category", directive->directive) == 0)
       
  1631                                      ? eBad
  1341                                      : eUnspecified;
  1632                                      : eUnspecified;
  1342  #endif
  1633  #endif
  1343      int flags = 0;
  1634      int flags = 0;
  1344 +    TriState stDesktop = eUnspecified;
  1635 +    TriState stDesktop = eUnspecified;
  1345  
  1636  
  1346      while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
  1637      while ((token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) &&
  1347             ok) {
  1638             ok) {
  1348 @@ -585,6 +593,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1639        ToLowerCase(token);
       
  1640        NS_ConvertASCIItoUTF16 wtoken(token);
       
  1641  
  1349        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
  1642        if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
  1350            CheckOsFlag(kOs, wtoken, osTarget, stOs) ||
  1643            CheckOsFlag(kOs, wtoken, osTarget, stOs) ||
  1351            CheckStringFlag(kABI, wtoken, abi, stABI) ||
  1644            CheckStringFlag(kABI, wtoken, abi, stABI) ||
  1352 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
  1645 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
  1353            CheckStringFlag(kProcess, wtoken, process, stProcess) ||
  1646            CheckStringFlag(kProcess, wtoken, process, stProcess) ||
  1354            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
  1647            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
  1355            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
  1648            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
  1356 @@ -644,6 +653,7 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
  1649            CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion,
       
  1650                             stGeckoVersion)) {
       
  1651          continue;
       
  1652        }
       
  1653  
       
  1654 @@ -639,16 +648,17 @@ void ParseManifest(NSLocationType aType,
       
  1655  
       
  1656        LogMessageWithContext(
       
  1657            aFile, line, "Unrecognized chrome manifest modifier '%s'.", token);
       
  1658        ok = false;
       
  1659      }
  1357  
  1660  
  1358      if (!ok || stApp == eBad || stAppVersion == eBad ||
  1661      if (!ok || stApp == eBad || stAppVersion == eBad ||
  1359          stGeckoVersion == eBad || stOs == eBad || stOsVersion == eBad ||
  1662          stGeckoVersion == eBad || stOs == eBad || stOsVersion == eBad ||
  1360 +        stDesktop == eBad ||
  1663 +        stDesktop == eBad ||
  1361  #ifdef MOZ_WIDGET_ANDROID
  1664  #ifdef MOZ_WIDGET_ANDROID
  1362          stTablet == eBad ||
  1665          stTablet == eBad ||
  1363  #endif
  1666  #endif
       
  1667  #ifdef MOZ_BACKGROUNDTASKS
       
  1668          stBackgroundTask == eBad ||
       
  1669  #endif
       
  1670          stABI == eBad || stProcess == eBad) {
       
  1671        continue;
  1364 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  1672 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  1365 index 95ee64e985ac34dd6a3191f1948afa6d05adcb73..9af8f80497b7390b7ca434b6ee3b86b2baf47489 100644
       
  1366 --- a/xpcom/components/moz.build
  1673 --- a/xpcom/components/moz.build
  1367 +++ b/xpcom/components/moz.build
  1674 +++ b/xpcom/components/moz.build
  1368 @@ -71,6 +71,7 @@ LOCAL_INCLUDES += [
  1675 @@ -66,16 +66,17 @@ LOCAL_INCLUDES += [
       
  1676      "!..",
       
  1677      "../base",
       
  1678      "../build",
       
  1679      "../ds",
       
  1680      "/chrome",
  1369      "/js/xpconnect/loader",
  1681      "/js/xpconnect/loader",
  1370      "/layout/build",
  1682      "/layout/build",
  1371      "/modules/libjar",
  1683      "/modules/libjar",
  1372 +    "/toolkit/xre",
  1684 +    "/toolkit/xre",
  1373  ]
  1685  ]
  1374  
  1686  
  1375  if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
  1687  if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
       
  1688      CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
       
  1689  
       
  1690  include("/ipc/chromium/chromium-config.mozbuild")
       
  1691  
       
  1692  PYTHON_UNITTEST_MANIFESTS += [
  1376 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  1693 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
  1377 index 08c77360de6fdbf3dc579ea49243dbdc18f37ebc..eedd5bcf86bde3ecd795bbbcbf94799f19135323 100644
       
  1378 --- a/xpcom/io/nsLocalFileUnix.cpp
  1694 --- a/xpcom/io/nsLocalFileUnix.cpp
  1379 +++ b/xpcom/io/nsLocalFileUnix.cpp
  1695 +++ b/xpcom/io/nsLocalFileUnix.cpp
  1380 @@ -51,6 +51,7 @@
  1696 @@ -46,16 +46,17 @@
       
  1697  #include "nsString.h"
       
  1698  #include "nsIDirectoryEnumerator.h"
       
  1699  #include "nsSimpleEnumerator.h"
       
  1700  #include "private/pprio.h"
       
  1701  #include "prlink.h"
  1381  
  1702  
  1382  #ifdef MOZ_WIDGET_GTK
  1703  #ifdef MOZ_WIDGET_GTK
  1383  #  include "nsIGIOService.h"
  1704  #  include "nsIGIOService.h"
  1384 +#  include "nsKDEUtils.h"
  1705 +#  include "nsKDEUtils.h"
  1385  #endif
  1706  #endif
  1386  
  1707  
  1387  #ifdef MOZ_WIDGET_COCOA
  1708  #ifdef MOZ_WIDGET_COCOA
  1388 @@ -2172,10 +2173,18 @@ nsLocalFile::Reveal() {
  1709  #  include <Carbon/Carbon.h>
       
  1710  #  include "CocoaFileUtils.h"
       
  1711  #  include "prmem.h"
       
  1712  #  include "plbase64.h"
       
  1713  
       
  1714 @@ -2205,20 +2206,28 @@ nsLocalFile::SetPersistentDescriptor(con
       
  1715  
       
  1716  NS_IMETHODIMP
       
  1717  nsLocalFile::Reveal() {
       
  1718    if (!FilePreferences::IsAllowedPath(mPath)) {
       
  1719      return NS_ERROR_FILE_ACCESS_DENIED;
  1389    }
  1720    }
  1390  
  1721  
  1391  #ifdef MOZ_WIDGET_GTK
  1722  #ifdef MOZ_WIDGET_GTK
  1392 +  nsAutoCString url;
  1723 +  nsAutoCString url;
  1393    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1724    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1404 +  if (!giovfs) return NS_ERROR_FAILURE;
  1735 +  if (!giovfs) return NS_ERROR_FAILURE;
  1405 +
  1736 +
  1406    return giovfs->RevealFile(this);
  1737    return giovfs->RevealFile(this);
  1407  #elif defined(MOZ_WIDGET_COCOA)
  1738  #elif defined(MOZ_WIDGET_COCOA)
  1408    CFURLRef url;
  1739    CFURLRef url;
  1409 @@ -2197,6 +2206,13 @@ nsLocalFile::Launch() {
  1740    if (NS_SUCCEEDED(GetCFURL(&url))) {
       
  1741      nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
       
  1742      ::CFRelease(url);
       
  1743      return rv;
       
  1744    }
       
  1745 @@ -2230,16 +2239,23 @@ nsLocalFile::Reveal() {
       
  1746  
       
  1747  NS_IMETHODIMP
       
  1748  nsLocalFile::Launch() {
       
  1749    if (!FilePreferences::IsAllowedPath(mPath)) {
       
  1750      return NS_ERROR_FILE_ACCESS_DENIED;
  1410    }
  1751    }
  1411  
  1752  
  1412  #ifdef MOZ_WIDGET_GTK
  1753  #ifdef MOZ_WIDGET_GTK
  1413 +  if (nsKDEUtils::kdeSupport()) {
  1754 +  if (nsKDEUtils::kdeSupport()) {
  1414 +    nsTArray<nsCString> command;
  1755 +    nsTArray<nsCString> command;
  1418 +  }
  1759 +  }
  1419 +
  1760 +
  1420    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1761    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
  1421    if (!giovfs) {
  1762    if (!giovfs) {
  1422      return NS_ERROR_FAILURE;
  1763      return NS_ERROR_FAILURE;
       
  1764    }
       
  1765  
       
  1766    return giovfs->LaunchFile(mPath);
       
  1767  #elif defined(MOZ_WIDGET_ANDROID)
       
  1768    // Not supported on GeckoView