update to 2.0b9/4.0b9
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 12 Jan 2011 22:45:15 +0100
changeset 210 f4f4388b26a8
parent 209 46868b4f4bfd
child 211 aef7c16cb0e5
update to 2.0b9/4.0b9 removed firefox-appname.patch merge wip patches for GIO support from bmo
MozillaFirefox/MozillaFirefox.changes
MozillaFirefox/MozillaFirefox.spec
MozillaFirefox/firefox-appname.patch
MozillaFirefox/firefox-shell-bmo624267.patch
MozillaFirefox/firefox-shellservice.patch
firefox-appname.patch
firefox-shell-bmo624267.patch
firefox-shellservice.patch
mozilla-gio.patch
mozilla-kde.patch
mozilla-xulrunner20/create-tar.sh
mozilla-xulrunner20/mozilla-gio.patch
mozilla-xulrunner20/mozilla-xulrunner20.changes
mozilla-xulrunner20/mozilla-xulrunner20.spec
series
--- a/MozillaFirefox/MozillaFirefox.changes	Mon Jan 10 10:39:11 2011 +0100
+++ b/MozillaFirefox/MozillaFirefox.changes	Wed Jan 12 22:45:15 2011 +0100
@@ -1,3 +1,14 @@
+-------------------------------------------------------------------
+Tue Jan 11 06:13:40 UTC 2011 - wr@rosenauer.org
+
+- update to version 4.0b9
+- added x-scheme-handler for http and https to desktop file for
+  newer Gnome environments
+- fixed default browser check/set for GIO (bmo#611953)
+  (mozilla-shellservice.patch)
+- removed obsolete firefox-appname.patch (integrated into
+  shellservice patch)
+
 -------------------------------------------------------------------
 Mon Jan  3 17:35:46 CET 2011 - meissner@suse.de
 
--- a/MozillaFirefox/MozillaFirefox.spec	Mon Jan 10 10:39:11 2011 +0100
+++ b/MozillaFirefox/MozillaFirefox.spec	Wed Jan 12 22:45:15 2011 +0100
@@ -1,5 +1,5 @@
 #
-# spec file for package MozillaFirefox (Version 4.0b8)
+# spec file for package MozillaFirefox (Version 4.0b9)
 #
 # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #               2006-2011 Wolfgang Rosenauer
@@ -29,14 +29,14 @@
 BuildRequires:  wireless-tools
 %endif
 %if 0%{?use_xulrunner}
-BuildRequires:  %{xulrunner}-devel = 2.0b8
+BuildRequires:  %{xulrunner}-devel = 2.0b9
 %endif
 License:        GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
-Version:        4.0b8
+Version:        4.0b9
 Provides:       web_browser
 Provides:       firefox = %{version}
 Release:        1
-%define         releasedate 2011010500
+%define         releasedate 2011011000
 Summary:        Mozilla Firefox Web Browser
 Url:            http://www.mozilla.org/
 Group:          Productivity/Networking/Web/Browsers
@@ -56,13 +56,14 @@
 Patch2:         firefox-linkorder.patch
 Patch3:         firefox-browser-css.patch
 Patch4:         firefox-cross-desktop.patch
-Patch5:         firefox-appname.patch
-Patch6:         firefox-kde.patch
-Patch7:         firefox-ui-lockdown.patch
-Patch8:         firefox-no-sync-l10n.patch
-Patch9:         firefox-libxulsdk-locales.patch
-Patch10:        firefox-no-default-ualocale.patch
-Patch11:        firefox-multilocale-chrome.patch
+Patch5:         firefox-kde.patch
+Patch6:         firefox-ui-lockdown.patch
+Patch7:         firefox-no-sync-l10n.patch
+Patch8:         firefox-libxulsdk-locales.patch
+Patch9:        firefox-no-default-ualocale.patch
+Patch10:        firefox-multilocale-chrome.patch
+Patch11:        firefox-shell-bmo624267.patch
+Patch12:        firefox-shellservice.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires(post):   coreutils shared-mime-info desktop-file-utils
 Requires(postun): shared-mime-info desktop-file-utils
@@ -155,17 +156,18 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%if %suse_version >= 1110
 %patch5 -p1
-%if %suse_version >= 1110
-%patch6 -p1
 # install kde.js
 install -m 644 %{SOURCE6} browser/app/profile/kde.js
 %endif
-#%patch7 -p1
+#%patch6 -p1
+%patch7 -p1
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
 %patch11 -p1
+%patch12 -p1
 
 %build
 export MOZ_BUILD_DATE=%{releasedate}
--- a/MozillaFirefox/firefox-appname.patch	Mon Jan 10 10:39:11 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../firefox-appname.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/firefox-shell-bmo624267.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -0,0 +1,1 @@
+../firefox-shell-bmo624267.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/firefox-shellservice.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -0,0 +1,1 @@
+../firefox-shellservice.patch
\ No newline at end of file
--- a/firefox-appname.patch	Mon Jan 10 10:39:11 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-From: Wolfgang Rosenauer <wr@rosenauer.org>
-Subject: Hardcode app starter for default check
-
-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
-@@ -105,22 +105,26 @@ nsresult
- nsGNOMEShellService::Init()
- {
-   nsresult rv;
- 
-   // GConf _must_ be available, or we do not allow
-   // CreateInstance to succeed.
- 
-   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
-+  if (!gconf)
-+    return NS_ERROR_NOT_AVAILABLE;
-+
-+  /* This path to firefox is hardcoded for the default path setting */
-+  mAppPath.Assign("/usr/bin/firefox");
-+  return NS_OK;
-+
-   nsCOMPtr<nsIGIOService> giovfs =
-     do_GetService(NS_GIOSERVICE_CONTRACTID);
- 
--  if (!gconf)
--    return NS_ERROR_NOT_AVAILABLE;
--
-   // Check G_BROKEN_FILENAMES.  If it's set, then filenames in glib use
-   // the locale encoding.  If it's not set, they use UTF-8.
-   mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
- 
-   nsCOMPtr<nsIProperties> dirSvc
-     (do_GetService("@mozilla.org/file/directory_service;1"));
-   NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE);
- 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firefox-shell-bmo624267.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -0,0 +1,82 @@
+# HG changeset patch
+# Parent 6c4a0e0acb3a071dbfde60e975f68f18c85bbff8
+# User timeless@mozdev.org
+Bug 624267 Crash on Ubuntu [@ nsGNOMEShellService::SetDefaultBrowser ]
+r=roc
+
+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
+@@ -214,30 +214,31 @@ nsGNOMEShellService::SetDefaultBrowser(P
+ #endif
+ 
+   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
+-
+-  nsCAutoString appKeyValue(mAppPath);
+-  appKeyValue.Append(" \"%s\"");
+-  unsigned int i;
+-
+-  for (i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
+-    if (appProtocols[i].essential || aClaimAllTypes) {
+-      gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
+-                               appKeyValue);
++  if (gconf) {
++    nsCAutoString appKeyValue(mAppPath);
++    appKeyValue.Append(" \"%s\"");
++    for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
++      if (appProtocols[i].essential || aClaimAllTypes) {
++        gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
++                                 appKeyValue);
++      }
+     }
+   }
+ 
+   // set handler for .html and xhtml files and MIME types:
+   if (aClaimAllTypes) {
++    nsresult rv;
+     nsCOMPtr<nsIGIOService> giovfs =
+-      do_GetService(NS_GIOSERVICE_CONTRACTID);
++      do_GetService(NS_GIOSERVICE_CONTRACTID, &rv);
++    NS_ENSURE_SUCCESS(rv, rv);
+ 
+     nsCOMPtr<nsIStringBundleService> bundleService =
+-      do_GetService(NS_STRINGBUNDLE_CONTRACTID);
+-    NS_ENSURE_TRUE(bundleService, NS_ERROR_OUT_OF_MEMORY);
++      do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
++    NS_ENSURE_SUCCESS(rv, rv);
+ 
+     nsCOMPtr<nsIStringBundle> brandBundle;
+-    bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
+-    NS_ENSURE_TRUE(brandBundle, NS_ERROR_FAILURE);
++    rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
++    NS_ENSURE_SUCCESS(rv, rv);
+ 
+     nsString brandShortName, brandFullName;
+     brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
+@@ -247,17 +248,16 @@ nsGNOMEShellService::SetDefaultBrowser(P
+ 
+     // use brandShortName as the application id.
+     NS_ConvertUTF16toUTF8 id(brandShortName);
+-    if (giovfs) {
+-      nsCOMPtr<nsIGIOMimeApp> appInfo;
+-      giovfs->CreateAppFromCommand(mAppPath,
+-                                id,
+-                                getter_AddRefs(appInfo));
++    nsCOMPtr<nsIGIOMimeApp> appInfo;
++    rv = giovfs->CreateAppFromCommand(mAppPath,
++                                      id,
++                                      getter_AddRefs(appInfo));
++    NS_ENSURE_SUCCESS(rv, rv);
+ 
+-      // Add mime types for html, xhtml extension and set app to just created appinfo.
+-      for (i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
+-        appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
+-        appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
+-      }
++    // Add mime types for html, xhtml extension and set app to just created appinfo.
++    for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
++      appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
++      appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
+     }
+   }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firefox-shellservice.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -0,0 +1,325 @@
+# HG changeset patch
+# Parent 7530e890ad6ed214783244371ec1ef816d24083e
+
+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
+@@ -101,30 +101,33 @@ static const char kDesktopOptionsKey[] =
+ static const char kDesktopDrawBGKey[] = DG_BACKGROUND "/draw_background";
+ static const char kDesktopColorKey[] = DG_BACKGROUND "/primary_color";
+ 
+ nsresult
+ nsGNOMEShellService::Init()
+ {
+   nsresult rv;
+ 
+-  // GConf _must_ be available, or we do not allow
++  // GConf or GIO _must_ be available, or we do not allow
+   // CreateInstance to succeed.
+ 
+   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
+   nsCOMPtr<nsIGIOService> giovfs =
+     do_GetService(NS_GIOSERVICE_CONTRACTID);
+ 
+-  if (!gconf)
++  if (!gconf && !giovfs)
+     return NS_ERROR_NOT_AVAILABLE;
+ 
+   // Check G_BROKEN_FILENAMES.  If it's set, then filenames in glib use
+   // the locale encoding.  If it's not set, they use UTF-8.
+   mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
+ 
++  if (GetAppPathFromLauncher())
++    return NS_OK;
++
+   nsCOMPtr<nsIProperties> dirSvc
+     (do_GetService("@mozilla.org/file/directory_service;1"));
+   NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE);
+ 
+   nsCOMPtr<nsILocalFile> appPath;
+   rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile),
+                    getter_AddRefs(appPath));
+   NS_ENSURE_SUCCESS(rv, rv);
+@@ -133,16 +136,44 @@ nsGNOMEShellService::Init()
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
+   return appPath->GetNativePath(mAppPath);
+ }
+ 
+ NS_IMPL_ISUPPORTS1(nsGNOMEShellService, nsIShellService)
+ 
+ PRBool
++nsGNOMEShellService::GetAppPathFromLauncher()
++{
++  gchar *tmp;
++
++  const char *launcher = PR_GetEnv("MOZ_APP_LAUNCHER");
++  if (!launcher)
++    return PR_FALSE;
++
++  if (g_path_is_absolute(launcher)) {
++    mAppPath = launcher;
++    tmp = g_path_get_basename(launcher);
++    gchar *fullpath = g_find_program_in_path(tmp);
++    if (fullpath && mAppPath.Equals(fullpath))
++      mAppIsInPath = PR_TRUE;
++    g_free(fullpath);
++  } else {
++    tmp = g_find_program_in_path(launcher);
++    if (!tmp)
++      return PR_FALSE;
++    mAppPath = tmp;
++    mAppIsInPath = PR_TRUE;
++  }
++
++  g_free(tmp);
++  return PR_TRUE;
++}
++
++PRBool
+ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
+ {
+ 
+   gchar *commandPath;
+   if (mUseLocaleFilenames) {
+     gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
+     if (!nativePath) {
+       NS_ERROR("Error converting path to filesystem encoding");
+@@ -158,84 +189,119 @@ nsGNOMEShellService::KeyMatchesAppName(c
+   if (!commandPath)
+     return PR_FALSE;
+ 
+   PRBool matches = mAppPath.Equals(commandPath);
+   g_free(commandPath);
+   return matches;
+ }
+ 
++PRBool
++nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const
++{
++  gint argc;
++  gchar **argv;
++  nsCAutoString command(handler);
++
++  // The string will be something of the form: [/path/to/]browser "%s"
++  // We want to remove all of the parameters and get just the binary name.
++  if (g_shell_parse_argv(command.get(), &argc, &argv, NULL) && argc > 0) {
++    command.Assign(argv[0]);
++    g_strfreev(argv);
++  }
++
++  if (!KeyMatchesAppName(command.get()))
++    return PR_FALSE; // the handler is disabled or set to another app
++
++  return PR_TRUE;
++}
++
+ NS_IMETHODIMP
+ nsGNOMEShellService::IsDefaultBrowser(PRBool aStartupCheck,
+                                       PRBool* aIsDefaultBrowser)
+ {
+   *aIsDefaultBrowser = PR_FALSE;
+   if (aStartupCheck)
+     mCheckedThisSession = PR_TRUE;
+ 
+   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
++  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
+ 
+   PRBool enabled;
+   nsCAutoString handler;
++  nsCOMPtr<nsIGIOMimeApp> gioApp;
+ 
+   for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
+     if (!appProtocols[i].essential)
+       continue;
+ 
+-    handler.Truncate();
+-    gconf->GetAppForProtocol(nsDependentCString(appProtocols[i].name),
+-                             &enabled, handler);
++    if (gconf) {
++      handler.Truncate();
++      gconf->GetAppForProtocol(nsDependentCString(appProtocols[i].name),
++                               &enabled, handler);
+ 
+-    // The string will be something of the form: [/path/to/]browser "%s"
+-    // We want to remove all of the parameters and get just the binary name.
+-
+-    gint argc;
+-    gchar **argv;
+-
+-    if (g_shell_parse_argv(handler.get(), &argc, &argv, NULL) && argc > 0) {
+-      handler.Assign(argv[0]);
+-      g_strfreev(argv);
++      if (!CheckHandlerMatchesAppName(handler) || !enabled)
++        return NS_OK; // the handler is disabled or set to another app
+     }
+ 
+-    if (!KeyMatchesAppName(handler.get()) || !enabled)
+-      return NS_OK; // the handler is disabled or set to another app
++    if (giovfs) {
++      handler.Truncate();
++      giovfs->GetAppForURIScheme(nsDependentCString(appProtocols[i].name),
++                                 getter_AddRefs(gioApp));
++      if (!gioApp)
++        return NS_OK;
++
++      gioApp->GetCommand(handler);
++
++      if (!CheckHandlerMatchesAppName(handler))
++        return NS_OK; // the handler is set to another app
++    }
+   }
+ 
+   *aIsDefaultBrowser = PR_TRUE;
+ 
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ nsGNOMEShellService::SetDefaultBrowser(PRBool aClaimAllTypes,
+                                        PRBool aForAllUsers)
+ {
+ #ifdef DEBUG
+   if (aForAllUsers)
+     NS_WARNING("Setting the default browser for all users is not yet supported");
+ #endif
+ 
++  nsCAutoString appKeyValue;
+   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
++  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
++
++  if (mAppIsInPath) {
++    // mAppPath is in the users path, so use only the basename as the
++    // launcher
++    gchar *tmp = g_path_get_basename(mAppPath.get());
++    appKeyValue = tmp;
++    g_free(tmp);
++  } else {
++    appKeyValue = mAppPath;
++  }
++  appKeyValue.AppendLiteral(" %s");
++
+   if (gconf) {
+-    nsCAutoString appKeyValue(mAppPath);
+-    appKeyValue.Append(" \"%s\"");
+     for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
+       if (appProtocols[i].essential || aClaimAllTypes) {
+         gconf->SetAppForProtocol(nsDependentCString(appProtocols[i].name),
+                                  appKeyValue);
+       }
+     }
+   }
+ 
+-  // set handler for .html and xhtml files and MIME types:
+-  if (aClaimAllTypes) {
++  if (giovfs) {
+     nsresult rv;
+-    nsCOMPtr<nsIGIOService> giovfs =
+-      do_GetService(NS_GIOSERVICE_CONTRACTID, &rv);
+-    NS_ENSURE_SUCCESS(rv, rv);
++    unsigned int i;
+ 
+     nsCOMPtr<nsIStringBundleService> bundleService =
+       do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+     nsCOMPtr<nsIStringBundle> brandBundle;
+     rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
+     NS_ENSURE_SUCCESS(rv, rv);
+@@ -249,20 +315,30 @@ nsGNOMEShellService::SetDefaultBrowser(P
+     // use brandShortName as the application id.
+     NS_ConvertUTF16toUTF8 id(brandShortName);
+     nsCOMPtr<nsIGIOMimeApp> appInfo;
+     rv = giovfs->CreateAppFromCommand(mAppPath,
+                                       id,
+                                       getter_AddRefs(appInfo));
+     NS_ENSURE_SUCCESS(rv, rv);
+ 
+-    // Add mime types for html, xhtml extension and set app to just created appinfo.
+-    for (unsigned int i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
+-      appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
+-      appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
++    // set handler for the protocols
++    for (i = 0; i < NS_ARRAY_LENGTH(appProtocols); ++i) {
++      if (appProtocols[i].essential || aClaimAllTypes) {
++        appInfo->SetAsDefaultForURIScheme(nsDependentCString(appProtocols[i].name));
++      }
++    }
++
++    // set handler for .html and xhtml files and MIME types:
++    if (aClaimAllTypes) {
++      // Add mime types for html, xhtml extension and set app to just created appinfo.
++      for (i = 0; i < NS_ARRAY_LENGTH(appTypes); ++i) {
++        appInfo->SetAsDefaultForMimeType(nsDependentCString(appTypes[i].mimeType));
++        appInfo->SetAsDefaultForFileExtensions(nsDependentCString(appTypes[i].extensions));
++      }
+     }
+   }
+ 
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ nsGNOMEShellService::GetShouldCheckDefaultBrowser(PRBool* aResult)
+@@ -451,17 +527,27 @@ nsGNOMEShellService::OpenApplication(PRI
+   nsCAutoString scheme;
+   if (aApplication == APPLICATION_MAIL)
+     scheme.Assign("mailto");
+   else if (aApplication == APPLICATION_NEWS)
+     scheme.Assign("news");
+   else
+     return NS_ERROR_NOT_AVAILABLE;
+ 
++  nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
++  if (giovfs) {
++    nsCOMPtr<nsIGIOMimeApp> gioApp;
++    giovfs->GetAppForURIScheme(scheme, getter_AddRefs(gioApp));
++    if (gioApp)
++      return gioApp->Launch(EmptyCString());
++  }
++
+   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
++  if (!gconf)
++    return NS_ERROR_FAILURE;
+ 
+   PRBool enabled;
+   nsCAutoString appCommand;
+   gconf->GetAppForProtocol(scheme, &enabled, appCommand);
+ 
+   if (!enabled)
+     return NS_ERROR_FAILURE;
+ 
+diff --git a/browser/components/shell/src/nsGNOMEShellService.h b/browser/components/shell/src/nsGNOMEShellService.h
+--- a/browser/components/shell/src/nsGNOMEShellService.h
++++ b/browser/components/shell/src/nsGNOMEShellService.h
+@@ -38,26 +38,29 @@
+ #define nsgnomeshellservice_h____
+ 
+ #include "nsIShellService.h"
+ #include "nsStringAPI.h"
+ 
+ class nsGNOMEShellService : public nsIShellService
+ {
+ public:
+-  nsGNOMEShellService() : mCheckedThisSession(PR_FALSE) { }
++  nsGNOMEShellService() : mCheckedThisSession(PR_FALSE), mAppIsInPath(PR_FALSE) { }
+ 
+   NS_DECL_ISUPPORTS
+   NS_DECL_NSISHELLSERVICE
+ 
+   nsresult Init() NS_HIDDEN;
+ 
+ private:
+   ~nsGNOMEShellService() {}
+ 
+   NS_HIDDEN_(PRBool) KeyMatchesAppName(const char *aKeyValue) const;
++  NS_HIDDEN_(PRBool) CheckHandlerMatchesAppName(const nsACString& handler) const;
+ 
++  NS_HIDDEN_(PRBool) GetAppPathFromLauncher();
+   PRPackedBool mCheckedThisSession;
+   PRPackedBool mUseLocaleFilenames;
+   nsCString    mAppPath;
++  PRPackedBool mAppIsInPath;
+ };
+ 
+ #endif // nsgnomeshellservice_h____
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-gio.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -0,0 +1,284 @@
+# HG changeset patch
+# User Chris Coulson
+# Parent 0ebe30f9eacfe67fa0b699457e524d5a9c96359e
+Bug 611953 - GNOME 3.0 readiness (patch 2 + 3)
+
+diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp
+--- a/toolkit/system/gnome/nsGIOService.cpp
++++ b/toolkit/system/gnome/nsGIOService.cpp
+@@ -101,25 +101,25 @@ nsGIOMimeApp::GetName(nsACString& aName)
+   return NS_OK;
+ }
+ 
+ NS_IMETHODIMP
+ nsGIOMimeApp::GetCommand(nsACString& aCommand)
+ {
+   get_commandline_t g_app_info_get_commandline_ptr;
+ 
+-  void *libHandle = dlopen("libgio-2.0.so", RTLD_LAZY);
++  void *libHandle = dlopen("libgio-2.0.so.0", RTLD_LAZY);
+   if (!libHandle) {
+     return NS_ERROR_FAILURE;
+   }
+   dlerror(); /* clear any existing error */
+   g_app_info_get_commandline_ptr =
+     (get_commandline_t) dlsym(libHandle, "g_app_info_get_commandline");
+-  if (dlerror() != NULL) {
+-    const char cmd = *g_app_info_get_commandline_ptr(mApp);
++  if (dlerror() == NULL) {
++    const char *cmd = g_app_info_get_commandline_ptr(mApp);
+     if (!cmd) {
+       dlclose(libHandle);
+       return NS_ERROR_FAILURE;
+     }
+     aCommand.Assign(cmd);
+   }
+   dlclose(libHandle);
+   return NS_OK;
+@@ -277,16 +277,43 @@ nsGIOMimeApp::SetAsDefaultForFileExtensi
+     } else {
+       *ext_pos = '\0';
+     }
+   }
+   g_free(extensions);
+   return NS_OK;
+ }
+ 
++/**
++ * Set default application for URI's of a particular scheme
++ * @param aURIScheme string containing the URI scheme
++ * @return NS_OK when application was set as default for URI scheme,
++ * NS_ERROR_FAILURE otherwise
++ */
++NS_IMETHODIMP
++nsGIOMimeApp::SetAsDefaultForURIScheme(nsACString const& aURIScheme)
++{
++  GError *error = NULL;
++  nsCAutoString contentType("x-scheme-handler/");
++  contentType.Append(aURIScheme);
++
++  g_app_info_set_as_default_for_type(mApp,
++                                     contentType.get(),
++                                     &error);
++  if (error) {
++    g_warning("Cannot set application as default for URI scheme (%s): %s",
++              PromiseFlatCString(aURIScheme).get(),
++              error->message);
++    g_error_free(error);
++    return NS_ERROR_FAILURE;
++  }
++
++  return NS_OK;
++}
++
+ nsresult
+ nsGIOService::Init()
+ {
+   // do nothing, gvfs/gio does not init.
+   return NS_OK;
+ }
+ 
+ NS_IMPL_ISUPPORTS1(nsGIOService, nsIGIOService)
+@@ -317,29 +344,45 @@ nsGIOService::GetMimeTypeFromExtension(c
+   g_free(mime_type);
+   g_free(content_type);
+ 
+   return NS_OK;
+ }
+ // used in nsGNOMERegistry
+ // -----------------------------------------------------------------------------
+ NS_IMETHODIMP
++nsGIOService::GetAppForURIScheme(const nsACString& aURIScheme,
++                                 nsIGIOMimeApp** aApp)
++{
++  *aApp = nsnull;
++
++  GAppInfo *app_info = g_app_info_get_default_for_uri_scheme(
++                         PromiseFlatCString(aURIScheme).get());
++  if (app_info) {
++    nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info);
++    NS_ADDREF(*aApp = mozApp);
++  } else {
++    return NS_ERROR_FAILURE;
++  }
++  return NS_OK;
++}
++
++NS_IMETHODIMP
+ nsGIOService::GetAppForMimeType(const nsACString& aMimeType,
+                                 nsIGIOMimeApp**   aApp)
+ {
+   *aApp = nsnull;
+   char *content_type =
+     get_content_type_from_mime_type(PromiseFlatCString(aMimeType).get());
+   if (!content_type)
+     return NS_ERROR_FAILURE;
+ 
+   GAppInfo *app_info = g_app_info_get_default_for_type(content_type, false);
+   if (app_info) {
+     nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info);
+-    NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY);
+     NS_ADDREF(*aApp = mozApp);
+   } else {
+     g_free(content_type);
+     return NS_ERROR_FAILURE;
+   }
+   g_free(content_type);
+   return NS_OK;
+ }
+@@ -414,75 +457,46 @@ nsGIOService::CreateAppFromCommand(nsACS
+                                    nsIGIOMimeApp**   appInfo)
+ {
+   GError *error = NULL;
+   *appInfo = nsnull;
+ 
+   GAppInfo *app_info = NULL, *app_info_from_list = NULL;
+   GList *apps = g_app_info_get_all();
+   GList *apps_p = apps;
+-  get_commandline_t g_app_info_get_commandline_ptr;
+-
+-  void *libHandle = dlopen("libgio-2.0.so", RTLD_LAZY);
+-  if (!libHandle) {
+-    return NS_ERROR_FAILURE;
+-  }
+-  dlerror(); /* clear any existing error */
+-  g_app_info_get_commandline_ptr =
+-    (get_commandline_t) dlsym(libHandle, "g_app_info_get_commandline");
+-  if (dlerror() != NULL) {
+-    g_app_info_get_commandline_ptr = NULL;
+-  }
+ 
+   // Try to find relevant and existing GAppInfo in all installed application
++  // We do this by comparing each GAppInfo's executable with out own
+   while (apps_p) {
+     app_info_from_list = (GAppInfo*) apps_p->data;
+-    /* This is  a silly test. It just compares app names but not
+-     * commands. This is due to old version of Glib/Gio. The required
+-     * function which allows to do a regular check of existence of desktop file
+-     * is possible by using function g_app_info_get_commandline. This function
+-     * has been introduced in Glib 2.20. */
+-    if (app_info_from_list && strcmp(g_app_info_get_name(app_info_from_list),
+-                                     PromiseFlatCString(appName).get()) == 0 )
+-    {
+-      if (g_app_info_get_commandline_ptr)
+-      {
+-        /* Following test is only possible with Glib >= 2.20.
+-         * Compare path only by using strncmp */
+-        if (strncmp(g_app_info_get_commandline_ptr(app_info_from_list),
+-                    PromiseFlatCString(cmd).get(),
+-                    strlen(PromiseFlatCString(cmd).get())) == 0)
+-        {
+-          app_info = app_info_from_list;
+-          break;
+-        } else {
+-          g_object_unref(app_info_from_list);
+-        }
+-      } else {
++    if (!app_info) {
++      // If the executable is not absolute, get it's full path
++      char *executable = g_find_program_in_path(g_app_info_get_executable(app_info_from_list));
++
++      if (executable && strcmp(executable, PromiseFlatCString(cmd).get()) == 0) {
++        g_object_ref (app_info_from_list);
+         app_info = app_info_from_list;
+-        break;
+       }
+-    } else {
+-      g_object_unref(app_info_from_list);
++      g_free(executable);
+     }
++
++    g_object_unref(app_info_from_list);
+     apps_p = apps_p->next;
+   }
+   g_list_free(apps);
+ 
+   if (!app_info) {
+     app_info = g_app_info_create_from_commandline(PromiseFlatCString(cmd).get(),
+                                                   PromiseFlatCString(appName).get(),
+                                                   G_APP_INFO_CREATE_SUPPORTS_URIS,
+                                                   &error);
+   }
+ 
+   if (!app_info) {
+     g_warning("Cannot create application info from command: %s", error->message);
+     g_error_free(error);
+-    dlclose(libHandle);
+     return NS_ERROR_FAILURE;
+   }
+   nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info);
+   NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY);
+   NS_ADDREF(*appInfo = mozApp);
+-  dlclose(libHandle);
+   return NS_OK;
+ }
+diff --git a/xpcom/system/nsIGIOService.idl b/xpcom/system/nsIGIOService.idl
+--- a/xpcom/system/nsIGIOService.idl
++++ b/xpcom/system/nsIGIOService.idl
+@@ -39,17 +39,17 @@
+ 
+ #include "nsISupports.idl"
+ 
+ interface nsIUTF8StringEnumerator;
+ interface nsIURI;
+ 
+ /* nsIGIOMimeApp holds information about an application that is looked up
+    with nsIGIOService::GetAppForMimeType. */
+-// 66009894-9877-405b-9321-bf30420e34e6 prev uuid
++// e77021b4-4012-407d-b686-7a1f18050109 prev uuid
+ 
+ [scriptable, uuid(e77021b4-4012-407d-b686-7a1f18050109)] 
+ interface nsIGIOMimeApp : nsISupports
+ {
+   const long EXPECTS_URIS  = 0;
+   const long EXPECTS_PATHS = 1;
+   const long EXPECTS_URIS_FOR_NON_FILES = 2;
+ 
+@@ -57,41 +57,45 @@ interface nsIGIOMimeApp : nsISupports
+   readonly attribute AUTF8String         name;
+   readonly attribute AUTF8String         command;
+   readonly attribute long                expectsURIs;  // see constants above
+   readonly attribute nsIUTF8StringEnumerator supportedURISchemes;
+ 
+   void launch(in AUTF8String uri);
+   void setAsDefaultForMimeType(in AUTF8String mimeType);
+   void setAsDefaultForFileExtensions(in AUTF8String extensions);
++  void setAsDefaultForURIScheme(in AUTF8String uriScheme);
+ };
+ 
+ /*
+  * The VFS service makes use of two distinct registries.
+  *
+  * The application registry holds information about applications (uniquely
+  * identified by id), such as which MIME types and URI schemes they are
+  * capable of handling, whether they run in a terminal, etc.
+  *
+  * The MIME registry holds information about MIME types, such as which
+  * extensions map to a given MIME type.  The MIME registry also stores the
+  * id of the application selected to handle each MIME type.
+  */
+ 
+-// prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b
+-[scriptable, uuid(47e372c2-78bb-4899-8114-56aa7d9cdac5)]
++// prev id 47e372c2-78bb-4899-8114-56aa7d9cdac5
++[scriptable, uuid(74ca8791-330d-4786-9569-2a2a19f0b486)]
+ interface nsIGIOService : nsISupports
+ {
+ 
+   /*** MIME registry methods ***/
+ 
+   /* Obtain the MIME type registered for an extension.  The extension
+      should not include a leading dot. */
+   AUTF8String        getMimeTypeFromExtension(in AUTF8String extension);
+ 
++  /* Obtain the preferred application for opening a given URI scheme */
++  nsIGIOMimeApp      getAppForURIScheme(in AUTF8String aURIScheme);
++
+   /* Obtain the preferred application for opening a given MIME type */
+   nsIGIOMimeApp      getAppForMimeType(in AUTF8String mimeType);
+ 
+   /* Obtain the preferred application for opening a given MIME type */
+   nsIGIOMimeApp      createAppFromCommand(in AUTF8String cmd, 
+                                           in AUTF8String appName);
+ 
+   /* Obtain a description for the given MIME type */
--- a/mozilla-kde.patch	Mon Jan 10 10:39:11 2011 +0100
+++ b/mozilla-kde.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -21,7 +21,8 @@
 diff --git a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp
 --- a/modules/libpref/src/nsPrefService.cpp
 +++ b/modules/libpref/src/nsPrefService.cpp
-@@ -57,16 +57,17 @@
+@@ -55,16 +55,17 @@
+ #include "nsIStringEnumerator.h"
  #include "nsIZipReader.h"
  #include "nsPrefBranch.h"
  #include "nsXPIDLString.h"
@@ -29,7 +30,6 @@
  #include "nsCOMArray.h"
  #include "nsXPCOMCID.h"
  #include "nsAutoPtr.h"
- #include "nsThreadUtils.h"
 +#include "nsKDEUtils.h"
  
  #include "nsQuickSort.h"
@@ -39,7 +39,7 @@
  #include "prefapi.h"
  #include "prefread.h"
  #include "prefapi_private_data.h"
-@@ -798,30 +799,48 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
+@@ -772,30 +773,48 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
  }
  
  static nsresult pref_LoadPrefsInDirList(const char *listId)
@@ -89,7 +89,7 @@
  }
  
  //----------------------------------------------------------------------------------------
-@@ -852,28 +871,40 @@ static nsresult pref_InitDefaults()
+@@ -826,28 +845,40 @@ static nsresult pref_InitDefaults()
    /* 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_MAC) || defined(XP_MACOSX)
--- a/mozilla-xulrunner20/create-tar.sh	Mon Jan 10 10:39:11 2011 +0100
+++ b/mozilla-xulrunner20/create-tar.sh	Wed Jan 12 22:45:15 2011 +0100
@@ -1,8 +1,8 @@
 #!/bin/bash
 
 BRANCH="mozilla-central"
-RELEASE_TAG="default"
-VERSION="2.0b8"
+RELEASE_TAG="FIREFOX_4_0b9_RELEASE"
+VERSION="2.0b9"
 
 # mozilla
 hg clone http://hg.mozilla.org/$BRANCH mozilla
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-xulrunner20/mozilla-gio.patch	Wed Jan 12 22:45:15 2011 +0100
@@ -0,0 +1,1 @@
+../mozilla-gio.patch
\ No newline at end of file
--- a/mozilla-xulrunner20/mozilla-xulrunner20.changes	Mon Jan 10 10:39:11 2011 +0100
+++ b/mozilla-xulrunner20/mozilla-xulrunner20.changes	Wed Jan 12 22:45:15 2011 +0100
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Tue Jan 11 06:11:33 UTC 2011 - wr@rosenauer.org
+
+- update to 2.0b9
+- fixed GIO support (bmo#611953) (mozilla-gio.patch)
+
 -------------------------------------------------------------------
 Wed Dec 15 07:48:50 UTC 2010 - wr@rosenauer.org
 
--- a/mozilla-xulrunner20/mozilla-xulrunner20.spec	Mon Jan 10 10:39:11 2011 +0100
+++ b/mozilla-xulrunner20/mozilla-xulrunner20.spec	Wed Jan 12 22:45:15 2011 +0100
@@ -1,5 +1,5 @@
 #
-# spec file for package mozilla-xulrunner20 (Version 2.0b8)
+# spec file for package mozilla-xulrunner20 (Version 2.0b9)
 #
 # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #               2006-2011 Wolfgang Rosenauer
@@ -30,10 +30,10 @@
 BuildRequires:  wireless-tools
 %endif
 License:        GPLv2+ ; LGPLv2.1+ ; MPLv1.1+
-Version:        2.0b8
+Version:        2.0b9
 Release:        1
-%define         releasedate 2011010500
-%define         version_internal 2.0b9pre
+%define         releasedate 2011011000
+%define         version_internal 2.0b9
 %define         apiversion 2.0
 %define         uaweight 199900
 Summary:        Mozilla Runtime Environment 2.0
@@ -71,6 +71,7 @@
 # ---
 Patch11:        mozilla-cpuid.patch
 Patch12:        mozilla-language.patch
+Patch13:        mozilla-gio.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires:       mozilla-js20 = %{version}
 Requires(post):  update-alternatives coreutils
@@ -211,6 +212,7 @@
 %patch11 -p1
 %endif
 %patch12 -p1
+%patch13 -p1
 
 %build
 kdehelperversion=$(cat toolkit/xre/nsKDEUtils.cpp | grep '#define KMOZILLAHELPER_VERSION' | cut -d ' ' -f 3)
--- a/series	Mon Jan 10 10:39:11 2011 +0100
+++ b/series	Wed Jan 12 22:45:15 2011 +0100
@@ -12,15 +12,17 @@
 mozilla-cpuid.patch
 #mozilla-cairo-lcd.patch
 mozilla-language.patch
+mozilla-gio.patch
 
 # Firefox patches
 firefox-linkorder.patch
 firefox-browser-css.patch
 firefox-cross-desktop.patch
-firefox-appname.patch
 firefox-kde.patch
 #firefox-ui-lockdown.patch
 firefox-no-sync-l10n.patch
 firefox-libxulsdk-locales.patch
 firefox-no-default-ualocale.patch
 firefox-multilocale-chrome.patch
+firefox-shell-bmo624267.patch
+firefox-shellservice.patch