mozilla-kde.patch
changeset 568 2c74c5927ea2
parent 546 2c9448fe783c
child 589 b3ff3d8ebf9d
--- a/mozilla-kde.patch	Wed Oct 24 10:25:01 2012 +0200
+++ b/mozilla-kde.patch	Fri Oct 26 13:01:33 2012 +0200
@@ -82,7 +82,7 @@
    bool hasMore;
 @@ -921,17 +940,17 @@ static nsresult pref_LoadPrefsInDirList(
  
-     nsCAutoString leaf;
+     nsAutoCString leaf;
      path->GetNativeLeafName(leaf);
  
      // Do we care if a file provided by this process fails to load?
@@ -159,7 +159,7 @@
 diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp
 --- a/toolkit/components/downloads/nsDownloadManager.cpp
 +++ b/toolkit/components/downloads/nsDownloadManager.cpp
-@@ -35,16 +35,20 @@
+@@ -36,16 +36,20 @@
  
  #ifdef XP_WIN
  #include <shlobj.h>
@@ -180,7 +180,7 @@
  #include "AndroidBridge.h"
  #endif
  
-@@ -2233,16 +2237,25 @@ nsDownload::SetState(DownloadState aStat
+@@ -2253,16 +2257,25 @@ nsDownload::SetState(DownloadState aStat
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
  
        // Master pref to control this function.
@@ -194,7 +194,7 @@
 +          command.AppendElement( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" ));
 +          nsAutoString displayName;
 +          GetDisplayName( displayName );
-+          command.AppendElement( nsCAutoString( ToNewUTF8String( displayName )));
++          command.AppendElement( nsAutoCString( ToNewUTF8String( displayName )));
 +          nsKDEUtils::command( command );
 +        } else {
 +        // begin non-KDE block
@@ -206,7 +206,7 @@
          int64_t goat = PR_Now() - mStartTime;
          showTaskbarAlert = goat > alertIntervalUSec;
  
-@@ -2266,19 +2279,20 @@ nsDownload::SetState(DownloadState aStat
+@@ -2286,19 +2299,20 @@ nsDownload::SetState(DownloadState aStat
                // If downloads are automatically removed per the user's
                // retention policy, there's no reason to make the text clickable
                // because if it is, they'll click open the download manager and
@@ -231,7 +231,7 @@
 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
 --- a/toolkit/content/jar.mn
 +++ b/toolkit/content/jar.mn
-@@ -45,29 +45,33 @@ toolkit.jar:
+@@ -46,29 +46,33 @@ toolkit.jar:
     content/global/viewZoomOverlay.js          (viewZoomOverlay.js)
  *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
     content/global/bindings/browser.xml         (widgets/browser.xml)
@@ -2068,8 +2068,7 @@
 diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
 +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
-@@ -13,16 +13,19 @@
- #include "prnetdb.h"
+@@ -14,16 +14,18 @@
  #include "prenv.h"
  #include "nsPrintfCString.h"
  #include "nsNetUtil.h"
@@ -2077,9 +2076,9 @@
  #include "nsIGSettingsService.h"
  #include "nsInterfaceHashtable.h"
  #include "mozilla/Attributes.h"
+ #include "nsIURI.h"
 +#include "nsVoidArray.h"
 +#include "nsKDEUtils.h"
-+
  
  class nsUnixSystemProxySettings MOZ_FINAL : public nsISystemProxySettings {
  public:
@@ -2088,7 +2087,7 @@
  
    nsUnixSystemProxySettings() {}
    nsresult Init();
-@@ -34,16 +37,17 @@ private:
+@@ -35,16 +37,17 @@ private:
    nsCOMPtr<nsIGSettingsService> mGSettings;
    nsCOMPtr<nsIGSettingsCollection> mProxySettings;
    nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
@@ -2102,31 +2101,31 @@
  
  NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
  
- nsresult
- nsUnixSystemProxySettings::Init()
+ NS_IMETHODIMP
+ nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly)
  {
-   // If this is a GNOME session, load gconf and try to use its preferences.
-@@ -496,16 +500,19 @@ nsUnixSystemProxySettings::GetProxyForUR
-   nsCAutoString host;
-   rv = aURI->GetHost(host);
-   NS_ENSURE_SUCCESS(rv, rv);
+   // dbus prevents us from being threadsafe, but this routine should not block anyhow
+@@ -499,16 +502,19 @@ nsUnixSystemProxySettings::GetProxyFromG
  
-   int32_t port;
-   rv = aURI->GetPort(&port);
-   NS_ENSURE_SUCCESS(rv, rv);
- 
-+  if( nsKDEUtils::kdeSupport())
-+    return GetProxyFromKDE(scheme, host, port, aResult);
+ nsresult
+ nsUnixSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
+                                           const nsACString & aScheme,
+                                           const nsACString & aHost,
+                                           const int32_t      aPort,
+                                           nsACString & aResult)
+ {
++  if( nsKDEUtils::kdeSupport()) {
++    return GetProxyFromKDE(aScheme, aHost, aPort, aResult);
 +
    if (mProxySettings) {
-     rv = GetProxyFromGSettings(scheme, host, port, aResult);
-     if (rv == NS_OK)
+     nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
+     if (NS_SUCCEEDED(rv))
        return rv;
    }
    if (mGConf)
-     return GetProxyFromGConf(scheme, host, port, aResult);
+     return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
  
-@@ -531,8 +538,34 @@ static const mozilla::Module::ContractID
+@@ -534,8 +540,34 @@ static const mozilla::Module::ContractID
  
  static const mozilla::Module kUnixProxyModule = {
    mozilla::Module::kVersion,
@@ -2142,7 +2141,7 @@
 +                                           PRInt32 aPort,
 +                                           nsACString& aResult)
 +{
-+  nsCAutoString url;
++  nsAutoCString url;
 +  url = aScheme;
 +  url += "://";
 +  url += aHost;
@@ -2321,7 +2320,7 @@
 +            *eol = '\0';
 +        command_done = ( strcmp( buf, "\\1" ) == 0 );
 +        command_failed = ( strcmp( buf, "\\0" ) == 0 );
-+        nsCAutoString line( buf );
++        nsAutoCString line( buf );
 +        line.ReplaceSubstring( "\\n", "\n" );
 +        line.ReplaceSubstring( "\\" "\\", "\\" ); //  \\ -> \ , i.e. unescape
 +        if( p->output && !( command_done || command_failed ))
@@ -2364,7 +2363,7 @@
 +        nsCOMPtr<nsISupportsCString> str = do_QueryElementAt( command, i );
 +        if( str )
 +            {
-+            nsCAutoString s;
++            nsAutoCString s;
 +            str->GetData( s );
 +            in.AppendElement( s );
 +            }
@@ -2625,7 +2624,7 @@
 +#include "nsVoidArray.h"
 +#include "nsKDEUtils.h"
 +
-+/* static */ PRBool
++/* static */ bool
 +nsCommonRegistry::HandlerExists(const char *aProtocolScheme)
 +{
 +    if( nsKDEUtils::kdeSupport())
@@ -2683,7 +2682,7 @@
 +class nsCommonRegistry
 +{
 + public:
-+  static PRBool HandlerExists(const char *aProtocolScheme);
++  static bool HandlerExists(const char *aProtocolScheme);
 +
 +  static nsresult LoadURL(nsIURI *aURL);
 +
@@ -2698,7 +2697,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp
-@@ -0,0 +1,86 @@
+@@ -0,0 +1,90 @@
 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 +/* This Source Code Form is subject to the terms of the Mozilla Public
 + * License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -2713,12 +2712,12 @@
 +#include "nsAutoPtr.h"
 +#include "nsKDEUtils.h"
 +
-+/* static */ PRBool
++/* static */ bool
 +nsKDERegistry::HandlerExists(const char *aProtocolScheme)
 +{
 +    nsTArray<nsCString> command;
 +    command.AppendElement( NS_LITERAL_CSTRING( "HANDLEREXISTS" ));
-+    command.AppendElement( nsCAutoString( aProtocolScheme ));
++    command.AppendElement( nsAutoCString( aProtocolScheme ));
 +    return nsKDEUtils::command( command );
 +}
 +
@@ -2730,7 +2729,11 @@
 +    nsCString url;
 +    aURL->GetSpec( url );
 +    command.AppendElement( url );
-+    return nsKDEUtils::command( command );
++    bool rv = nsKDEUtils::command( command );
++    if (!rv)
++      return NS_ERROR_FAILURE;
++
++    return NS_OK;
 +}
 +
 +/* static */ void
@@ -2799,13 +2802,13 @@
 +#include "nsTArray.h"
 +
 +class nsMIMEInfoBase;
-+class nsCAutoString;
++class nsAutoCString;
 +class nsCString;
 +
 +class nsKDERegistry
 +{
 + public:
-+  static PRBool HandlerExists(const char *aProtocolScheme);
++  static bool HandlerExists(const char *aProtocolScheme);
 +
 +  static nsresult LoadURL(nsIURI *aURL);
 +
@@ -2855,7 +2858,7 @@
    if (NS_FAILED(rv)){
      HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nullptr);
      if (action) {
-       nsCAutoString spec;
+       nsAutoCString spec;
        aURI->GetAsciiSpec(spec);
        if (hildon_uri_open(spec.get(), action, nullptr))
 @@ -61,22 +64,22 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI *
@@ -2870,7 +2873,7 @@
 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType);
 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType);
    if (!mimeInfo) {
-     nsCAutoString ext;
+     nsAutoCString ext;
      nsresult rv = GetPrimaryExtension(ext);
      if (NS_SUCCEEDED(rv)) {
 -      mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
@@ -2910,7 +2913,7 @@
 +  }
 +
    nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-   nsCAutoString uriSpec;
+   nsAutoCString uriSpec;
    if (giovfs) {
      // nsGIOMimeApp->Launch wants a URI string instead of local file
      nsresult rv;
@@ -2929,7 +2932,7 @@
 -  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
 +  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
    if (mimeInfo) {
-     nsCAutoString type;
+     nsAutoCString type;
      mimeInfo->GetType(type);
      if (giovfs) {
        nsCOMPtr<nsIGIOMimeApp> app;
@@ -3097,10 +3100,10 @@
 -    return NS_OK;
 +    // Unless it's KDE.
 +    if( mMode != modeOpen || !nsKDEUtils::kdeSupport())
-+        return NS_OK;
++      return NS_OK;
    }
  
-   nsCAutoString filter, name;
+   nsAutoCString filter, name;
    CopyUTF16toUTF8(aFilter, filter);
    CopyUTF16toUTF8(aTitle, name);
  
@@ -3126,7 +3129,7 @@
      g_main_context_iteration(nullptr, TRUE);
    }
  
-@@ -587,8 +594,235 @@ nsFilePicker::Done(GtkWidget* file_choos
+@@ -588,8 +595,235 @@ nsFilePicker::Done(GtkWidget* file_choos
    if (mCallback) {
      mCallback->Done(result);
      mCallback = nullptr;
@@ -3203,14 +3206,14 @@
 +            }
 +        }
 +
-+  nsCAutoString directory;
++  nsAutoCString directory;
 +  if (mDisplayDirectory) {
 +    mDisplayDirectory->GetNativePath(directory);
 +  } else if (mPrevDisplayDirectory) {
 +    mPrevDisplayDirectory->GetNativePath(directory);
 +  }
 +
-+    nsCAutoString startdir;
++    nsAutoCString startdir;
 +  if (!directory.IsEmpty()) {
 +    startdir = directory;
 +  }
@@ -3226,7 +3229,7 @@
 +  if( startdir.IsEmpty())
 +      startdir = ".";
 +
-+    nsCAutoString filters;
++    nsAutoCString filters;
 +    PRInt32 count = mFilters.Length();
 +    if( count == 0 ) //just in case
 +        filters = "*";
@@ -3241,12 +3244,12 @@
 +        }
 +
 +    nsTArray<nsCString> command;
-+    command.AppendElement( nsCAutoString( arg ));
++    command.AppendElement( nsAutoCString( arg ));
 +    command.AppendElement( startdir );
 +    if( mMode != nsIFilePicker::modeGetFolder )
 +        {
 +        command.AppendElement( filters );
-+        nsCAutoString selected;
++        nsAutoCString selected;
 +        selected.AppendInt( mSelectedType );
 +        command.AppendElement( selected );
 +        }
@@ -3256,7 +3259,7 @@
 +    if( PRInt32 xid = windowToXid( mParentWidget ))
 +        {
 +        command.AppendElement( NS_LITERAL_CSTRING( "PARENT" ));
-+        nsCAutoString parent;
++        nsAutoCString parent;
 +        parent.AppendInt( xid );
 +        command.AppendElement( parent );
 +        }
@@ -3344,7 +3347,7 @@
 +    if( PRInt32 xid = windowToXid( mParentWidget ))
 +        {
 +        command.AppendElement( NS_LITERAL_CSTRING( "PARENT" ));
-+        nsCAutoString parent;
++        nsAutoCString parent;
 +        parent.AppendInt( xid );
 +        command.AppendElement( parent );
 +        }
@@ -3532,7 +3535,7 @@
 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in
 --- a/xpcom/io/Makefile.in
 +++ b/xpcom/io/Makefile.in
-@@ -157,17 +157,17 @@ include $(topsrcdir)/ipc/chromium/chromi
+@@ -161,17 +161,17 @@ include $(topsrcdir)/ipc/chromium/chromi
  DEFINES		+= -D_IMPL_NS_COM
  
  ifeq ($(OS_ARCH),Linux)
@@ -3554,7 +3557,7 @@
 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
 --- a/xpcom/io/nsLocalFileUnix.cpp
 +++ b/xpcom/io/nsLocalFileUnix.cpp
-@@ -49,16 +49,17 @@
+@@ -50,16 +50,17 @@
  #include "prproces.h"
  #include "nsIDirectoryEnumerator.h"
  #include "nsISimpleEnumerator.h"
@@ -3572,7 +3575,7 @@
  #include "prmem.h"
  #include "plbase64.h"
  
-@@ -1760,44 +1761,51 @@ nsLocalFile::SetPersistentDescriptor(con
+@@ -1752,44 +1753,51 @@ nsLocalFile::SetPersistentDescriptor(con
      return InitWithNativePath(aPersistentDescriptor);
  #endif
  }
@@ -3586,7 +3589,7 @@
 -    if (!giovfs && !gnomevfs)
 -        return NS_ERROR_FAILURE;
 -
-+    nsCAutoString url;
++    nsAutoCString url;
      bool isDirectory;
      if (NS_FAILED(IsDirectory(&isDirectory)))
          return NS_ERROR_FAILURE;
@@ -3600,7 +3603,7 @@
 +        url = mPath;
      } else {
          nsCOMPtr<nsIFile> parentDir;
-         nsCAutoString dirPath;
+         nsAutoCString dirPath;
          if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
              return NS_ERROR_FAILURE;
          if (NS_FAILED(parentDir->GetNativePath(dirPath)))
@@ -3638,7 +3641,7 @@
        return rv;
      }
      return NS_ERROR_FAILURE;
-@@ -1823,16 +1831,23 @@ nsLocalFile::Launch()
+@@ -1815,16 +1823,23 @@ nsLocalFile::Launch()
  
      if (nullptr == connection)
        return NS_ERROR_FAILURE;