mozilla-kde.patch
branchfirefox65
changeset 1085 87f893cf45b9
parent 1082 821cfbe8efcc
child 1089 eca1c1f2fe50
equal deleted inserted replaced
1084:b0b3c507e253 1085:87f893cf45b9
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  d685597ba96ea004052e40ec0c80f422ea0e365c
     2 # Parent  ff3da33eabc1d8760ec41a87afbaf44ded300ede
     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
    25  #endif
    25  #endif
    26  
    26  
    27  #ifdef XP_WIN
    27  #ifdef XP_WIN
    28  #include "windows.h"
    28  #include "windows.h"
    29  #endif
    29  #endif
    30 @@ -4908,25 +4909,37 @@ Preferences::InitInitialObjects(bool aIs
    30 @@ -4466,25 +4467,37 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
    31    // application pref files for backwards compatibility.
    31    // application pref files for backwards compatibility.
    32    static const char* specialFiles[] = {
    32    static const char* specialFiles[] = {
    33  #if defined(XP_MACOSX)
    33  #if defined(XP_MACOSX)
    34      "macprefs.js"
    34      "macprefs.js"
    35  #elif defined(XP_WIN)
    35  #elif defined(XP_WIN)
    55 +        break;
    55 +        break;
    56 +      }
    56 +      }
    57 +    }
    57 +    }
    58 +  }
    58 +  }
    59 +
    59 +
    60    rv = pref_LoadPrefsInDir(
    60    rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles,
    61      defaultPrefDir, specialFiles, ArrayLength(specialFiles));
    61                             ArrayLength(specialFiles));
    62    if (NS_FAILED(rv)) {
    62    if (NS_FAILED(rv)) {
    63      NS_WARNING("Error parsing application default preferences.");
    63      NS_WARNING("Error parsing application default preferences.");
    64    }
    64    }
    65  
    65  
    66    // Load jar:$app/omni.jar!/defaults/preferences/*.js
    66    // Load jar:$app/omni.jar!/defaults/preferences/*.js
    67    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
    67    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
    68 @@ -4975,17 +4988,17 @@ Preferences::InitInitialObjects(bool aIs
    68 @@ -4532,17 +4545,17 @@ float MOZ_MAYBE_UNUSED GetPref<float>(co
    69        }
    69        }
    70  
    70  
    71        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
    71        nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
    72        if (!path) {
    72        if (!path) {
    73          continue;
    73          continue;
    81  
    81  
    82    if (XRE_IsParentProcess()) {
    82    if (XRE_IsParentProcess()) {
    83      SetupTelemetryPref();
    83      SetupTelemetryPref();
    84    }
    84    }
    85  
    85  
    86    NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
    86    NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr,
    87 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
    87 diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
    88 --- a/modules/libpref/moz.build
    88 --- a/modules/libpref/moz.build
    89 +++ b/modules/libpref/moz.build
    89 +++ b/modules/libpref/moz.build
    90 @@ -31,16 +31,20 @@ EXPORTS.mozilla += [
    90 @@ -31,16 +31,20 @@ EXPORTS.mozilla += [
    91      'StaticPrefs.h',
    91      'StaticPrefs.h',
   169  with Files('**'):
   169  with Files('**'):
   170      BUG_COMPONENT = ('Toolkit', 'Downloads API')
   170      BUG_COMPONENT = ('Toolkit', 'Downloads API')
   171 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   171 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
   172 --- a/toolkit/content/jar.mn
   172 --- a/toolkit/content/jar.mn
   173 +++ b/toolkit/content/jar.mn
   173 +++ b/toolkit/content/jar.mn
   174 @@ -68,16 +68,18 @@ toolkit.jar:
   174 @@ -67,16 +67,18 @@ toolkit.jar:
   175     content/global/bindings/calendar.js         (widgets/calendar.js)
   175     content/global/bindings/calendar.js         (widgets/calendar.js)
   176     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   176     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
   177     content/global/bindings/datekeeper.js       (widgets/datekeeper.js)
   177     content/global/bindings/datekeeper.js       (widgets/datekeeper.js)
   178     content/global/bindings/datepicker.js       (widgets/datepicker.js)
   178     content/global/bindings/datepicker.js       (widgets/datepicker.js)
   179     content/global/bindings/datetimepopup.xml   (widgets/datetimepopup.xml)
   179     content/global/bindings/datetimepopup.xml   (widgets/datetimepopup.xml)
   181     content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
   181     content/global/bindings/datetimebox.css     (widgets/datetimebox.css)
   182  *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
   182  *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
   183 +*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
   183 +*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
   184 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
   184 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
   185     content/global/bindings/general.xml         (widgets/general.xml)
   185     content/global/bindings/general.xml         (widgets/general.xml)
   186     content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
       
   187     content/global/bindings/menu.xml            (widgets/menu.xml)
   186     content/global/bindings/menu.xml            (widgets/menu.xml)
   188     content/global/bindings/menulist.xml        (widgets/menulist.xml)
   187     content/global/bindings/menulist.xml        (widgets/menulist.xml)
   189     content/global/bindings/notification.xml    (widgets/notification.xml)
   188     content/global/bindings/notification.xml    (widgets/notification.xml)
   190     content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
   189     content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
   191     content/global/bindings/popup.xml           (widgets/popup.xml)
   190     content/global/bindings/popup.xml           (widgets/popup.xml)
   192     content/global/bindings/radio.xml           (widgets/radio.xml)
   191     content/global/bindings/radio.xml           (widgets/radio.xml)
       
   192     content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
   193 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
   193 diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml
   194 new file mode 100644
   194 new file mode 100644
   195 --- /dev/null
   195 --- /dev/null
   196 +++ b/toolkit/content/widgets/dialog-kde.xml
   196 +++ b/toolkit/content/widgets/dialog-kde.xml
   197 @@ -0,0 +1,475 @@
   197 @@ -0,0 +1,477 @@
   198 +<?xml version="1.0"?>
   198 +<?xml version="1.0"?>
   199 +<!-- 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
   200 +   - 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
   201 +   - 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/. -->
   202 +
   202 +
   493 +              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
   493 +              } else if (dlgtype != "extra1" && dlgtype != "extra2") {
   494 +                button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype));
   494 +                button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype));
   495 +                var accessKey = this.mStrBundle.GetStringFromName("accesskey-" + dlgtype);
   495 +                var accessKey = this.mStrBundle.GetStringFromName("accesskey-" + dlgtype);
   496 +                if (accessKey)
   496 +                if (accessKey)
   497 +                  button.setAttribute("accesskey", accessKey);
   497 +                  button.setAttribute("accesskey", accessKey);
       
   498 +              } else if (this.hasAttribute("buttonid" + dlgtype)) {
       
   499 +                document.l10n.setAttributes(button, this.getAttribute("buttonid" + dlgtype));
   498 +              }
   500 +              }
   499 +            }
   501 +            }
   500 +            // allow specifying alternate icons in the dialog header
   502 +            // allow specifying alternate icons in the dialog header
   501 +            if (!button.hasAttribute("icon")) {
   503 +            if (!button.hasAttribute("icon")) {
   502 +              // if there's an icon specified, use that
   504 +              // if there's an icon specified, use that
   671 +
   673 +
   672 +</bindings>
   674 +</bindings>
   673 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
   675 diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js
   674 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
   676 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js
   675 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
   677 +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js
   676 @@ -1031,30 +1031,60 @@ nsUnknownContentTypeDialog.prototype = {
   678 @@ -1030,30 +1030,60 @@ nsUnknownContentTypeDialog.prototype = {
   677  
   679  
   678        if (params.handlerApp &&
   680        if (params.handlerApp &&
   679            params.handlerApp.executable &&
   681            params.handlerApp.executable &&
   680            params.handlerApp.executable.isFile()) {
   682            params.handlerApp.executable.isFile()) {
   681          // Remember the file they chose to run.
   683          // Remember the file they chose to run.
   761  #include "mozilla/Attributes.h"
   763  #include "mozilla/Attributes.h"
   762  #include "nsIURI.h"
   764  #include "nsIURI.h"
   763 +#include "nsKDEUtils.h"
   765 +#include "nsKDEUtils.h"
   764  
   766  
   765  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   767  class nsUnixSystemProxySettings final : public nsISystemProxySettings {
   766  public:
   768   public:
   767    NS_DECL_ISUPPORTS
   769    NS_DECL_ISUPPORTS
   768    NS_DECL_NSISYSTEMPROXYSETTINGS
   770    NS_DECL_NSISYSTEMPROXYSETTINGS
   769  
   771  
   770    nsUnixSystemProxySettings()
   772    nsUnixSystemProxySettings() : mSchemeProxySettings(4) {}
   771      : mSchemeProxySettings(4)
   773    nsresult Init();
   772 @@ -39,16 +40,17 @@ private:
   774 @@ -42,16 +43,18 @@ class nsUnixSystemProxySettings final : 
   773    nsCOMPtr<nsIGSettingsService> mGSettings;
   775                                     nsACString& aResult);
   774    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
   776    nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost,
   775    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
   777                               int32_t aPort, nsACString& aResult);
   776    bool IsProxyMode(const char* aMode);
   778    nsresult GetProxyFromGSettings(const nsACString& aScheme,
   777    nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
   779                                   const nsACString& aHost, int32_t aPort,
   778    nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
   780                                   nsACString& aResult);
   779    nsresult GetProxyFromGSettings(const nsACString& aScheme, const nsACString& aHost, int32_t aPort, nsACString& aResult);
   781    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType,
   780    nsresult SetProxyResultFromGSettings(const char* aKeyBase, const char* aType, nsACString& aResult);
   782                                         nsACString& aResult);
   781 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
   783 +  nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost,
       
   784 +                           PRInt32 aPort, nsACString& aResult);
   782  };
   785  };
   783  
   786  
   784  NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
   787  NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
   785  
   788  
   786  NS_IMETHODIMP
   789  NS_IMETHODIMP
   787  nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly)
   790  nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
   788  {
   791    // dbus prevents us from being threadsafe, but this routine should not block
   789    // dbus prevents us from being threadsafe, but this routine should not block anyhow
   792    // anyhow
   790 @@ -505,16 +507,19 @@ nsUnixSystemProxySettings::GetProxyFromG
   793 @@ -488,16 +491,19 @@ nsresult nsUnixSystemProxySettings::GetP
   791  
   794    return NS_OK;
   792  nsresult
   795  }
   793  nsUnixSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
   796  
   794                                            const nsACString & aScheme,
   797  nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
   795                                            const nsACString & aHost,
   798                                                     const nsACString& aScheme,
   796                                            const int32_t      aPort,
   799                                                     const nsACString& aHost,
   797                                            nsACString & aResult)
   800                                                     const int32_t aPort,
   798  {
   801                                                     nsACString& aResult) {
   799 +  if (nsKDEUtils::kdeSupport())
   802 +  if (nsKDEUtils::kdeSupport())
   800 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
   803 +    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
   801 +
   804 +
   802    if (mProxySettings) {
   805    if (mProxySettings) {
   803      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   806      nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
   804      if (NS_SUCCEEDED(rv))
   807      if (NS_SUCCEEDED(rv)) return rv;
   805        return rv;
       
   806    }
   808    }
   807    if (mGConf)
   809    if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
   808      return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
   810  
   809  
   811    return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
   810 @@ -540,8 +545,34 @@ static const mozilla::Module::ContractID
   812  }
       
   813 @@ -521,8 +527,34 @@ static const mozilla::Module::CIDEntry k
       
   814  static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
       
   815      {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID},
       
   816      {nullptr}};
   811  
   817  
   812  static const mozilla::Module kUnixProxyModule = {
   818  static const mozilla::Module kUnixProxyModule = {
   813    mozilla::Module::kVersion,
   819      mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts};
   814    kUnixProxyCIDs,
       
   815    kUnixProxyContracts
       
   816  };
       
   817  
   820  
   818  NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
   821  NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
   819 +
   822 +
   820 +nsresult
   823 +nsresult
   821 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
   824 +nsUnixSystemProxySettings::GetProxyFromKDE(const nsACString& aScheme,
   843 +}
   846 +}
   844 +
   847 +
   845 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
   848 diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
   846 --- a/toolkit/xre/moz.build
   849 --- a/toolkit/xre/moz.build
   847 +++ b/toolkit/xre/moz.build
   850 +++ b/toolkit/xre/moz.build
   848 @@ -68,17 +68,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
   851 @@ -73,17 +73,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
   849          '../components/printingui',
   852          '../components/printingui',
   850      ]
   853      ]
   851  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
   854  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
   852      UNIFIED_SOURCES += [
   855      UNIFIED_SOURCES += [
   853          'nsNativeAppSupportDefault.cpp',
   856          'nsNativeAppSupportDefault.cpp',
  1280  #ifdef MOZ_WIDGET_GTK
  1283  #ifdef MOZ_WIDGET_GTK
  1281 -#include "unix/nsGNOMERegistry.h"
  1284 -#include "unix/nsGNOMERegistry.h"
  1282 +#include "unix/nsCommonRegistry.h"
  1285 +#include "unix/nsCommonRegistry.h"
  1283  #endif
  1286  #endif
  1284  
  1287  
       
  1288  using mozilla::dom::ContentHandlerService;
       
  1289  using mozilla::dom::HandlerApp;
  1285  using mozilla::dom::HandlerInfo;
  1290  using mozilla::dom::HandlerInfo;
  1286  using mozilla::dom::HandlerApp;
       
  1287  using mozilla::dom::ContentHandlerService;
       
  1288  using mozilla::dom::RemoteHandlerApp;
  1291  using mozilla::dom::RemoteHandlerApp;
  1289  
  1292  
  1290  namespace {
  1293  namespace {
  1291 @@ -265,17 +265,17 @@ HandlerServiceParent::RecvExists(const H
  1294 @@ -246,17 +246,17 @@ mozilla::ipc::IPCResult HandlerServicePa
       
  1295    handlerSvc->Exists(info, exists);
       
  1296    return IPC_OK();
  1292  }
  1297  }
  1293  
  1298  
  1294  mozilla::ipc::IPCResult
  1299  mozilla::ipc::IPCResult HandlerServiceParent::RecvExistsForProtocol(
  1295  HandlerServiceParent::RecvExistsForProtocol(const nsCString& aProtocolScheme,
  1300      const nsCString& aProtocolScheme, bool* aHandlerExists) {
  1296                                              bool* aHandlerExists)
       
  1297  {
       
  1298  #ifdef MOZ_WIDGET_GTK
  1301  #ifdef MOZ_WIDGET_GTK
  1299    // Check the GNOME registry for a protocol handler
  1302    // Check the GNOME registry for a protocol handler
  1300 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
  1303 -  *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme.get());
  1301 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
  1304 +  *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme.get());
  1302  #else
  1305  #else
  1303    *aHandlerExists = false;
  1306    *aHandlerExists = false;
  1304  #endif
  1307  #endif
  1305    return IPC_OK();
  1308    return IPC_OK();
  1306  }
  1309  }
  1307  
  1310  
  1308  mozilla::ipc::IPCResult
  1311  mozilla::ipc::IPCResult HandlerServiceParent::RecvGetTypeFromExtension(
  1309  HandlerServiceParent::RecvGetTypeFromExtension(const nsCString& aFileExtension,
  1312      const nsCString& aFileExtension, nsCString* type) {
  1310 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  1313 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
  1311 --- a/uriloader/exthandler/moz.build
  1314 --- a/uriloader/exthandler/moz.build
  1312 +++ b/uriloader/exthandler/moz.build
  1315 +++ b/uriloader/exthandler/moz.build
  1313 @@ -76,17 +76,19 @@ else:
  1316 @@ -76,17 +76,19 @@ else:
  1314      SOURCES += [
  1317      SOURCES += [
  1571 +
  1574 +
  1572 +#endif //nsKDERegistry_h__
  1575 +#endif //nsKDERegistry_h__
  1573 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1576 diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1574 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1577 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1575 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1578 +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
  1576 @@ -1,50 +1,53 @@
  1579 @@ -1,47 +1,50 @@
  1577  /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  1580  /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  1578   *
  1581   *
  1579   * This Source Code Form is subject to the terms of the Mozilla Public
  1582   * This Source Code Form is subject to the terms of the Mozilla Public
  1580   * License, v. 2.0. If a copy of the MPL was not distributed with this
  1583   * License, v. 2.0. If a copy of the MPL was not distributed with this
  1581   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1584   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1592  #endif
  1595  #endif
  1593 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  1596 +#if defined(XP_UNIX) && !defined(XP_MACOSX)
  1594 +#include "nsKDEUtils.h"
  1597 +#include "nsKDEUtils.h"
  1595 +#endif
  1598 +#endif
  1596  
  1599  
  1597  nsresult
  1600  nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI *aURI) {
  1598  nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
       
  1599  {
       
  1600 -  return nsGNOMERegistry::LoadURL(aURI);
  1601 -  return nsGNOMERegistry::LoadURL(aURI);
  1601 +  return nsCommonRegistry::LoadURL(aURI);
  1602 +  return nsCommonRegistry::LoadURL(aURI);
  1602  }
  1603  }
  1603  
  1604  
  1604  NS_IMETHODIMP
  1605  NS_IMETHODIMP
  1605  nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval)
  1606  nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval) {
  1606  {
       
  1607    // if mDefaultApplication is set, it means the application has been set from
  1607    // if mDefaultApplication is set, it means the application has been set from
  1608    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  1608    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  1609    // give the GNOME answer.
  1609    // give the GNOME answer.
  1610    if (mDefaultApplication)
  1610    if (mDefaultApplication) return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
  1611      return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
       
  1612  
  1611  
  1613    *_retval = false;
  1612    *_retval = false;
  1614  
  1613  
  1615    if (mClass == eProtocolInfo) {
  1614    if (mClass == eProtocolInfo) {
  1616 -    *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get());
  1615 -    *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get());
  1617 +    *_retval = nsCommonRegistry::HandlerExists(mSchemeOrType.get());
  1616 +    *_retval = nsCommonRegistry::HandlerExists(mSchemeOrType.get());
  1618    } else {
  1617    } else {
  1619 -    RefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType);
  1618      RefPtr<nsMIMEInfoBase> mimeInfo =
  1620 +    RefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType);
  1619 -        nsGNOMERegistry::GetFromType(mSchemeOrType);
       
  1620 +        nsCommonRegistry::GetFromType(mSchemeOrType);
  1621      if (!mimeInfo) {
  1621      if (!mimeInfo) {
  1622        nsAutoCString ext;
  1622        nsAutoCString ext;
  1623        nsresult rv = GetPrimaryExtension(ext);
  1623        nsresult rv = GetPrimaryExtension(ext);
  1624        if (NS_SUCCEEDED(rv)) {
  1624        if (NS_SUCCEEDED(rv)) {
  1625 -        mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  1625 -        mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
  1626 +        mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  1626 +        mimeInfo = nsCommonRegistry::GetFromExtension(ext);
  1627        }
  1627        }
  1628      }
  1628      }
  1629      if (mimeInfo)
  1629      if (mimeInfo) *_retval = true;
  1630        *_retval = true;
       
  1631    }
  1630    }
  1632  
  1631  
  1633    if (*_retval)
  1632    if (*_retval) return NS_OK;
  1634      return NS_OK;
  1633  
  1635 @@ -59,16 +62,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
  1634    return NS_OK;
       
  1635 @@ -51,16 +54,33 @@ nsresult nsMIMEInfoUnix::LaunchDefaultWi
       
  1636    // if mDefaultApplication is set, it means the application has been set from
  1636    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  1637    // either /etc/mailcap or ${HOME}/.mailcap, in which case we don't want to
  1637    // give the GNOME answer.
  1638    // give the GNOME answer.
  1638    if (mDefaultApplication)
  1639    if (mDefaultApplication) return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
  1639      return nsMIMEInfoImpl::LaunchDefaultWithFile(aFile);
       
  1640  
  1640  
  1641    nsAutoCString nativePath;
  1641    nsAutoCString nativePath;
  1642    aFile->GetNativePath(nativePath);
  1642    aFile->GetNativePath(nativePath);
  1643  
  1643  
  1644 +  if( nsKDEUtils::kdeSupport()) {
  1644 +  if( nsKDEUtils::kdeSupport()) {
  1663      return NS_ERROR_FAILURE;
  1663      return NS_ERROR_FAILURE;
  1664    }
  1664    }
  1665  
  1665  
  1666    // nsGIOMimeApp->Launch wants a URI string instead of local file
  1666    // nsGIOMimeApp->Launch wants a URI string instead of local file
  1667    nsresult rv;
  1667    nsresult rv;
  1668    nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
  1668    nsCOMPtr<nsIIOService> ioservice =
  1669 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1669 diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1670 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1670 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1671 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1671 +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
  1672 @@ -5,17 +5,17 @@
  1672 @@ -5,17 +5,17 @@
  1673   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1673   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  1686  #include "nsReadableUtils.h"
  1686  #include "nsReadableUtils.h"
  1687  #include "nsUnicharUtils.h"
  1687  #include "nsUnicharUtils.h"
  1688  #include "nsIURL.h"
  1688  #include "nsIURL.h"
  1689  #include "nsIFileStreams.h"
  1689  #include "nsIFileStreams.h"
  1690  #include "nsILineInputStream.h"
  1690  #include "nsILineInputStream.h"
  1691 @@ -1122,17 +1122,17 @@ nsOSHelperAppService::GetHandlerAndDescr
  1691 @@ -1031,17 +1031,17 @@ nsresult nsOSHelperAppService::GetHandle
  1692  
  1692  
  1693  nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolScheme, bool * aHandlerExists)
  1693  nsresult nsOSHelperAppService::OSProtocolHandlerExists(
  1694  {
  1694      const char* aProtocolScheme, bool* aHandlerExists) {
  1695    nsresult rv = NS_OK;
  1695    nsresult rv = NS_OK;
  1696  
  1696  
  1697    if (!XRE_IsContentProcess()) {
  1697    if (!XRE_IsContentProcess()) {
  1698  #ifdef MOZ_WIDGET_GTK
  1698  #ifdef MOZ_WIDGET_GTK
  1699      // Check the GNOME registry for a protocol handler
  1699      // Check the GNOME registry for a protocol handler
  1702  #else
  1702  #else
  1703      *aHandlerExists = false;
  1703      *aHandlerExists = false;
  1704  #endif
  1704  #endif
  1705    } else {
  1705    } else {
  1706      *aHandlerExists = false;
  1706      *aHandlerExists = false;
  1707      nsCOMPtr<nsIHandlerService> handlerSvc = do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv);
  1707      nsCOMPtr<nsIHandlerService> handlerSvc =
       
  1708          do_GetService(NS_HANDLERSERVICE_CONTRACTID, &rv);
  1708      if (NS_SUCCEEDED(rv) && handlerSvc) {
  1709      if (NS_SUCCEEDED(rv) && handlerSvc) {
  1709        rv = handlerSvc->ExistsForProtocol(nsCString(aProtocolScheme), aHandlerExists);
  1710 @@ -1051,17 +1051,17 @@ nsresult nsOSHelperAppService::OSProtoco
  1710 @@ -1140,17 +1140,17 @@ nsresult nsOSHelperAppService::OSProtoco
       
  1711    }
  1711    }
  1712  
  1712  
  1713    return rv;
  1713    return rv;
  1714  }
  1714  }
  1715  
  1715  
  1716  NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
  1716  NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(
  1717  {
  1717      const nsACString& aScheme, nsAString& _retval) {
  1718  #ifdef MOZ_WIDGET_GTK
  1718  #ifdef MOZ_WIDGET_GTK
  1719 -  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
  1719 -  nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval);
  1720 +  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
  1720 +  nsCommonRegistry::GetAppDescForScheme(aScheme, _retval);
  1721    return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
  1721    return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
  1722  #else
  1722  #else
  1723    return NS_ERROR_NOT_AVAILABLE;
  1723    return NS_ERROR_NOT_AVAILABLE;
  1724  #endif
  1724  #endif
  1725  }
  1725  }
  1726  
  1726  
  1727  nsresult nsOSHelperAppService::GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile)
  1727  nsresult nsOSHelperAppService::GetFileTokenForPath(
  1728  {
  1728      const char16_t* platformAppPath, nsIFile** aFile) {
  1729 @@ -1237,17 +1237,17 @@ nsOSHelperAppService::GetFromExtension(c
  1729 @@ -1142,17 +1142,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
  1730                                           mime_types_description,
  1730    nsresult rv =
  1731                                           true);
  1731        LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
       
  1732                                 minorType, mime_types_description, true);
  1732  
  1733  
  1733    if (NS_FAILED(rv) || majorType.IsEmpty()) {
  1734    if (NS_FAILED(rv) || majorType.IsEmpty()) {
  1734  
       
  1735  #ifdef MOZ_WIDGET_GTK
  1735  #ifdef MOZ_WIDGET_GTK
  1736      LOG(("Looking in GNOME registry\n"));
  1736      LOG(("Looking in GNOME registry\n"));
  1737      RefPtr<nsMIMEInfoBase> gnomeInfo =
  1737      RefPtr<nsMIMEInfoBase> gnomeInfo =
  1738 -      nsGNOMERegistry::GetFromExtension(aFileExt);
  1738 -        nsGNOMERegistry::GetFromExtension(aFileExt);
  1739 +      nsCommonRegistry::GetFromExtension(aFileExt);
  1739 +        nsCommonRegistry::GetFromExtension(aFileExt);
  1740      if (gnomeInfo) {
  1740      if (gnomeInfo) {
  1741        LOG(("Got MIMEInfo from GNOME registry\n"));
  1741        LOG(("Got MIMEInfo from GNOME registry\n"));
  1742        return gnomeInfo.forget();
  1742        return gnomeInfo.forget();
  1743      }
  1743      }
  1744  #endif
  1744  #endif
  1745  
  1745  
  1746      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt),
  1746      rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), majorType,
  1747                                    majorType,
  1747                                    minorType, mime_types_description, false);
  1748 @@ -1358,17 +1358,17 @@ nsOSHelperAppService::GetFromType(const 
  1748 @@ -1254,17 +1254,17 @@ already_AddRefed<nsMIMEInfoBase> nsOSHel
       
  1749  
       
  1750    // Now look up our extensions
  1749    nsAutoString extensions, mime_types_description;
  1751    nsAutoString extensions, mime_types_description;
  1750    LookUpExtensionsAndDescription(majorType,
  1752    LookUpExtensionsAndDescription(majorType, minorType, extensions,
  1751                                   minorType,
       
  1752                                   extensions,
       
  1753                                   mime_types_description);
  1753                                   mime_types_description);
  1754  
  1754  
  1755  #ifdef MOZ_WIDGET_GTK
  1755  #ifdef MOZ_WIDGET_GTK
  1756    if (handler.IsEmpty()) {
  1756    if (handler.IsEmpty()) {
  1757 -    RefPtr<nsMIMEInfoBase> gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
  1757 -    RefPtr<nsMIMEInfoBase> gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType);
  1758 +    RefPtr<nsMIMEInfoBase> gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType);
  1758 +    RefPtr<nsMIMEInfoBase> gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType);
  1759      if (gnomeInfo) {
  1759      if (gnomeInfo) {
  1760        LOG(("Got MIMEInfo from GNOME registry without extensions; setting them "
  1760        LOG(
  1761             "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get()));
  1761            ("Got MIMEInfo from GNOME registry without extensions; setting them "
       
  1762             "to %s\n",
       
  1763             NS_LossyConvertUTF16toASCII(extensions).get()));
  1762  
  1764  
  1763        NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
  1765        NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?");
  1764        gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
  1766        gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions));
  1765        return gnomeInfo.forget();
       
  1766      }
       
  1767 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
  1767 diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
  1768 --- a/widget/gtk/moz.build
  1768 --- a/widget/gtk/moz.build
  1769 +++ b/widget/gtk/moz.build
  1769 +++ b/widget/gtk/moz.build
  1770 @@ -123,16 +123,17 @@ include('/ipc/chromium/chromium-config.m
  1770 @@ -116,16 +116,17 @@ include('/ipc/chromium/chromium-config.m
  1771  
  1771  
  1772  FINAL_LIBRARY = 'xul'
  1772  FINAL_LIBRARY = 'xul'
  1773  
  1773  
  1774  LOCAL_INCLUDES += [
  1774  LOCAL_INCLUDES += [
  1775      '/layout/base',
  1775      '/layout/base',
  1821  #define MAX_PREVIEW_SIZE 180
  1821  #define MAX_PREVIEW_SIZE 180
  1822  // bug 1184009
  1822  // bug 1184009
  1823  #define MAX_PREVIEW_SOURCE_SIZE 4096
  1823  #define MAX_PREVIEW_SOURCE_SIZE 4096
  1824  
  1824  
  1825  nsIFile *nsFilePicker::mPrevDisplayDirectory = nullptr;
  1825  nsIFile *nsFilePicker::mPrevDisplayDirectory = nullptr;
  1826 @@ -246,17 +248,19 @@ nsFilePicker::AppendFilters(int32_t aFil
  1826 @@ -227,17 +229,19 @@ nsFilePicker::AppendFilters(int32_t aFil
       
  1827    mAllowURLs = !!(aFilterMask & filterAllowURLs);
  1827    return nsBaseFilePicker::AppendFilters(aFilterMask);
  1828    return nsBaseFilePicker::AppendFilters(aFilterMask);
  1828  }
  1829  }
  1829  
  1830  
  1830  NS_IMETHODIMP
  1831  NS_IMETHODIMP
  1831  nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter)
  1832  nsFilePicker::AppendFilter(const nsAString &aTitle, const nsAString &aFilter) {
  1832  {
       
  1833    if (aFilter.EqualsLiteral("..apps")) {
  1833    if (aFilter.EqualsLiteral("..apps")) {
  1834      // No platform specific thing we can do here, really....
  1834      // No platform specific thing we can do here, really....
  1835 -    return NS_OK;
  1835 -    return NS_OK;
  1836 +    // Unless it's KDE.
  1836 +    // Unless it's KDE.
  1837 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  1837 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
  1842    CopyUTF16toUTF8(aFilter, filter);
  1842    CopyUTF16toUTF8(aFilter, filter);
  1843    CopyUTF16toUTF8(aTitle, name);
  1843    CopyUTF16toUTF8(aTitle, name);
  1844  
  1844  
  1845    mFilters.AppendElement(filter);
  1845    mFilters.AppendElement(filter);
  1846    mFilterNames.AppendElement(name);
  1846    mFilterNames.AppendElement(name);
  1847 @@ -371,16 +375,39 @@ nsFilePicker::Show(int16_t *aReturn)
  1847 @@ -337,16 +341,39 @@ nsresult nsFilePicker::Show(int16_t *aRe
       
  1848    return NS_OK;
       
  1849  }
  1848  
  1850  
  1849  NS_IMETHODIMP
  1851  NS_IMETHODIMP
  1850  nsFilePicker::Open(nsIFilePickerShownCallback *aCallback)
  1852  nsFilePicker::Open(nsIFilePickerShownCallback *aCallback) {
  1851  {
       
  1852    // Can't show two dialogs concurrently with the same filepicker
  1853    // Can't show two dialogs concurrently with the same filepicker
  1853    if (mRunning)
  1854    if (mRunning) return NS_ERROR_NOT_AVAILABLE;
  1854      return NS_ERROR_NOT_AVAILABLE;
       
  1855  
  1855  
  1856 +  // KDE file picker is not handled via callback
  1856 +  // KDE file picker is not handled via callback
  1857 +  if( nsKDEUtils::kdeSupport()) {
  1857 +  if( nsKDEUtils::kdeSupport()) {
  1858 +    mCallback = aCallback;
  1858 +    mCallback = aCallback;
  1859 +    mRunning = true;
  1859 +    mRunning = true;
  1878 +
  1878 +
  1879    nsCString title;
  1879    nsCString title;
  1880    title.Adopt(ToNewUTF8String(mTitle));
  1880    title.Adopt(ToNewUTF8String(mTitle));
  1881  
  1881  
  1882    GtkWindow *parent_widget =
  1882    GtkWindow *parent_widget =
  1883      GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  1883        GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
  1884  
  1884  
  1885    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  1885    GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
  1886  
  1886  
  1887 @@ -600,16 +627,241 @@ nsFilePicker::Done(void* file_chooser, g
  1887 @@ -571,16 +598,240 @@ void nsFilePicker::Done(void *file_choos
  1888      mCallback->Done(result);
  1888      mCallback->Done(result);
  1889      mCallback = nullptr;
  1889      mCallback = nullptr;
  1890    } else {
  1890    } else {
  1891      mResult = result;
  1891      mResult = result;
  1892    }
  1892    }
  2115 +        *aReturn = nsIFilePicker::returnCancel;
  2115 +        *aReturn = nsIFilePicker::returnCancel;
  2116 +        }
  2116 +        }
  2117 +    return NS_OK;
  2117 +    return NS_OK;
  2118 +    }
  2118 +    }
  2119 +
  2119 +
  2120 +
       
  2121  // All below functions available as of GTK 3.20+
  2120  // All below functions available as of GTK 3.20+
  2122  
  2121  void *nsFilePicker::GtkFileChooserNew(const gchar *title, GtkWindow *parent,
  2123  void *
  2122                                        GtkFileChooserAction action,
  2124  nsFilePicker::GtkFileChooserNew(
  2123                                        const gchar *accept_label) {
  2125          const gchar *title, GtkWindow *parent,
  2124    static auto sGtkFileChooserNativeNewPtr =
  2126          GtkFileChooserAction action,
  2125        (void *(*)(const gchar *, GtkWindow *, GtkFileChooserAction,
  2127          const gchar *accept_label)
  2126                   const gchar *,
  2128  {
  2127                   const gchar *))dlsym(RTLD_DEFAULT,
  2129 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  2128 diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h
  2130 --- a/widget/gtk/nsFilePicker.h
  2129 --- a/widget/gtk/nsFilePicker.h
  2131 +++ b/widget/gtk/nsFilePicker.h
  2130 +++ b/widget/gtk/nsFilePicker.h
  2132 @@ -69,16 +69,22 @@ protected:
  2131 @@ -67,16 +67,22 @@ class nsFilePicker : public nsBaseFilePi
  2133    nsString  mDefaultExtension;
  2132    nsString mDefaultExtension;
  2134  
  2133  
  2135    nsTArray<nsCString> mFilters;
  2134    nsTArray<nsCString> mFilters;
  2136    nsTArray<nsCString> mFilterNames;
  2135    nsTArray<nsCString> mFilterNames;
  2137  
  2136  
  2138  private:
  2137   private:
  2139    static nsIFile *mPrevDisplayDirectory;
  2138    static nsIFile *mPrevDisplayDirectory;
  2140  
  2139  
  2141 +  bool kdeRunning();
  2140 +  bool kdeRunning();
  2142 +  bool getKdeRunning();
  2141 +  bool getKdeRunning();
  2143 +  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
  2142 +  NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn);
  2144 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
  2143 +  NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn);
  2145 +  nsCString kdeMakeFilter( int index );
  2144 +  nsCString kdeMakeFilter( int index );
  2146 +
  2145 +
  2147    void *GtkFileChooserNew(
  2146    void *GtkFileChooserNew(const gchar *title, GtkWindow *parent,
  2148            const gchar *title, GtkWindow *parent,
  2147                            GtkFileChooserAction action,
  2149            GtkFileChooserAction action,
  2148                            const gchar *accept_label);
  2150            const gchar *accept_label);
       
  2151    void GtkFileChooserShow(void *file_chooser);
  2149    void GtkFileChooserShow(void *file_chooser);
  2152    void GtkFileChooserDestroy(void *file_chooser);
  2150    void GtkFileChooserDestroy(void *file_chooser);
  2153    void GtkFileChooserSetModal(void *file_chooser, GtkWindow* parent_widget,
  2151    void GtkFileChooserSetModal(void *file_chooser, GtkWindow *parent_widget,
  2154            gboolean modal);
  2152                                gboolean modal);
       
  2153  
  2155 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  2154 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
  2156 --- a/xpcom/components/ManifestParser.cpp
  2155 --- a/xpcom/components/ManifestParser.cpp
  2157 +++ b/xpcom/components/ManifestParser.cpp
  2156 +++ b/xpcom/components/ManifestParser.cpp
  2158 @@ -33,16 +33,17 @@
  2157 @@ -33,16 +33,17 @@
  2159  #include "nsTextFormatter.h"
  2158  #include "nsTextFormatter.h"
  2166  #include "nsIXULRuntime.h"
  2165  #include "nsIXULRuntime.h"
  2167 +#include "nsKDEUtils.h"
  2166 +#include "nsKDEUtils.h"
  2168  
  2167  
  2169  using namespace mozilla;
  2168  using namespace mozilla;
  2170  
  2169  
  2171  struct ManifestDirective
  2170  struct ManifestDirective {
  2172  {
       
  2173    const char* directive;
  2171    const char* directive;
  2174    int argc;
  2172    int argc;
  2175  
  2173  
  2176 @@ -421,16 +422,17 @@ ParseManifest(NSLocationType aType, File
  2174    bool ischrome;
       
  2175 @@ -392,16 +393,17 @@ void ParseManifest(NSLocationType aType,
  2177    NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
  2176    NS_NAMED_LITERAL_STRING(kRemoteEnabled, "remoteenabled");
  2178    NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
  2177    NS_NAMED_LITERAL_STRING(kRemoteRequired, "remoterequired");
  2179    NS_NAMED_LITERAL_STRING(kApplication, "application");
  2178    NS_NAMED_LITERAL_STRING(kApplication, "application");
  2180    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
  2179    NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
  2181    NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
  2180    NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
  2189  #endif
  2188  #endif
  2190  
  2189  
  2191    NS_NAMED_LITERAL_STRING(kMain, "main");
  2190    NS_NAMED_LITERAL_STRING(kMain, "main");
  2192    NS_NAMED_LITERAL_STRING(kContent, "content");
  2191    NS_NAMED_LITERAL_STRING(kContent, "content");
  2193  
  2192  
  2194 @@ -476,44 +478,49 @@ ParseManifest(NSLocationType aType, File
  2193 @@ -447,39 +449,44 @@ void ParseManifest(NSLocationType aType,
  2195          CopyUTF8toUTF16(s, abi);
  2194          CopyUTF8toUTF16(s, abi);
  2196          abi.Insert(char16_t('_'), 0);
  2195          abi.Insert(char16_t('_'), 0);
  2197          abi.Insert(osTarget, 0);
  2196          abi.Insert(osTarget, 0);
  2198        }
  2197        }
  2199      }
  2198      }
  2201  
  2200  
  2202    nsAutoString osVersion;
  2201    nsAutoString osVersion;
  2203 +  nsAutoString desktop;
  2202 +  nsAutoString desktop;
  2204  #if defined(XP_WIN)
  2203  #if defined(XP_WIN)
  2205  #pragma warning(push)
  2204  #pragma warning(push)
  2206  #pragma warning(disable:4996) // VC12+ deprecates GetVersionEx
  2205  #pragma warning(disable : 4996)  // VC12+ deprecates GetVersionEx
  2207    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
  2206    OSVERSIONINFO info = {sizeof(OSVERSIONINFO)};
  2208    if (GetVersionEx(&info)) {
  2207    if (GetVersionEx(&info)) {
  2209      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  2208      nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", info.dwMajorVersion,
  2210                                info.dwMajorVersion,
       
  2211                                info.dwMinorVersion);
  2209                                info.dwMinorVersion);
  2212    }
  2210    }
  2213 +  desktop = NS_LITERAL_STRING("win");
  2211 +  desktop = NS_LITERAL_STRING("win");
  2214  #pragma warning(pop)
  2212  #pragma warning(pop)
  2215  #elif defined(MOZ_WIDGET_COCOA)
  2213  #elif defined(MOZ_WIDGET_COCOA)
  2216    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
  2214    SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
  2217    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
  2215    SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
  2218    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  2216    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", majorVersion, minorVersion);
  2219                              majorVersion,
       
  2220                              minorVersion);
       
  2221 +  desktop = NS_LITERAL_STRING("macosx");
  2217 +  desktop = NS_LITERAL_STRING("macosx");
  2222  #elif defined(MOZ_WIDGET_GTK)
  2218  #elif defined(MOZ_WIDGET_GTK)
  2223    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
  2219    nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", gtk_major_version,
  2224                              gtk_major_version,
       
  2225                              gtk_minor_version);
  2220                              gtk_minor_version);
  2226 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
  2221 +  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
  2227  #elif defined(MOZ_WIDGET_ANDROID)
  2222  #elif defined(MOZ_WIDGET_ANDROID)
  2228    bool isTablet = false;
  2223    bool isTablet = false;
  2229    if (mozilla::AndroidBridge::Bridge()) {
  2224    if (mozilla::AndroidBridge::Bridge()) {
  2230      mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION",
  2225      mozilla::AndroidBridge::Bridge()->GetStaticStringField(
  2231                                                             "RELEASE",
  2226          "android/os/Build$VERSION", "RELEASE", osVersion);
  2232                                                             osVersion);
       
  2233      isTablet = java::GeckoAppShell::IsTablet();
  2227      isTablet = java::GeckoAppShell::IsTablet();
  2234    }
  2228    }
  2235 +  desktop = NS_LITERAL_STRING("android");
  2229 +  desktop = NS_LITERAL_STRING("android");
  2236  #endif
  2230  #endif
  2237  
  2231  
  2239      process = kContent;
  2233      process = kContent;
  2240    } else {
  2234    } else {
  2241      process = kMain;
  2235      process = kMain;
  2242    }
  2236    }
  2243  
  2237  
  2244 @@ -600,25 +607,27 @@ ParseManifest(NSLocationType aType, File
  2238 @@ -566,25 +573,27 @@ void ParseManifest(NSLocationType aType,
  2245      TriState stOsVersion = eUnspecified;
  2239      TriState stOsVersion = eUnspecified;
  2246      TriState stOs = eUnspecified;
  2240      TriState stOs = eUnspecified;
  2247      TriState stABI = eUnspecified;
  2241      TriState stABI = eUnspecified;
  2248      TriState stProcess = eUnspecified;
  2242      TriState stProcess = eUnspecified;
  2249  #if defined(MOZ_WIDGET_ANDROID)
  2243  #if defined(MOZ_WIDGET_ANDROID)
  2262            CheckStringFlag(kABI, wtoken, abi, stABI) ||
  2256            CheckStringFlag(kABI, wtoken, abi, stABI) ||
  2263 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
  2257 +          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
  2264            CheckStringFlag(kProcess, wtoken, process, stProcess) ||
  2258            CheckStringFlag(kProcess, wtoken, process, stProcess) ||
  2265            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
  2259            CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
  2266            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
  2260            CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
  2267            CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion)) {
  2261            CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion,
       
  2262                             stGeckoVersion)) {
  2268          continue;
  2263          continue;
  2269        }
  2264        }
  2270  
  2265  
  2271  #if defined(MOZ_WIDGET_ANDROID)
  2266 @@ -621,17 +630,17 @@ void ParseManifest(NSLocationType aType,
  2272 @@ -663,16 +672,17 @@ ParseManifest(NSLocationType aType, File
  2267        }
       
  2268  
       
  2269        LogMessageWithContext(
       
  2270            aFile, line, "Unrecognized chrome manifest modifier '%s'.", token);
       
  2271        ok = false;
  2273      }
  2272      }
  2274  
  2273  
  2275      if (!ok ||
  2274      if (!ok || stApp == eBad || stAppVersion == eBad ||
  2276          stApp == eBad ||
  2275 -        stGeckoVersion == eBad || stOs == eBad || stOsVersion == eBad ||
  2277          stAppVersion == eBad ||
  2276 +        stGeckoVersion == eBad || stOs == eBad || stOsVersion == eBad || stDesktop == eBad ||
  2278          stGeckoVersion == eBad ||
       
  2279          stOs == eBad ||
       
  2280          stOsVersion == eBad ||
       
  2281 +        stDesktop == eBad ||
       
  2282  #ifdef MOZ_WIDGET_ANDROID
  2277  #ifdef MOZ_WIDGET_ANDROID
  2283          stTablet == eBad ||
  2278          stTablet == eBad ||
  2284  #endif
  2279  #endif
  2285          stABI == eBad ||
  2280          stABI == eBad || stProcess == eBad) {
  2286          stProcess == eBad) {
       
  2287        continue;
  2281        continue;
  2288      }
  2282      }
  2289  
  2283  
       
  2284      if (directive->regfunc) {
  2290 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  2285 diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
  2291 --- a/xpcom/components/moz.build
  2286 --- a/xpcom/components/moz.build
  2292 +++ b/xpcom/components/moz.build
  2287 +++ b/xpcom/components/moz.build
  2293 @@ -43,12 +43,13 @@ FINAL_LIBRARY = 'xul'
  2288 @@ -44,12 +44,13 @@ LOCAL_INCLUDES += [
  2294  
       
  2295  LOCAL_INCLUDES += [
       
  2296      '!..',
  2289      '!..',
  2297      '../base',
  2290      '../base',
  2298      '../build',
  2291      '../build',
  2299      '../ds',
  2292      '../ds',
  2300      '/chrome',
  2293      '/chrome',
       
  2294      '/js/xpconnect/loader',
       
  2295      '/layout/build',
  2301      '/modules/libjar',
  2296      '/modules/libjar',
  2302 +    '/toolkit/xre',
  2297 +    '/toolkit/xre',
  2303  ]
  2298  ]
  2304  
  2299  
  2305  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2300  if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
  2323  #include <Carbon/Carbon.h>
  2318  #include <Carbon/Carbon.h>
  2324  #include "CocoaFileUtils.h"
  2319  #include "CocoaFileUtils.h"
  2325  #include "prmem.h"
  2320  #include "prmem.h"
  2326  #include "plbase64.h"
  2321  #include "plbase64.h"
  2327  
  2322  
  2328 @@ -2007,63 +2008,78 @@ nsLocalFile::SetPersistentDescriptor(con
  2323 @@ -1902,62 +1903,77 @@ nsLocalFile::SetPersistentDescriptor(con
       
  2324  
  2329  NS_IMETHODIMP
  2325  NS_IMETHODIMP
  2330  nsLocalFile::Reveal()
  2326  nsLocalFile::Reveal() {
  2331  {
       
  2332    if (!FilePreferences::IsAllowedPath(mPath)) {
  2327    if (!FilePreferences::IsAllowedPath(mPath)) {
  2333      return NS_ERROR_FILE_ACCESS_DENIED;
  2328      return NS_ERROR_FILE_ACCESS_DENIED;
  2334    }
  2329    }
  2335  
  2330  
  2336  #ifdef MOZ_WIDGET_GTK
  2331  #ifdef MOZ_WIDGET_GTK
  2387 +
  2382 +
  2388 +  return giovfs->ShowURIForInput(url);
  2383 +  return giovfs->ShowURIForInput(url);
  2389  }
  2384  }
  2390  
  2385  
  2391  NS_IMETHODIMP
  2386  NS_IMETHODIMP
  2392  nsLocalFile::Launch()
  2387  nsLocalFile::Launch() {
  2393  {
       
  2394    if (!FilePreferences::IsAllowedPath(mPath)) {
  2388    if (!FilePreferences::IsAllowedPath(mPath)) {
  2395      return NS_ERROR_FILE_ACCESS_DENIED;
  2389      return NS_ERROR_FILE_ACCESS_DENIED;
  2396    }
  2390    }
  2397  
  2391  
  2398  #ifdef MOZ_WIDGET_GTK
  2392  #ifdef MOZ_WIDGET_GTK