mozilla-kde.patch
changeset 419 f6b055dd94bc
parent 409 ff30593d2daa
child 438 7d934b2f5014
--- a/mozilla-kde.patch	Sat Mar 31 09:26:42 2012 +0200
+++ b/mozilla-kde.patch	Sat Mar 31 22:19:28 2012 +0200
@@ -27,7 +27,7 @@
 diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp
 --- a/modules/libpref/src/Preferences.cpp
 +++ b/modules/libpref/src/Preferences.cpp
-@@ -56,16 +56,17 @@
+@@ -57,16 +57,17 @@
  #include "nsIStringEnumerator.h"
  #include "nsIZipReader.h"
  #include "nsPrefBranch.h"
@@ -45,14 +45,14 @@
  #include "prefapi.h"
  #include "prefread.h"
  #include "prefapi_private_data.h"
-@@ -935,30 +936,48 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
- }
+@@ -937,16 +938,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
  
  static nsresult pref_LoadPrefsInDirList(const char *listId)
  {
    nsresult rv;
    nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
-   if (NS_FAILED(rv)) return rv;
+   if (NS_FAILED(rv))
+     return rv;
  
 +  // make sure we load these special files after all the others
 +  static const char* specialFiles[] = {
@@ -72,30 +72,34 @@
 +    }
 +  }
 +
-   nsCOMPtr<nsISimpleEnumerator> dirList;
+   nsCOMPtr<nsISimpleEnumerator> list;
    dirSvc->Get(listId,
                NS_GET_IID(nsISimpleEnumerator),
-               getter_AddRefs(dirList));
-   if (dirList) {
-     bool hasMore;
-     while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) {
-       nsCOMPtr<nsISupports> elem;
-       dirList->GetNext(getter_AddRefs(elem));
-       if (elem) {
-         nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
-         if (dir) {
-           // Do we care if a file provided by this process fails to load?
--          pref_LoadPrefsInDir(dir, nsnull, 0); 
-+          pref_LoadPrefsInDir(dir, specialFiles, NS_ARRAY_LENGTH(specialFiles));
-         }
-       }
-     }
+               getter_AddRefs(list));
+   if (!list)
+     return NS_OK;
+ 
+   bool hasMore;
+@@ -962,17 +981,17 @@ static nsresult pref_LoadPrefsInDirList(
+ 
+     nsCAutoString leaf;
+     path->GetNativeLeafName(leaf);
+ 
+     // Do we care if a file provided by this process fails to load?
+     if (Substring(leaf, leaf.Length() - 4).Equals(NS_LITERAL_CSTRING(".xpi")))
+       ReadExtensionPrefs(path);
+     else
+-      pref_LoadPrefsInDir(path, nsnull, 0);
++      pref_LoadPrefsInDir(path, specialFiles, NS_ARRAY_LENGTH(specialFiles));
    }
    return NS_OK;
  }
  
  static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
