patch status 20091128
authorWolfgang Rosenauer <wr@rosenauer.org>
Sat, 28 Nov 2009 13:56:10 +0100
changeset 0 ad87c5e85a41
child 1 045edd78eceb
patch status 20091128
.hgignore
firefox-appname.patch
firefox-cross-desktop.patch
firefox-linkorder
idldir.patch
mozilla-helper-app.patch
mozilla-libproxy.patch
mozilla-nongnome-proxies.patch
series
toolkit-download-folder.patch
widgetproperty
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,5 @@
+^\.hg
+^\.mq
+syntax: glob
+status
+guards
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firefox-appname.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,26 @@
+diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp
+--- a/browser/components/shell/src/nsGNOMEShellService.cpp
++++ b/browser/components/shell/src/nsGNOMEShellService.cpp
+@@ -127,17 +127,21 @@ nsGNOMEShellService::Init()
+   nsCOMPtr<nsILocalFile> appPath;
+   rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile),
+                    getter_AddRefs(appPath));
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
+   rv = appPath->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_NAME));
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
+-  return appPath->GetNativePath(mAppPath);
++  /* This path to firefox is hardcoded for the default path setting */
++  mAppPath.Assign ("/usr/bin/firefox");
++  
++  //return appPath->GetNativePath(mAppPath);
++  return NS_OK;
+ }
+ 
+ NS_IMPL_ISUPPORTS1(nsGNOMEShellService, nsIShellService)
+ 
+ PRBool
+ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
+ {
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firefox-cross-desktop.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,69 @@
+From: Wolfgang Rosenauer
+Subject: NonGnome/KDE integration
+References:
+https://bugzilla.novell.com/show_bug.cgi?id=170055
+Caveats: desktop file name of Firefox is hardcoded to MozillaFirefox
+
+diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js
+--- a/browser/base/content/nsContextMenu.js
++++ b/browser/base/content/nsContextMenu.js
+@@ -210,13 +210,15 @@ nsContextMenu.prototype = {
+     // Set as Desktop background depends on whether an image was clicked on,
+     // and only works if we have a shell service.
+     var haveSetDesktopBackground = false;
+ #ifdef HAVE_SHELL_SERVICE
+     // Only enable Set as Desktop Background if we can get the shell service.
+     var shell = getShellService();
+-    if (shell)
++    var env = Components.classes["@mozilla.org/process/environment;1"]
++                        .getService(Components.interfaces.nsIEnvironment);
++    if (shell && env.get('DESKTOP_SESSION') == "gnome")
+       haveSetDesktopBackground = true;
+ #endif
+     this.showItem("context-setDesktopBackground",
+                   haveSetDesktopBackground && this.onLoadedImage);
+ 
+     if (haveSetDesktopBackground && this.onLoadedImage) {
+diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js
+--- a/browser/components/preferences/advanced.js
++++ b/browser/components/preferences/advanced.js
+@@ -594,20 +594,38 @@ var gAdvancedPane = {
+     var brandShortName = brandBundle.getString("brandShortName");
+     var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
+     var promptMessage;
+     const IPS = Components.interfaces.nsIPromptService;
+     var psvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                          .getService(IPS);
++
++    var env = Components.classes["@mozilla.org/process/environment;1"]
++                        .getService(Components.interfaces.nsIEnvironment);
++    var kde_session = 0;
++    if (env.get('KDE_FULL_SESSION') == "true")
++      kde_session = 1;
++     
+     if (!shellSvc.isDefaultBrowser(false)) {
+       promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage", 
+                                                      [brandShortName]);
+       var rv = psvc.confirmEx(window, promptTitle, promptMessage, 
+                               IPS.STD_YES_NO_BUTTONS,
+                               null, null, null, null, { });
+-      if (rv == 0)
++      if (rv == 0) {
+         shellSvc.setDefaultBrowser(true, false);
++        if (kde_session == 1) {
++          var shellObj = Components.classes["@mozilla.org/file/local;1"]
++                                   .createInstance(Components.interfaces.nsILocalFile);
++          shellObj.initWithPath("/usr/bin/kwriteconfig");
++          var process = Components.classes["@mozilla.org/process/util;1"]
++                                  .createInstance(Components.interfaces.nsIProcess);
++          process.init(shellObj);
++          var args = ["--file", "kdeglobals", "--group", "General", "--key", "BrowserApplication", "MozillaFirefox"];
++          process.run(false, args, args.length);
++        }
++      }
+     }
+     else {
+       promptMessage = shellBundle.getFormattedString("alreadyDefaultBrowser",
+                                                      [brandShortName]);
+       psvc.alert(window, promptTitle, promptMessage);
+     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firefox-linkorder	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,26 @@
+diff --git a/browser/components/build/Makefile.in b/browser/components/build/Makefile.in
+--- a/browser/components/build/Makefile.in
++++ b/browser/components/build/Makefile.in
+@@ -78,19 +78,21 @@ LOCAL_INCLUDES += -I$(srcdir)/../migrati
+ SHARED_LIBRARY_LIBS += ../migration/src/$(LIB_PREFIX)migration_s.$(LIB_SUFFIX)
+ EXTRA_DSO_LDOPTS += $(LIBXUL_DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX)
+ endif
+ 
+ # This has to come after the above chunk, because mozreg_s has dependencies on
+ # stuff in MOZ_COMPONENT_LIBS.
+ EXTRA_DSO_LDOPTS += \
+ 	$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
+-	$(MOZ_COMPONENT_LIBS) \
+ 	$(NULL)
+ 
++# if built with --as-needed the NSPR libs need to be linked after mozreg_s
++EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
++
+ # Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code)
+ # GTK2: Need to link with glib for GNOME shell service
+ ifneq (,$(filter mac cocoa gtk2,$(MOZ_WIDGET_TOOLKIT)))
+ EXTRA_DSO_LDOPTS += \
+   $(TK_LIBS) \
+   $(NULL)
+ endif
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/idldir.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,21 @@
+From: Wolfgang Rosenauer <stark@suse.de>
+Subject: fix IDL installation dir 
+
+This is only needed to get the correct path in xulrunner-config
+
+Index: config/autoconf.mk.in
+===================================================================
+RCS file: /cvsroot/mozilla/config/autoconf.mk.in,v
+retrieving revision 3.449
+diff -u -r3.449 autoconf.mk.in
+--- config/autoconf.mk.in	16 Feb 2008 22:23:08 -0000	3.449
++++ b/config/autoconf.mk.in	19 Feb 2008 14:07:13 -0000
+@@ -62,7 +62,7 @@
+ libdir		= @libdir@
+ datadir		= @datadir@
+ mandir		= @mandir@
+-idldir		= $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
++idldir		= $(includedir)
+ 
+ installdir	= $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+ sdkdir		= $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-helper-app.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,78 @@
+From: Wolfgang Rosenauer <wr@rosenauer.org>
+Subject: no helper app for application/octet-stream but recognized extensions
+References:
+https://bugzilla.novell.com/show_bug.cgi?id=406979
+https://bugzilla.mozilla.org/show_bug.cgi?id=327323
+
+
+diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
++++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+@@ -47,6 +47,7 @@
+ #include "nsMIMEInfoUnix.h"
+ #include "nsGNOMERegistry.h"
+ #include "nsIGnomeVFSService.h"
++#include "nsAutoPtr.h"
+ #ifdef MOZ_ENABLE_DBUS
+ #include "nsDBusHandlerApp.h"
+ #endif
+@@ -74,13 +75,16 @@ NS_IMETHODIMP
+ nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
+ {
+   *_retval = PR_FALSE;
+-  nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
+-  if (vfs) {
+-    nsCOMPtr<nsIGnomeVFSMimeApp> app;
+-    if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
+-      *_retval = PR_TRUE;
++  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mType);
++  if (!mimeInfo) {
++    nsCAutoString ext;
++    GetPrimaryExtension(ext);
++    mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
+   }
+ 
++  if (mimeInfo)
++    *_retval = PR_TRUE;
++
+   if (*_retval)
+     return NS_OK;
+ 
+@@ -113,6 +117,16 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
+     nsCOMPtr<nsIGnomeVFSMimeApp> app;
+     if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
+       return app->Launch(nativePath);
++
++    // If we haven't got an app we try to get a valid one by searching for the
++    // extension mapped type
++    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
++    if (mimeInfo) {
++      nsCAutoString type;
++      mimeInfo->GetType(type);
++      if (NS_SUCCEEDED(vfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
++        return app->Launch(nativePath);
++    }
+   }
+ 
+   if (!mDefaultApplication)
+diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
++++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+@@ -1580,8 +1580,16 @@ nsOSHelperAppService::GetMIMEInfoFromOS(
+       return retval;
+     }
+ 
+-    // Copy the attributes of retval onto miByExt, to return it
++    // Copy the attributes of retval (mimeinfo from type) onto miByExt, to
++    // return it 
++    // but reset to just collected mDefaultAppDescription (from ext)
++    // and preserve the primary extension as well
++    nsAutoString byExtDefault;
++    miByExt->GetDefaultDescription(byExtDefault);
++    retval->SetDefaultDescription(byExtDefault);
+     retval->CopyBasicDataTo(miByExt);
++    if (!aFileExt.IsEmpty())
++      miByExt->SetPrimaryExtension(aFileExt);
+ 
+     miByExt.swap(retval);
+   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-libproxy.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,339 @@
+From: Wolfgang Rosenauer <wr@rosenauer.org>
+Subject: Add the option to use libproxy for system proxy settings
+References:
+https://bugzilla.mozilla.org/show_bug.cgi?id=517655
+
+diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
+--- a/config/autoconf.mk.in
++++ b/config/autoconf.mk.in
+@@ -537,16 +537,20 @@ FT2_CFLAGS             = @FT2_CFLAGS@
+ FT2_LIBS               = @FT2_LIBS@
+ 
+ MOZ_PANGO_CFLAGS        = @MOZ_PANGO_CFLAGS@
+ MOZ_PANGO_LIBS          = @MOZ_PANGO_LIBS@
+ 
+ MOZ_XIE_LIBS		= @MOZ_XIE_LIBS@
+ XT_LIBS			= @XT_LIBS@
+ 
++MOZ_LIBPROXY_CFLAGS     = @MOZ_LIBPROXY_CFLAGS@
++MOZ_LIBPROXY_LIBS       = @MOZ_LIBPROXY_LIBS@
++MOZ_ENABLE_LIBPROXY     = @MOZ_ENABLE_LIBPROXY@
++
+ MOZ_LIBNOTIFY_CFLAGS	= @MOZ_LIBNOTIFY_CFLAGS@
+ MOZ_LIBNOTIFY_LIBS	= @MOZ_LIBNOTIFY_LIBS@
+ MOZ_ENABLE_LIBNOTIFY	= @MOZ_ENABLE_LIBNOTIFY@
+ 
+ GLIB_CFLAGS	= @GLIB_CFLAGS@
+ GLIB_LIBS	= @GLIB_LIBS@
+ GLIB_GMODULE_LIBS	= @GLIB_GMODULE_LIBS@
+ LIBIDL_CFLAGS = @LIBIDL_CFLAGS@
+diff --git a/config/system-headers b/config/system-headers
+--- a/config/system-headers
++++ b/config/system-headers
+@@ -1007,15 +1007,19 @@ libsn/sn-monitor.h
+ libsn/sn-util.h
+ #endif
+ #if MOZ_NATIVE_HUNSPELL==1
+ hunspell.hxx
+ #endif
+ #if MOZ_NATIVE_BZ2==1
+ bzlib.h
+ #endif
++#ifdef MOZ_ENABLE_LIBPROXY
++proxy.h
++#endif
++
+ #ifdef MOZ_PLATFORM_HILDON
+ hildon-uri.h
+ hildon-mime.h
+ #endif
+ #ifdef NS_OSSO
+ libosso.h
+ #endif
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -5280,16 +5280,39 @@ then
+         AC_DEFINE(MOZ_ENABLE_DBUS)
+     fi
+ fi
+ AC_SUBST(MOZ_ENABLE_DBUS)
+ AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
+ AC_SUBST(MOZ_DBUS_GLIB_LIBS)
+ 
+ dnl ========================================================
++dnl = libproxy support
++dnl ========================================================
++
++if test "$MOZ_ENABLE_GTK2"
++then
++    MOZ_ENABLE_LIBPROXY=
++
++    MOZ_ARG_ENABLE_BOOL(libproxy,
++    [  --enable-libproxy         Enable libproxy support ],
++    MOZ_ENABLE_LIBPROXY=1,
++    MOZ_ENABLE_LIBPROXY=)
++
++    if test "$MOZ_ENABLE_LIBPROXY"
++    then
++        PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
++        AC_DEFINE(MOZ_ENABLE_LIBPROXY)
++    fi
++fi
++AC_SUBST(MOZ_ENABLE_LIBPROXY)
++AC_SUBST(MOZ_LIBPROXY_CFLAGS)
++AC_SUBST(MOZ_LIBPROXY_LIBS)
++
++dnl ========================================================
+ dnl = libnotify support
+ dnl ========================================================
+ 
+ if test "$MOZ_ENABLE_GTK2"
+ then
+     MOZ_ENABLE_LIBNOTIFY=1
+ 
+     MOZ_ARG_DISABLE_BOOL(libnotify,
+diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
+--- a/toolkit/library/Makefile.in
++++ b/toolkit/library/Makefile.in
+@@ -247,16 +247,20 @@ endif
+ ifdef MOZ_TREE_FREETYPE
+ EXTRA_DSO_LDOPTS += $(FT2_LIBS)
+ endif
+ 
+ ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
+ EXTRA_DSO_LDOPTS += $(MOZ_STARTUP_NOTIFICATION_LIBS)
+ endif
+ 
++ifdef MOZ_ENABLE_LIBPROXY
++EXTRA_DSO_LDOPTS += $(MOZ_LIBPROXY_LIBS)
++endif
++
+ ifeq ($(OS_ARCH),BeOS)
+ EXTRA_DSO_LDOPTS += -lbe -ltracker
+ endif
+ 
+ ifeq ($(OS_ARCH),SunOS)
+ EXTRA_DSO_LDOPTS += -lelf -ldemangle -lCstd
+ endif
+ 
+diff --git a/toolkit/system/unixproxy/Makefile.in b/toolkit/system/unixproxy/Makefile.in
+--- a/toolkit/system/unixproxy/Makefile.in
++++ b/toolkit/system/unixproxy/Makefile.in
+@@ -15,16 +15,17 @@
+ #
+ # The Initial Developer of the Original Code is
+ # IBM Corporation.
+ # Portions created by the Initial Developer are Copyright (C) 2004
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
+ #  Brian Ryner <bryner@brianryner.com>
++#  Wolfgang Rosenauer <wr@rosenauer.org>
+ #
+ # Alternatively, the contents of this file may be used under the terms of
+ # either the GNU General Public License Version 2 or later (the "GPL"), or
+ # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ # in which case the provisions of the GPL or the LGPL are applicable instead
+ # of those above. If you wish to allow use of your version of this file only
+ # under the terms of either the GPL or the LGPL, and not to allow others to
+ # use your version of this file under the terms of the MPL, indicate your
+@@ -53,15 +54,30 @@ LIBXUL_LIBRARY  = 1
+ 
+ REQUIRES = \
+         xpcom \
+         string \
+         necko \
+         mozgnome \
+         $(NULL)
+ 
+-EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
++EXTRA_DSO_LDOPTS += \
++               $(MOZ_LIBPROXY_LIBS) \
++               $(MOZ_COMPONENT_LIBS) \
++               $(NULL)
++
++ifdef MOZ_ENABLE_LIBPROXY
++
++CPPSRCS = \
++       nsLibProxySettings.cpp \
++        $(NULL)
++
++CXXFLAGS += $(MOZ_LIBPROXY_CFLAGS)
++
++else # MOZ_ENABLE_LIBPROXY
+ 
+ CPPSRCS = \
+         nsUnixSystemProxySettings.cpp \
+         $(NULL)
+ 
++endif # MOZ_ENABLE_LIBPROXY
++
+ include $(topsrcdir)/config/rules.mk
+diff --git a/toolkit/system/unixproxy/nsLibProxySettings.cpp b/toolkit/system/unixproxy/nsLibProxySettings.cpp
+new file mode 100644
+--- /dev/null
++++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
+@@ -0,0 +1,162 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is Mozilla libproxy integration code.
++ *
++ * The Initial Developer of the Original Code is
++ * Wolfgang Rosenauer <wr@rosenauer.org>.
++ * Portions created by the Initial Developer are Copyright (C) 2009
++ * the Initial Developer. All Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * Alternatively, the contents of this file may be used under the terms of
++ * either the GNU General Public License Version 2 or later (the "GPL"), or
++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++ * in which case the provisions of the GPL or the LGPL are applicable instead
++ * of those above. If you wish to allow use of your version of this file only
++ * under the terms of either the GPL or the LGPL, and not to allow others to
++ * use your version of this file under the terms of the MPL, indicate your
++ * decision by deleting the provisions above and replace them with the notice
++ * and other provisions required by the GPL or the LGPL. If you do not delete
++ * the provisions above, a recipient may use your version of this file under
++ * the terms of any one of the MPL, the GPL or the LGPL.
++ *
++ * ***** END LICENSE BLOCK ***** */
++
++#include "nsISystemProxySettings.h"
++#include "nsIGenericFactory.h"
++#include "nsIServiceManager.h"
++#include "nsIIOService.h"
++#include "nsIURI.h"
++#include "nsString.h"
++#include "nsNetUtil.h"
++#include "nsCOMPtr.h"
++#include "nspr.h"
++
++#include <proxy.h>
++
++class nsUnixSystemProxySettings : public nsISystemProxySettings {
++public:
++  NS_DECL_ISUPPORTS
++  NS_DECL_NSISYSTEMPROXYSETTINGS
++
++  nsUnixSystemProxySettings() {}
++  nsresult Init();
++
++private:
++  ~nsUnixSystemProxySettings() {
++    if (mProxyFactory) 
++      px_proxy_factory_free(mProxyFactory); 
++  }
++
++  pxProxyFactory *mProxyFactory;
++  nsCOMPtr<nsIIOService> mIOService;
++};
++
++NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
++
++nsresult
++nsUnixSystemProxySettings::Init()
++{
++  mProxyFactory = nsnull;
++  return NS_OK;
++}
++
++nsresult
++nsUnixSystemProxySettings::GetPACURI(nsACString& aResult)
++{
++  // Make sure we return an empty result.
++  aResult.Truncate();
++  return NS_OK;
++}
++
++nsresult
++nsUnixSystemProxySettings::GetProxyForURI(nsIURI* aURI, nsACString& aResult)
++{
++  nsresult rv;
++
++  if (!mProxyFactory) {
++    mProxyFactory = px_proxy_factory_new();
++  }
++  NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_OUT_OF_MEMORY);
++
++  if (!mIOService) {
++    mIOService = do_GetIOService();
++  }
++  NS_ENSURE_TRUE(mIOService, NS_ERROR_FAILURE);
++
++  nsCAutoString spec;
++  rv = aURI->GetSpec(spec);
++  NS_ENSURE_SUCCESS(rv, rv);
++
++  char **proxyArray = nsnull;
++  proxyArray = px_proxy_factory_get_proxies(mProxyFactory, (char*)(spec.get()));
++  NS_ENSURE_TRUE(proxyArray, NS_ERROR_FAILURE);
++
++  // PAC string accepts
++  // http, proxy, socks, socks4, socks5, direct, unknown
++  // example: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT"
++  int c = 0;
++  while (proxyArray[c] != NULL) {
++    if (c != 0) {
++      aResult.AppendLiteral("; ");
++    }
++
++    PRBool isScheme = PR_FALSE;
++    nsXPIDLCString schemeString;
++    nsXPIDLCString hostPortString;
++    nsCOMPtr<nsIURI> proxyURI;
++
++    rv = mIOService->NewURI(nsDependentCString(proxyArray[c]), 
++                                               nsnull, 
++                                               nsnull, 
++                                               getter_AddRefs(proxyURI));
++    NS_ENSURE_SUCCESS(rv, rv);
++
++    proxyURI->GetScheme(schemeString);
++    if (NS_SUCCEEDED(proxyURI->SchemeIs("http", &isScheme)) && isScheme) {
++      schemeString.AssignLiteral("proxy");
++    }
++    aResult.Append(schemeString);
++    if (NS_SUCCEEDED(proxyURI->SchemeIs("direct", &isScheme)) && !isScheme) {
++      // Add the proxy URI only if it's not DIRECT
++      proxyURI->GetHostPort(hostPortString);
++      aResult.AppendLiteral(" ");
++      aResult.Append(hostPortString);
++    }
++
++    c++;
++  }
++
++printf("returned PAC proxy string: %s\n", PromiseFlatCString(aResult).get());
++
++  PR_Free(proxyArray);
++  return NS_OK;
++}
++
++#define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
++     { 0x0fa3158c, 0xd5a7, 0x43de, \
++       {0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 } }
++
++NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
++
++static const nsModuleComponentInfo components[] = {
++  { "Unix System Proxy Settings Service",
++    NS_UNIXSYSTEMPROXYSERVICE_CID,
++    NS_SYSTEMPROXYSETTINGS_CONTRACTID,
++    nsUnixSystemProxySettingsConstructor }
++};
++
++NS_IMPL_NSGETMODULE(nsUnixProxyModule, components)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-nongnome-proxies.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,32 @@
+From: Wolfgang Rosenauer
+Subject: Do not use gconf for proxy settings if not running within Gnome
+
+
+Index: toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+===================================================================
+RCS file: /cvsroot/mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp,v
+retrieving revision 1.1
+diff -u -p -6 -r1.1 nsUnixSystemProxySettings.cpp
+--- toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	29 Jan 2008 15:58:41 -0000	1.1
++++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp	17 Apr 2008 19:02:19 -0000
+@@ -69,13 +69,19 @@ private:
+ 
+ NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
+ 
+ nsresult
+ nsUnixSystemProxySettings::Init()
+ {
+-  mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
++  // If this is a GNOME session, load gconf and try to use its preferences.
++  // If gconf is not available (which would be stupid) we'll proceed as if
++  // this was not a GNOME session, using *_PROXY environment variables.
++  const char* sessionType = PR_GetEnv("DESKTOP_SESSION");
++  if (sessionType && !strcmp(sessionType, "gnome")) {
++    mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
++  }
+   return NS_OK;
+ }
+ 
+ PRBool
+ nsUnixSystemProxySettings::IsProxyMode(const char* aMode)
+ {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/series	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,16 @@
+toolkit-download-folder.patch
+mozilla-libproxy.patch
+mozilla-pkgconfig.patch
+idldir.patch
+mozilla-nongnome-proxies.patch
+mozilla-helper-app.patch
+mozilla-prefer_plugin_pref.patch
+mozilla-shared-nss-db.patch
+mozilla-startup-notification.patch
+firefox-libxul-sdk.patch
+firefox-credits.patch
+firefox-linkorder.patch
+firefox-browser-css.patch
+firefox-cross-desktop.patch
+firefox-no-gnomevfs.patch
+firefox-appname.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolkit-download-folder.patch	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,33 @@
+From: Wolfgang Rosenauer
+Subject: Don't use localized Downloads unless XDG is set up
+References:
+https://bugzilla.novell.com/show_bug.cgi?id=501724
+
+diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
+--- a/browser/components/preferences/main.js
++++ b/browser/components/preferences/main.js
+@@ -344,7 +344,7 @@ var gMainPane = {
+       // With 3.0, a new desktop folder - 'Downloads' was introduced for
+       // platforms and versions that don't support a default system downloads
+       // folder. See nsDownloadManager for details. 
+-      downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
++      downloadFolder.label = "Downloads";
+       iconUrlSpec = fph.getURLSpecFromFile(this._indexToFolder(1));
+     } else {
+       // 'Desktop'
+diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp
+--- a/toolkit/components/downloads/src/nsDownloadManager.cpp
++++ b/toolkit/components/downloads/src/nsDownloadManager.cpp
+@@ -1269,8 +1269,10 @@ nsDownloadManager::GetDefaultDownloadsDi
+   // XDG user dir spec, with a fallback to Home/Downloads
+ 
+   nsXPIDLString folderName;
+-  mBundle->GetStringFromName(NS_LITERAL_STRING("downloadsFolder").get(),
+-                             getter_Copies(folderName));
++  // We don't want localized "Downloads" unless XDG is used
++  //mBundle->GetStringFromName(NS_LITERAL_STRING("downloadsFolder").get(),
++  //                           getter_Copies(folderName));
++  folderName.AssignLiteral("Downloads");
+ 
+ #if defined (XP_MACOSX)
+   rv = dirService->Get(NS_OSX_DEFAULT_DOWNLOAD_DIR,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/widgetproperty	Sat Nov 28 13:56:10 2009 +0100
@@ -0,0 +1,188 @@
+diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in
+--- a/xpcom/build/Makefile.in
++++ b/xpcom/build/Makefile.in
+@@ -161,17 +161,18 @@ OS_LIBS += $(LIBICONV)
+ GARBAGE         += $(XPCOM_GLUE_SRC_LCSRCS) $(XPCOM_GLUE_SRC_LCPPSRCS) $(XPCOM_GLUENS_SRC_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
+ 
+ include $(topsrcdir)/config/rules.mk
+ 
+ DEFINES		+= \
+ 		-D_IMPL_NS_COM \
+ 		-D_IMPL_NS_STRINGAPI \
+ 		-DEXPORT_XPT_API \
+-		-DEXPORT_XPTC_API
++		-DEXPORT_XPTC_API \
++		-DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
+ 
+ EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
+ 
+ ifdef GC_LEAK_DETECTOR
+ DEFINES += -DGC_LEAK_DETECTOR
+ endif
+ 
+ ifdef TARGET_XPCOM_ABI
+diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in
+--- a/xpcom/glue/Makefile.in
++++ b/xpcom/glue/Makefile.in
+@@ -157,11 +157,13 @@ include $(topsrcdir)/config/rules.mk
+ 
+ ifdef _MSC_VER
+ # Don't include directives about which CRT to use
+ OS_COMPILE_CXXFLAGS += -Zl
+ OS_COMPILE_CFLAGS += -Zl
+ DEFINES += -D_USE_ANSI_CPP
+ endif
+ 
++DEFINES += -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
++
+ ifdef TARGET_XPCOM_ABI
+ DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
+ endif
+diff --git a/xpcom/glue/nsGREGlue.cpp b/xpcom/glue/nsGREGlue.cpp
+--- a/xpcom/glue/nsGREGlue.cpp
++++ b/xpcom/glue/nsGREGlue.cpp
+@@ -157,36 +157,46 @@ GRE_GetPathFromRegKey(HKEY aRegKey,
+ 
+ nsresult
+ GRE_GetGREPathWithProperties(const GREVersionRange *versions,
+                              PRUint32 versionsLength,
+                              const GREProperty *properties,
+                              PRUint32 propertiesLength,
+                              char *aBuffer, PRUint32 aBufLen)
+ {
++  // append the widget information to be able to have multiple xulrunners
++  // based on different widget toolkits installed
++  static const GREProperty kWidgetProperty =
++    { "widget", MOZ_WIDGET_TOOLKIT };
++
+ #ifdef TARGET_XPCOM_ABI
+-  // append the ABI to the properties to match only binary 
++  // append the ABI to the properties to match only binary
+   // compatible GREs
+-  static const GREProperty kExtraProperty =
+-    { "abi", TARGET_XPCOM_ABI };
++  static const GREProperty kAbiProperty =
++  { "abi", TARGET_XPCOM_ABI };
+ 
++  GREProperty *allProperties = new GREProperty[propertiesLength + 2];
++#else
+   GREProperty *allProperties = new GREProperty[propertiesLength + 1];
++#endif
+   if (!allProperties)
+     return NS_ERROR_OUT_OF_MEMORY;
+ 
+   for (PRUint32 i=0; i<propertiesLength; i++) {
+     allProperties[i].property = properties[i].property;
+     allProperties[i].value    = properties[i].value;
+   }
+-  allProperties[propertiesLength].property = kExtraProperty.property;
+-  allProperties[propertiesLength].value    = kExtraProperty.value;
++  allProperties[propertiesLength].property = kWidgetProperty.property;
++  allProperties[propertiesLength].value    = kWidgetProperty.value;
++#ifdef TARGET_XPCOM_ABI
++  allProperties[propertiesLength+1].property = kAbiProperty.property;
++  allProperties[propertiesLength+1].value    = kAbiProperty.value;
++  PRUint32 allPropertiesLength = propertiesLength + 2;
++#else
+   PRUint32 allPropertiesLength = propertiesLength + 1;
+-#else
+-  const GREProperty *allProperties = properties;
+-  PRUint32 allPropertiesLength = propertiesLength;
+ #endif
+ 
+   // if GRE_HOME is in the environment, use that GRE
+   const char* env = getenv("GRE_HOME");
+   if (env && *env) {
+     char p[MAXPATHLEN];
+     snprintf(p, sizeof(p), "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL, env);
+     p[sizeof(p) - 1] = '\0';
+diff --git a/xpcom/glue/standalone/Makefile.in b/xpcom/glue/standalone/Makefile.in
+--- a/xpcom/glue/standalone/Makefile.in
++++ b/xpcom/glue/standalone/Makefile.in
+@@ -120,14 +120,15 @@ OS_COMPILE_CFLAGS += -Zl
+ DEFINES += -D_USE_ANSI_CPP
+ endif
+ 
+ export:: $(XPCOM_GLUE_SRC_CSRCS) $(XPCOM_GLUE_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp
+ 	$(INSTALL) $^ .
+ 
+ GARBAGE += nsStringAPI.cpp
+ 
+-DEFINES		+= -DXPCOM_GLUE
++DEFINES		+= -DXPCOM_GLUE \
++                   -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
+ 
+ ifdef TARGET_XPCOM_ABI
+ DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
+ endif
+ 
+diff --git a/xulrunner/app/Makefile.in b/xulrunner/app/Makefile.in
+--- a/xulrunner/app/Makefile.in
++++ b/xulrunner/app/Makefile.in
+@@ -59,17 +59,18 @@ PROGRAM = xulrunner$(BIN_SUFFIX)
+ else
+ ifeq ($(OS_ARCH), BeOS)
+ PROGRAM = xulrunner$(BIN_SUFFIX)
+ else
+ PROGRAM = xulrunner-bin$(BIN_SUFFIX)
+ endif
+ endif
+ 
+-DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
++DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\" \
++           -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
+ 
+ ifdef MOZ_JAVAXPCOM
+ DEFINES += -DMOZ_JAVAXPCOM
+ endif
+ 
+ ifdef TARGET_XPCOM_ABI
+ DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
+ endif
+diff --git a/xulrunner/app/nsXULRunnerApp.cpp b/xulrunner/app/nsXULRunnerApp.cpp
+--- a/xulrunner/app/nsXULRunnerApp.cpp
++++ b/xulrunner/app/nsXULRunnerApp.cpp
+@@ -257,17 +257,18 @@ InstallXULApp(nsIFile* aXULRunnerDir,
+ 
+   if (NS_FAILED(rv))
+     return 3;
+ 
+   return 0;
+ }
+ 
+ static const GREProperty kGREProperties[] = {
+-  { "xulrunner", "true" }
++  { "xulrunner", "true" },
++  { "widget", MOZ_WIDGET_TOOLKIT }
+ #ifdef TARGET_XPCOM_ABI
+   , { "abi", TARGET_XPCOM_ABI }
+ #endif
+ #ifdef MOZ_JAVAXPCOM
+   , { "javaxpcom", "1" }
+ #endif
+ };
+ 
+diff --git a/xulrunner/installer/Makefile.in b/xulrunner/installer/Makefile.in
+--- a/xulrunner/installer/Makefile.in
++++ b/xulrunner/installer/Makefile.in
+@@ -63,18 +63,18 @@ endif
+ 
+ include $(topsrcdir)/config/rules.mk
+ 
+ INSTALL_SDK = 1
+ 
+ include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
+ 
+ $(MOZILLA_VERSION).system.conf: $(topsrcdir)/config/milestone.txt Makefile
+-	printf "[%s]\nGRE_PATH=%s\nxulrunner=true\nabi=%s" \
+-	  $(MOZILLA_VERSION) $(installdir) $(TARGET_XPCOM_ABI)> $@
++	printf "[%s]\nGRE_PATH=%s\nxulrunner=true\nwidget=%s\nabi=%s" \
++	  $(MOZILLA_VERSION) $(installdir) $(MOZ_WIDGET_TOOLKIT) $(TARGET_XPCOM_ABI)> $@
+ 
+ ifndef SKIP_GRE_REGISTRATION
+ # to register xulrunner per-user, override this with $HOME/.gre.d
+ regdir = /etc/gre.d
+ 
+ install:: $(MOZILLA_VERSION).system.conf
+ 	$(NSINSTALL) -D $(DESTDIR)$(regdir)
+ 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(regdir)