-@@ -1051,28 +1070,40 @@ static nsresult pref_InitInitialObjects(
+ {
+   nsZipItemPtr<char> manifest(jarReader, name, true);
+   NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
+@@ -1062,28 +1081,40 @@ static nsresult pref_InitInitialObjects(
    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    static const char* specialFiles[] = {
  #if defined(XP_MACOSX)
@@ -139,17 +143,18 @@
 diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in
 --- a/toolkit/components/downloads/Makefile.in
 +++ b/toolkit/components/downloads/Makefile.in
-@@ -75,8 +75,10 @@ EXTRA_COMPONENTS = \
+@@ -73,8 +73,11 @@ EXTRA_COMPONENTS = \
+   nsDownloadManagerUI.js \
+   nsDownloadManagerUI.manifest \
    $(NULL)
  endif
  
- ifdef ENABLE_TESTS
- DIRS += test
- endif
+ TEST_DIRS += test
  
  include $(topsrcdir)/config/rules.mk
 +
 +LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
++
 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
@@ -174,7 +179,7 @@
  #include "AndroidBridge.h"
  #endif
  
-@@ -2214,16 +2218,25 @@ nsDownload::SetState(DownloadState aStat
+@@ -2221,16 +2225,25 @@ nsDownload::SetState(DownloadState aStat
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
  
        // Master pref to control this function.
@@ -200,7 +205,7 @@
          PRInt64 goat = PR_Now() - mStartTime;
          showTaskbarAlert = goat > alertIntervalUSec;
  
-@@ -2247,19 +2260,20 @@ nsDownload::SetState(DownloadState aStat
+@@ -2254,19 +2267,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
@@ -225,7 +230,7 @@
 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
 --- a/toolkit/content/jar.mn
 +++ b/toolkit/content/jar.mn
-@@ -40,29 +40,33 @@ toolkit.jar:
+@@ -44,29 +44,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)
@@ -2092,8 +2097,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
-@@ -45,16 +45,18 @@
- #include "nsReadableUtils.h"
+@@ -46,16 +46,18 @@
  #include "nsArrayUtils.h"
  #include "prnetdb.h"
  #include "prenv.h"
@@ -2101,6 +2105,7 @@
  #include "nsNetUtil.h"
  #include "nsISupportsPrimitives.h"
  #include "nsIGSettingsService.h"
+ #include "nsInterfaceHashtable.h"
 +#include "nsVoidArray.h"
 +#include "nsKDEUtils.h"
  
@@ -2111,10 +2116,10 @@
  
    nsUnixSystemProxySettings() {}
    nsresult Init();
-@@ -64,16 +66,17 @@ private:
-   
-   nsCOMPtr<nsIGConfService> mGConf;
+@@ -67,16 +69,17 @@ private:
    nsCOMPtr<nsIGSettingsService> mGSettings;
+   nsCOMPtr<nsIGSettingsCollection> mProxySettings;
+   nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection> mSchemeProxySettings;
    bool IsProxyMode(const char* aMode);
    nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult);
    nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult);
@@ -2129,7 +2134,7 @@
  nsUnixSystemProxySettings::Init()
  {
    // If this is a GNOME session, load gconf and try to use its preferences.
-@@ -526,16 +529,19 @@ nsUnixSystemProxySettings::GetProxyForUR
+@@ -529,16 +532,19 @@ nsUnixSystemProxySettings::GetProxyForUR
    nsCAutoString host;
    rv = aURI->GetHost(host);
    NS_ENSURE_SUCCESS(rv, rv);
@@ -2141,7 +2146,7 @@
 +  if( nsKDEUtils::kdeSupport())
 +    return GetProxyFromKDE(scheme, host, port, aResult);
 +
-   if (mGSettings) {
+   if (mProxySettings) {
      rv = GetProxyFromGSettings(scheme, host, port, aResult);
      if (rv == NS_OK)
        return rv;
@@ -2149,7 +2154,7 @@
    if (mGConf)
      return GetProxyFromGConf(scheme, host, port, aResult);
  
-@@ -561,8 +567,34 @@ static const mozilla::Module::ContractID
+@@ -564,8 +570,34 @@ static const mozilla::Module::ContractID
  
  static const mozilla::Module kUnixProxyModule = {
    mozilla::Module::kVersion,
@@ -2673,7 +2678,7 @@
 diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in
 --- a/uriloader/exthandler/Makefile.in
 +++ b/uriloader/exthandler/Makefile.in
-@@ -92,18 +92,19 @@ LOCAL_INCLUDES = -I$(srcdir)
+@@ -90,18 +90,19 @@ LOCAL_INCLUDES = -I$(srcdir)
  LOCAL_INCLUDES += -I$(topsrcdir)/dom/base \
              -I$(topsrcdir)/dom/ipc \
              -I$(topsrcdir)/content/base/src \
@@ -3250,7 +3255,7 @@
 diff --git a/widget/gtk2/Makefile.in b/widget/gtk2/Makefile.in
 --- a/widget/gtk2/Makefile.in
 +++ b/widget/gtk2/Makefile.in
-@@ -135,11 +135,14 @@ DEFINES		+= -DCAIRO_GFX
+@@ -135,11 +135,14 @@ DEFINES		+= -DCAIRO_GFX -DMOZ_APP_NAME='
  
  INCLUDES	+= \
  		-I$(srcdir)/../xpwidgets \
@@ -3604,7 +3609,7 @@
 diff --git a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in
 --- a/xpcom/components/Makefile.in
 +++ b/xpcom/components/Makefile.in
-@@ -92,10 +92,11 @@ LOCAL_INCLUDES	= \
+@@ -91,10 +91,11 @@ LOCAL_INCLUDES	= \
  # we don't want the shared lib, but we want to force the creation of a static lib.
  FORCE_STATIC_LIB = 1
  
@@ -3619,134 +3624,134 @@
 diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp
 --- a/xpcom/components/ManifestParser.cpp
 +++ b/xpcom/components/ManifestParser.cpp
-@@ -62,16 +62,17 @@
- #include "nsTextFormatter.h"
- #include "nsVersionComparator.h"
- #include "nsXPCOMCIDInternal.h"
- 
- #include "nsIConsoleService.h"
- #include "nsIScriptError.h"
- #include "nsIXULAppInfo.h"
- #include "nsIXULRuntime.h"
-+#include "nsKDEUtils.h"
- 
- using namespace mozilla;
- 
- struct ManifestDirective
- {
-   const char* directive;
-   int argc;
- 
-@@ -429,16 +430,17 @@ ParseManifest(NSLocationType type, FileL
-   NS_NAMED_LITERAL_STRING(kPlatform, "platform");
-   NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible");
-   NS_NAMED_LITERAL_STRING(kApplication, "application");
-   NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
-   NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
-   NS_NAMED_LITERAL_STRING(kOs, "os");
-   NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
-   NS_NAMED_LITERAL_STRING(kABI, "abi");
-+  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
- #if defined(MOZ_WIDGET_ANDROID)
-   NS_NAMED_LITERAL_STRING(kTablet, "tablet");
- #endif
- 
-   // Obsolete
-   NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers");
- 
-   nsAutoString appID;
-@@ -476,41 +478,46 @@ ParseManifest(NSLocationType type, FileL
-         CopyUTF8toUTF16(s, abi);
-         abi.Insert(PRUnichar('_'), 0);
-         abi.Insert(osTarget, 0);
-       }
-     }
-   }
- 
-   nsAutoString osVersion;
-+  nsAutoString desktop;
- #if defined(XP_WIN)
-   OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
-   if (GetVersionEx(&info)) {
-     nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
-                                          info.dwMajorVersion,
-                                          info.dwMinorVersion);
-   }
-+  desktop = NS_LITERAL_STRING("win");
- #elif defined(MOZ_WIDGET_COCOA)
-   SInt32 majorVersion, minorVersion;
-   if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
-       (Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
-     nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
-                                          majorVersion,
-                                          minorVersion);
-   }
-+  desktop = NS_LITERAL_STRING("macosx");
- #elif defined(MOZ_WIDGET_GTK2)
-   nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
-                                        gtk_major_version,
-                                        gtk_minor_version);
-+  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
- #elif defined(MOZ_WIDGET_ANDROID)
-   bool isTablet = false;
-   if (mozilla::AndroidBridge::Bridge()) {
-     mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", osVersion);
-     isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
-   }
-+  desktop = NS_LITERAL_STRING("android");
- #endif
- 
-   // Because contracts must be registered after CIDs, we save and process them
-   // at the end.
-   nsTArray<CachedDirective> contracts;
- 
-   char *token;
-   char *newline = buf;
-@@ -592,24 +599,26 @@ ParseManifest(NSLocationType type, FileL
-     TriState stOsVersion = eUnspecified;
-     TriState stOs = eUnspecified;
-     TriState stABI = eUnspecified;
- #if defined(MOZ_WIDGET_ANDROID)
-     TriState stTablet = eUnspecified;
- #endif
-     bool platform = false;
-     bool contentAccessible = false;
-+    TriState stDesktop = eUnspecified;
- 
-     while (NULL != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) {
-       ToLowerCase(token);
-       NS_ConvertASCIItoUTF16 wtoken(token);
- 
-       if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
-           CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
-           CheckStringFlag(kABI, wtoken, abi, stABI) ||
-+          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
-           CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
-           CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
-           CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion))
-         continue;
- 
- #if defined(MOZ_WIDGET_ANDROID)
-       bool tablet = false;
-       if (CheckFlag(kTablet, wtoken, tablet)) {
-@@ -638,16 +647,17 @@ ParseManifest(NSLocationType type, FileL
-     }
- 
-     if (!ok ||
-         stApp == eBad ||
-         stAppVersion == eBad ||
-         stGeckoVersion == eBad ||
-         stOs == eBad ||
-         stOsVersion == eBad ||
-+        stDesktop == eBad ||
- #ifdef MOZ_WIDGET_ANDROID
-         stTablet == eBad ||
- #endif
-         stABI == eBad)
-       continue;
- 
-     if (directive->regfunc) {
-       if (GeckoProcessType_Default != XRE_GetProcessType())
+@@ -63,16 +63,17 @@
+ #include "nsTextFormatter.h"
+ #include "nsVersionComparator.h"
+ #include "nsXPCOMCIDInternal.h"
+ 
+ #include "nsIConsoleService.h"
+ #include "nsIScriptError.h"
+ #include "nsIXULAppInfo.h"
+ #include "nsIXULRuntime.h"
++#include "nsKDEUtils.h"
+ 
+ using namespace mozilla;
+ 
+ struct ManifestDirective
+ {
+   const char* directive;
+   int argc;
+ 
+@@ -430,16 +431,17 @@ ParseManifest(NSLocationType type, FileL
+   NS_NAMED_LITERAL_STRING(kPlatform, "platform");
+   NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible");
+   NS_NAMED_LITERAL_STRING(kApplication, "application");
+   NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
+   NS_NAMED_LITERAL_STRING(kGeckoVersion, "platformversion");
+   NS_NAMED_LITERAL_STRING(kOs, "os");
+   NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
+   NS_NAMED_LITERAL_STRING(kABI, "abi");
++  NS_NAMED_LITERAL_STRING(kDesktop, "desktop");
+ #if defined(MOZ_WIDGET_ANDROID)
+   NS_NAMED_LITERAL_STRING(kTablet, "tablet");
+ #endif
+ 
+   // Obsolete
+   NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers");
+ 
+   nsAutoString appID;
+@@ -477,41 +479,46 @@ ParseManifest(NSLocationType type, FileL
+         CopyUTF8toUTF16(s, abi);
+         abi.Insert(PRUnichar('_'), 0);
+         abi.Insert(osTarget, 0);
+       }
+     }
+   }
+ 
+   nsAutoString osVersion;
++  nsAutoString desktop;
+ #if defined(XP_WIN)
+   OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
+   if (GetVersionEx(&info)) {
+     nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
+                                          info.dwMajorVersion,
+                                          info.dwMinorVersion);
+   }
++  desktop = NS_LITERAL_STRING("win");
+ #elif defined(MOZ_WIDGET_COCOA)
+   SInt32 majorVersion, minorVersion;
+   if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) &&
+       (Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) {
+     nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
+                                          majorVersion,
+                                          minorVersion);
+   }
++  desktop = NS_LITERAL_STRING("macosx");
+ #elif defined(MOZ_WIDGET_GTK2)
+   nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(),
+                                        gtk_major_version,
+                                        gtk_minor_version);
++  desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome");
+ #elif defined(MOZ_WIDGET_ANDROID)
+   bool isTablet = false;
+   if (mozilla::AndroidBridge::Bridge()) {
+     mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build$VERSION", "RELEASE", osVersion);
+     isTablet = mozilla::AndroidBridge::Bridge()->IsTablet();
+   }
++  desktop = NS_LITERAL_STRING("android");
+ #endif
+ 
+   // Because contracts must be registered after CIDs, we save and process them
+   // at the end.
+   nsTArray<CachedDirective> contracts;
+ 
+   char *token;
+   char *newline = buf;
+@@ -593,24 +600,26 @@ ParseManifest(NSLocationType type, FileL
+     TriState stOsVersion = eUnspecified;
+     TriState stOs = eUnspecified;
+     TriState stABI = eUnspecified;
+ #if defined(MOZ_WIDGET_ANDROID)
+     TriState stTablet = eUnspecified;
+ #endif
+     bool platform = false;
+     bool contentAccessible = false;
++    TriState stDesktop = eUnspecified;
+ 
+     while (NULL != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) {
+       ToLowerCase(token);
+       NS_ConvertASCIItoUTF16 wtoken(token);
+ 
+       if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
+           CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
+           CheckStringFlag(kABI, wtoken, abi, stABI) ||
++          CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) ||
+           CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
+           CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
+           CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion))
+         continue;
+ 
+ #if defined(MOZ_WIDGET_ANDROID)
+       bool tablet = false;
+       if (CheckFlag(kTablet, wtoken, tablet)) {
+@@ -639,16 +648,17 @@ ParseManifest(NSLocationType type, FileL
+     }
+ 
+     if (!ok ||
+         stApp == eBad ||
+         stAppVersion == eBad ||
+         stGeckoVersion == eBad ||
+         stOs == eBad ||
+         stOsVersion == eBad ||
++        stDesktop == eBad ||
+ #ifdef MOZ_WIDGET_ANDROID
+         stTablet == eBad ||
+ #endif
+         stABI == eBad)
+       continue;
+ 
+     if (directive->regfunc) {
+       if (GeckoProcessType_Default != XRE_GetProcessType())
 diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in
 --- a/xpcom/io/Makefile.in
 +++ b/xpcom/io/Makefile.in
@@ -3790,7 +3795,7 @@
  #include "prmem.h"
  #include "plbase64.h"
  
-@@ -1795,44 +1796,51 @@ nsLocalFile::SetPersistentDescriptor(con
+@@ -1796,44 +1797,51 @@ nsLocalFile::SetPersistentDescriptor(con
      return InitWithNativePath(aPersistentDescriptor);
  #endif
  }
@@ -3856,7 +3861,7 @@
        return rv;
      }
      return NS_ERROR_FAILURE;
-@@ -1858,16 +1866,23 @@ nsLocalFile::Launch()
+@@ -1859,16 +1867,23 @@ nsLocalFile::Launch()
  
      if (nsnull == connection)
        return NS_ERROR_FAILURE;