OBS User unknown 2007-10-19 08:31:20 +00:00 committed by Git OBS Bridge
parent 4cba36865e
commit ddac996e20
9 changed files with 2226 additions and 2504 deletions

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Oct 19 02:04:45 CEST 2007 - maw@suse.de
- Security update to version 2.0.0.8 (#332512) (thanks, Wolfgang)
* MFSA 2007-29 Crashes with evidence of memory corruption
* MFSA 2007-30 onUnload Tailgating
* MFSA 2007-31 Digest authentication request splitting
* MFSA 2007-32 File input focus stealing vulnerability
* MFSA 2007-33 XUL pages can hide the window titlebar
* MFSA 2007-34 Possible file stealing through sftp protocol
* MFSA 2007-35 XPCNativeWraper pollution using Script object
complete advisories on
http://www.mozilla.org/projects/security/known-vulnerabilities.html
-------------------------------------------------------------------
Sun Sep 23 19:49:12 CEST 2007 - maw@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package MozillaFirefox (Version 2.0.0.6)
# spec file for package MozillaFirefox (Version 2.0.0.8)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -20,7 +20,7 @@ BuildRequires: dbus-1-glib-devel
%if %suse_version > 1020
BuildRequires: fdupes
%endif
License: GPL v2 or later, LGPL v2 or later, We have explicit permission to use the trademark.
License: GPL v2 or later; LGPL v2 or later; MOZILLA PUBLIC LICENSE (MPL/NPL)
Provides: web_browser
Provides: firefox
Provides: MozillaFirebird
@ -28,8 +28,8 @@ Obsoletes: MozillaFirebird <= 1.0.7
%if %sles_version == 10
Obsoletes: mozilla
%endif
Version: 2.0.0.6
Release: 24
Version: 2.0.0.8
Release: 1
Summary: Mozilla Firefox Web Browser
Url: http://www.mozilla.org/
Group: Productivity/Networking/Web/Browsers
@ -59,7 +59,6 @@ Source18: firefox.schemas
Patch1: visibility.patch
Patch2: rpath.patch
Patch3: gcc-undefined-ops.patch
Patch4: pango-cairo.patch
Patch5: abuild.patch
# NSPR bmo #270502
Patch6: nspr-prdtoa.patch
@ -94,7 +93,7 @@ Patch34: skin-selection.patch
Patch36: greasemonkey.patch
Patch38: tango-maxversion.patch
Patch39: x11-session.patch
# pango-cairo.patch dbus.patch startup.patch
# gconf.patch dbus.patch startup.patch
Patch100: configure.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: libstdc++ fileutils textutils /bin/sh gconf2
@ -188,7 +187,6 @@ cd $RPM_BUILD_DIR/mozilla
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
@ -556,6 +554,17 @@ exit 0
%defattr(-,root,root)
%endif
%changelog
* Fri Oct 19 2007 - maw@suse.de
- Security update to version 2.0.0.8 (#332512) (thanks, Wolfgang)
* MFSA 2007-29 Crashes with evidence of memory corruption
* MFSA 2007-30 onUnload Tailgating
* MFSA 2007-31 Digest authentication request splitting
* MFSA 2007-32 File input focus stealing vulnerability
* MFSA 2007-33 XUL pages can hide the window titlebar
* MFSA 2007-34 Possible file stealing through sftp protocol
* MFSA 2007-35 XPCNativeWraper pollution using Script object
complete advisories on
http://www.mozilla.org/projects/security/known-vulnerabilities.html
* Sun Sep 23 2007 - maw@suse.de
- Don't explicitly require libaoss.so (#326751).
* Fri Sep 14 2007 - maw@suse.de

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b5ce09c6e3a31f419bd3117a9cb569d5ebfab7dab9221dbca0a73eaedee80197
size 37624026

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c75b8dc9fcec51a3d5d7a6af9e199cc532813ae93262840ec8402a34e64d785
size 37685739

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e8d2aed30c2163ea932c012d9f992a411c145696408dca628ddaf1ca9912f7b
size 10101106

3
l10n-2.0.0.8.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a09d1e74961a06afe93d34c59f239060fc2b96e8c4d704b7a774084244204b1d
size 10104949

View File

@ -1,134 +0,0 @@
Index: config/autoconf.mk.in
===================================================================
RCS file: /cvsroot/mozilla/config/autoconf.mk.in,v
retrieving revision 3.363.2.1
diff -u -p -6 -r3.363.2.1 autoconf.mk.in
--- config/autoconf.mk.in 17 Aug 2005 17:17:17 -0000 3.363.2.1
+++ config/autoconf.mk.in 27 Aug 2005 19:57:29 -0000
@@ -456,12 +456,13 @@ MOZ_XFT_CFLAGS = @MOZ_XFT_CFLAGS@
MOZ_XFT_LIBS = @MOZ_XFT_LIBS@
MOZ_ENABLE_COREXFONTS = @MOZ_ENABLE_COREXFONTS@
MOZ_ENABLE_PANGO = @MOZ_ENABLE_PANGO@
MOZ_PANGO_CFLAGS = @MOZ_PANGO_CFLAGS@
MOZ_PANGO_LIBS = @MOZ_PANGO_LIBS@
+MOZ_PANGOCAIRO = @MOZ_PANGOCAIRO@
MOZ_EXTRA_X11CONVERTERS = @MOZ_EXTRA_X11CONVERTERS@
MOZ_ENABLE_XINERAMA = @MOZ_ENABLE_XINERAMA@
MOZ_XINERAMA_LIBS = @MOZ_XINERAMA_LIBS@
Index: gfx/src/gtk/mozilla-decoder.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/gtk/mozilla-decoder.cpp,v
retrieving revision 1.3
diff -u -p -6 -r1.3 mozilla-decoder.cpp
--- gfx/src/gtk/mozilla-decoder.cpp 7 Nov 2004 23:59:23 -0000 1.3
+++ gfx/src/gtk/mozilla-decoder.cpp 27 Aug 2005 19:57:49 -0000
@@ -37,13 +37,17 @@
* ***** END LICENSE BLOCK ***** */
#define PANGO_ENABLE_BACKEND
#define PANGO_ENABLE_ENGINE
#include "mozilla-decoder.h"
+#ifdef MOZ_PANGOCAIRO
+#include <pango/pangocairo.h>
+#else
#include <pango/pangoxft.h>
+#endif
#include <pango/pangofc-fontmap.h>
#include <pango/pangofc-font.h>
#include <gdk/gdkx.h>
#include "nsString.h"
#include "nsIPersistentProperties2.h"
@@ -205,13 +209,17 @@ mozilla_decoders_init(void)
}
else {
printf("unknown suffix used for mapping\n");
}
}
+#ifdef MOZ_PANGOCAIRO
+ pango_fc_font_map_add_decoder_find_func(PANGO_FC_FONT_MAP(pango_cairo_font_map_get_default()),
+#else
pango_fc_font_map_add_decoder_find_func(PANGO_FC_FONT_MAP(pango_xft_get_font_map(GDK_DISPLAY(),gdk_x11_get_default_screen())),
+#endif
mozilla_find_decoder,
NULL,
NULL);
initialized = PR_TRUE;
Index: configure.in
===================================================================
RCS file: /cvsroot/mozilla/configure.in,v
retrieving revision 1.1503.2.6
diff -u -p -6 -r1.1503.2.6 configure.in
--- configure.in 25 Aug 2005 19:05:34 -0000 1.1503.2.6
+++ configure.in 29 Aug 2005 08:03:32 -0000
@@ -3707,14 +3707,14 @@ gtk)
;;
gtk2)
MOZ_ENABLE_GTK2=1
MOZ_ENABLE_XREMOTE=1
MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-}
- TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
- TK_LIBS='$(MOZ_GTK2_LIBS)'
+ TK_CFLAGS='$(MOZ_GTK2_CFLAGS) $(MOZ_PANGO_CFLAGS)'
+ TK_LIBS='$(MOZ_GTK2_LIBS) $(MOZ_PANGO_LIBS)'
AC_DEFINE(MOZ_WIDGET_GTK2)
;;
xlib)
MOZ_ENABLE_XLIB=1
if test "$_HAVE_FREETYPE2"; then
@@ -4277,33 +4277,44 @@ if test "$MOZ_ENABLE_XFT" && test "$MOZ_
fi
if test "$MOZ_ENABLE_XFT"
then
AC_DEFINE(MOZ_ENABLE_XFT)
PKG_CHECK_MODULES(MOZ_XFT, xft)
- PKG_CHECK_MODULES(_PANGOCHK, pango >= 1.1.0)
+ PKG_CHECK_MODULES(MOZ_PANGO, pangoxft >= 1.1.0 pangox)
fi
AC_SUBST(MOZ_ENABLE_XFT)
AC_SUBST(MOZ_XFT_CFLAGS)
AC_SUBST(MOZ_XFT_LIBS)
+AC_SUBST(MOZ_PANGO_CFLAGS)
+AC_SUBST(MOZ_PANGO_LIBS)
dnl ========================================================
dnl = pango font rendering
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(pango,
[ --enable-pango Enable Pango font rendering support],
MOZ_ENABLE_PANGO=1,
MOZ_ENABLE_PANGO=)
if test "$MOZ_ENABLE_PANGO"
then
AC_DEFINE(MOZ_ENABLE_PANGO)
PKG_CHECK_MODULES(MOZ_PANGO, pangoxft >= 1.6.0)
+ PKG_CHECK_MODULES(PANGOCAIRO_CHK, pangocairo >= 1.10.0,
+ [
+ MOZ_PANGOCAIRO=1
+ AC_DEFINE(MOZ_PANGOCAIRO)
+ MOZ_PANGO_CFLAGS="$PANGOCAIRO_CHK_CFLAGS $MOZ_PANGO_CFLAGS"
+ MOZ_PANGO_LIBS="$PANGOCAIRO_CHK_LIBS $MOZ_PANGO_LIBS"
+ ],
+ [:])
AC_SUBST(MOZ_ENABLE_PANGO)
+ AC_SUBST(MOZ_PANGOCAIRO)
AC_SUBST(MOZ_PANGO_CFLAGS)
AC_SUBST(MOZ_PANGO_LIBS)
fi
dnl ========================================================
dnl = x11 core font support (default and ability to enable depend on toolkit)

View File

@ -735,283 +735,6 @@ Index: configure.in
char **aResponse, PRBool *aSucceeded) = 0;
};
Index: toolkit/xre/nsAppRunner.cpp
===================================================================
RCS file: /cvsroot/mozilla/toolkit/xre/nsAppRunner.cpp,v
retrieving revision 1.113.2.19
diff -u -p -6 -r1.113.2.19 nsAppRunner.cpp
--- toolkit/xre/nsAppRunner.cpp 8 Feb 2007 02:31:56 -0000 1.113.2.19
+++ toolkit/xre/nsAppRunner.cpp 19 Feb 2007 09:39:38 -0000
@@ -96,12 +96,13 @@
#include "nsIWindowWatcher.h"
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
#ifdef XP_WIN
#include "nsIWinAppHelper.h"
#endif
+#include "nsIScriptGlobalObject.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsEmbedCID.h"
@@ -112,12 +113,18 @@
#include "nsXPFEComponentsCID.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsXULAppAPI.h"
#include "nsXREDirProvider.h"
#include "nsToolkitCompsCID.h"
+#include "nsPIDOMWindow.h"
+#include "nsIDOMWindowInternal.h"
+#include "nsIBaseWindow.h"
+#include "nsIWidget.h"
+#include "nsIDocShell.h"
+#include "nsAppShellCID.h"
#include "nsINIParser.h"
#include "InstallCleanupDefines.h"
#include <stdlib.h>
@@ -259,12 +266,15 @@ char **gArgv;
static int gRestartArgc;
static char **gRestartArgv;
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
#include <gtk/gtk.h>
#endif //MOZ_WIDGET_GTK || MOZ_WIDGET_GTK2
+#if defined(MOZ_WIDGET_GTK2)
+#include "nsGTKToolkit.h"
+#endif
#if defined(MOZ_WIDGET_QT)
#include <qapplication.h>
#endif
// Save the path of the given file to the specified environment variable.
@@ -1102,13 +1112,13 @@ DumpVersion()
}
#ifdef MOZ_ENABLE_XREMOTE
// use int here instead of a PR type since it will be returned
// from main - just to keep types consistent
static int
-HandleRemoteArgument(const char* remote)
+HandleRemoteArgument(const char* remote, const char* aDesktopStartupID)
{
nsresult rv;
ArgResult ar;
const char *profile = 0;
nsCAutoString program(gAppData->name);
@@ -1143,13 +1153,13 @@ HandleRemoteArgument(const char* remote)
return 1;
}
nsXPIDLCString response;
PRBool success = PR_FALSE;
rv = client.SendCommand(program.get(), username, profile, remote,
- getter_Copies(response), &success);
+ aDesktopStartupID, getter_Copies(response), &success);
// did the command fail?
if (NS_FAILED(rv)) {
PR_fprintf(PR_STDERR, "Error: Failed to send command: %s\n",
response ? response.get() : "No response included");
return 1;
}
@@ -1160,13 +1170,13 @@ HandleRemoteArgument(const char* remote)
}
return 0;
}
static PRBool
-RemoteCommandLine()
+RemoteCommandLine(const char* aDesktopStartupID)
{
nsresult rv;
ArgResult ar;
nsCAutoString program(gAppData->name);
ToLowerCase(program);
@@ -1192,13 +1202,13 @@ RemoteCommandLine()
if (NS_FAILED(rv))
return PR_FALSE;
nsXPIDLCString response;
PRBool success = PR_FALSE;
rv = client.SendCommandLine(program.get(), username, nsnull,
- gArgc, gArgv,
+ gArgc, gArgv, aDesktopStartupID,
getter_Copies(response), &success);
// did the command fail?
if (NS_FAILED(rv) || !success)
return PR_FALSE;
return PR_TRUE;
@@ -2077,12 +2087,47 @@ public:
};
#endif
#ifdef MOZ_WIDGET_GTK2
#include "prlink.h"
typedef void (*_g_set_application_name_fn)(const gchar *application_name);
+
+static nsIWidget* GetMainWidget(nsIDOMWindow* aWindow)
+{
+ // get the native window for this instance
+ nsCOMPtr<nsIScriptGlobalObject> scriptObject
+ (do_QueryInterface(aWindow));
+ NS_ENSURE_TRUE(scriptObject, nsnull);
+
+ nsCOMPtr<nsIBaseWindow> baseWindow
+ (do_QueryInterface(scriptObject->GetDocShell()));
+ NS_ENSURE_TRUE(baseWindow, nsnull);
+
+ nsCOMPtr<nsIWidget> mainWidget;
+ baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
+ return mainWidget;
+}
+
+static nsGTKToolkit* GetGTKToolkit()
+{
+ nsCOMPtr<nsIAppShellService> svc = do_GetService(NS_APPSHELLSERVICE_CONTRACTID);
+ if (!svc)
+ return nsnull;
+ nsCOMPtr<nsIDOMWindowInternal> window;
+ svc->GetHiddenDOMWindow(getter_AddRefs(window));
+ if (!window)
+ return nsnull;
+ nsIWidget* widget = GetMainWidget(window);
+ if (!widget)
+ return nsnull;
+ nsIToolkit* toolkit = widget->GetToolkit();
+ if (!toolkit)
+ return nsnull;
+ return NS_STATIC_CAST(nsGTKToolkit*, toolkit);
+}
+
#endif
int
XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
{
nsresult rv;
@@ -2245,12 +2290,25 @@ XRE_main(int argc, char* argv[], const n
chromeReg->CheckForNewChrome();
}
return 0;
}
+#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2) || defined(MOZ_ENABLE_XREMOTE)
+ // Stash DESKTOP_STARTUP_ID becaus gtk_init will clear it.
+#define HAVE_DESKTOP_STARTUP_ID
+ char* desktopStartupID = PR_GetEnv("DESKTOP_STARTUP_ID");
+ if (desktopStartupID) {
+ if (desktopStartupID[0] == 0) {
+ desktopStartupID = nsnull;
+ } else {
+ desktopStartupID = strdup(desktopStartupID);
+ }
+ }
+#endif
+
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
// setup for private colormap. Ideally we'd like to do this
// in nsAppShell::Create, but we need to get in before gtk
// has been initialized to make sure everything is running
// consistently.
if (CheckArg("install"))
@@ -2270,12 +2328,13 @@ XRE_main(int argc, char* argv[], const n
if (_g_set_application_name) {
_g_set_application_name(gAppData->name);
}
if (glib2) {
PR_UnloadLibrary(glib2);
}
+ gtk_window_set_auto_startup_notification(PR_FALSE);
#endif
gtk_widget_set_default_visual(gdk_rgb_get_visual());
gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
#endif /* MOZ_WIDGET_GTK || MOZ_WIDGET_GTK2 */
@@ -2334,18 +2393,18 @@ XRE_main(int argc, char* argv[], const n
ArgResult ar = CheckArg("remote", &xremotearg);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: -remote requires an argument\n");
return 1;
}
if (ar) {
- return HandleRemoteArgument(xremotearg);
+ return HandleRemoteArgument(xremotearg, desktopStartupID);
}
if (!PR_GetEnv("MOZ_NO_REMOTE")) {
// Try to remote the entire command line. If this fails, start up normally.
- if (RemoteCommandLine())
+ if (RemoteCommandLine(desktopStartupID))
return 0;
}
#endif
#if defined(MOZ_UPDATER)
// If this is a XULRunner app then the updater needs to know the base
@@ -2583,12 +2642,19 @@ XRE_main(int argc, char* argv[], const n
NS_TIMELINE_ENTER("appStartup->CreateHiddenWindow");
rv = appStartup->CreateHiddenWindow();
NS_TIMELINE_LEAVE("appStartup->CreateHiddenWindow");
NS_ENSURE_SUCCESS(rv, 1);
+#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2)
+ nsRefPtr<nsGTKToolkit> toolkit = GetGTKToolkit();
+ if (toolkit && desktopStartupID) {
+ toolkit->SetDesktopStartupID(nsDependentCString(desktopStartupID));
+ }
+#endif
+
// Extension Compatibility Checking and Startup
if (gAppData->flags & NS_XRE_ENABLE_EXTENSION_MANAGER) {
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
NS_ENSURE_TRUE(em, 1);
if (CheckArg("install-global-extension") || CheckArg("install-global-theme")) {
@@ -2763,12 +2829,31 @@ XRE_main(int argc, char* argv[], const n
static char kEnvVar[MAXPATHLEN];
sprintf(kEnvVar, "XRE_BINARY_PATH=%s", gBinaryPath);
PR_SetEnv(kEnvVar);
}
#endif
+#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_TOOLKIT_GTK2)
+ nsGTKToolkit* toolkit = GetGTKToolkit();
+ if (toolkit) {
+ nsCAutoString currentDesktopStartupID;
+ toolkit->GetDesktopStartupID(&currentDesktopStartupID);
+ if (!currentDesktopStartupID.IsEmpty()) {
+ nsCAutoString desktopStartupEnv;
+ desktopStartupEnv.AssignLiteral("DESKTOP_STARTUP_ID=");
+ desktopStartupEnv.Append(currentDesktopStartupID);
+ // Leak it with extreme prejudice!
+ PR_SetEnv(ToNewCString(desktopStartupEnv));
+ }
+ }
+#endif
+
rv = LaunchChild(nativeApp, appInitiatedRestart, upgraded ? -1 : 0);
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
}
+#ifdef HAVE_DESKTOP_STARTUP_ID
+ free(desktopStartupID);
+#endif
+
return NS_FAILED(rv) ? 1 : 0;
}
Index: widget/src/gtk2/nsWindow.cpp
===================================================================
RCS file: /cvsroot/mozilla/widget/src/gtk2/nsWindow.cpp,v
@ -1190,3 +913,283 @@ diff -u -p -6 -r1.145.2.12 nsWindow.cpp
gtk_widget_show(GTK_WIDGET(mContainer));
}
else if (mDrawingarea) {
Index: toolkit/xre/nsAppRunner.cpp
===================================================================
RCS file: /cvsroot/mozilla/toolkit/xre/nsAppRunner.cpp,v
retrieving revision 1.113.2.23
diff -u -p -6 -r1.113.2.23 nsAppRunner.cpp
--- toolkit/xre/nsAppRunner.cpp 9 Sep 2007 06:08:37 -0000 1.113.2.23
+++ toolkit/xre/nsAppRunner.cpp 15 Oct 2007 08:01:52 -0000
@@ -96,12 +96,13 @@
#include "nsIWindowWatcher.h"
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
#ifdef XP_WIN
#include "nsIWinAppHelper.h"
#endif
+#include "nsIScriptGlobalObject.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsEmbedCID.h"
@@ -112,12 +113,18 @@
#include "nsXPFEComponentsCID.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsXULAppAPI.h"
#include "nsXREDirProvider.h"
#include "nsToolkitCompsCID.h"
+#include "nsPIDOMWindow.h"
+#include "nsIDOMWindowInternal.h"
+#include "nsIBaseWindow.h"
+#include "nsIWidget.h"
+#include "nsIDocShell.h"
+#include "nsAppShellCID.h"
#include "nsINIParser.h"
#include "InstallCleanupDefines.h"
#include <stdlib.h>
@@ -260,12 +267,16 @@ static int gRestartArgc;
static char **gRestartArgv;
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
#include <gtk/gtk.h>
#endif //MOZ_WIDGET_GTK || MOZ_WIDGET_GTK2
+#if defined(MOZ_WIDGET_GTK2)
+#include "nsGTKToolkit.h"
+#endif
+
#if defined(MOZ_WIDGET_QT)
#include <qapplication.h>
#endif
// Save the path of the given file to the specified environment variable.
static void
@@ -1121,13 +1132,13 @@ DumpVersion()
}
#ifdef MOZ_ENABLE_XREMOTE
// use int here instead of a PR type since it will be returned
// from main - just to keep types consistent
static int
-HandleRemoteArgument(const char* remote)
+HandleRemoteArgument(const char* remote, const char* aDesktopStartupID)
{
nsresult rv;
ArgResult ar;
const char *profile = 0;
nsCAutoString program(gAppData->name);
@@ -1162,13 +1173,13 @@ HandleRemoteArgument(const char* remote)
return 1;
}
nsXPIDLCString response;
PRBool success = PR_FALSE;
rv = client.SendCommand(program.get(), username, profile, remote,
- getter_Copies(response), &success);
+ aDesktopStartupID, getter_Copies(response), &success);
// did the command fail?
if (NS_FAILED(rv)) {
PR_fprintf(PR_STDERR, "Error: Failed to send command: %s\n",
response ? response.get() : "No response included");
return 1;
}
@@ -1179,13 +1190,13 @@ HandleRemoteArgument(const char* remote)
}
return 0;
}
static RemoteResult
-RemoteCommandLine()
+RemoteCommandLine(const char* aDesktopStartupID)
{
nsresult rv;
ArgResult ar;
nsCAutoString program(gAppData->name);
ToLowerCase(program);
@@ -1211,13 +1222,13 @@ RemoteCommandLine()
if (NS_FAILED(rv))
return REMOTE_NOT_FOUND;
nsXPIDLCString response;
PRBool success = PR_FALSE;
rv = client.SendCommandLine(program.get(), username, nsnull,
- gArgc, gArgv,
+ gArgc, gArgv, aDesktopStartupID,
getter_Copies(response), &success);
// did the command fail?
if (NS_FAILED(rv) || !success)
return REMOTE_NOT_FOUND;
return REMOTE_FOUND;
@@ -2101,13 +2112,48 @@ public:
};
#endif
#ifdef MOZ_WIDGET_GTK2
#include "prlink.h"
typedef void (*_g_set_application_name_fn)(const gchar *application_name);
-#endif
+
+static nsIWidget* GetMainWidget(nsIDOMWindow* aWindow)
+{
+ // get the native window for this instance
+ nsCOMPtr<nsIScriptGlobalObject> scriptObject
+ (do_QueryInterface(aWindow));
+ NS_ENSURE_TRUE(scriptObject, nsnull);
+
+ nsCOMPtr<nsIBaseWindow> baseWindow
+ (do_QueryInterface(scriptObject->GetDocShell()));
+ NS_ENSURE_TRUE(baseWindow, nsnull);
+
+ nsCOMPtr<nsIWidget> mainWidget;
+ baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
+ return mainWidget;
+}
+
+static nsGTKToolkit* GetGTKToolkit()
+{
+ nsCOMPtr<nsIAppShellService> svc = do_GetService(NS_APPSHELLSERVICE_CONTRACTID);
+ if (!svc)
+ return nsnull;
+ nsCOMPtr<nsIDOMWindowInternal> window;
+ svc->GetHiddenDOMWindow(getter_AddRefs(window));
+ if (!window)
+ return nsnull;
+ nsIWidget* widget = GetMainWidget(window);
+ if (!widget)
+ return nsnull;
+ nsIToolkit* toolkit = widget->GetToolkit();
+ if (!toolkit)
+ return nsnull;
+ return NS_STATIC_CAST(nsGTKToolkit*, toolkit);
+}
+
+#endif // MOZ_WIDGET_GTK2
int
XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
{
nsresult rv;
ArgResult ar;
@@ -2285,12 +2331,25 @@ XRE_main(int argc, char* argv[], const n
chromeReg->CheckForNewChrome();
}
return 0;
}
+#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2) || defined(MOZ_ENABLE_XREMOTE)
+ // Stash DESKTOP_STARTUP_ID becaus gtk_init will clear it.
+#define HAVE_DESKTOP_STARTUP_ID
+ char* desktopStartupID = PR_GetEnv("DESKTOP_STARTUP_ID");
+ if (desktopStartupID) {
+ if (desktopStartupID[0] == 0) {
+ desktopStartupID = nsnull;
+ } else {
+ desktopStartupID = strdup(desktopStartupID);
+ }
+ }
+#endif
+
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
// setup for private colormap. Ideally we'd like to do this
// in nsAppShell::Create, but we need to get in before gtk
// has been initialized to make sure everything is running
// consistently.
#if defined(MOZ_WIDGET_GTK2)
@@ -2313,12 +2372,13 @@ XRE_main(int argc, char* argv[], const n
if (_g_set_application_name) {
_g_set_application_name(gAppData->name);
}
if (glib2) {
PR_UnloadLibrary(glib2);
}
+ gtk_window_set_auto_startup_notification(PR_FALSE);
#endif
gtk_widget_set_default_visual(gdk_rgb_get_visual());
gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
#endif /* MOZ_WIDGET_GTK || MOZ_WIDGET_GTK2 */
@@ -2377,18 +2437,18 @@ XRE_main(int argc, char* argv[], const n
ar = CheckArg("remote", PR_TRUE, &xremotearg);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: -remote requires an argument\n");
return 1;
}
if (ar) {
- return HandleRemoteArgument(xremotearg);
+ return HandleRemoteArgument(xremotearg, desktopStartupID);
}
if (!PR_GetEnv("MOZ_NO_REMOTE")) {
// Try to remote the entire command line. If this fails, start up normally.
- RemoteResult rr = RemoteCommandLine();
+ RemoteResult rr = RemoteCommandLine(desktopStartupID);
if (rr == REMOTE_FOUND)
return 0;
else if (rr == REMOTE_ARG_BAD)
return 1;
}
#endif
@@ -2597,12 +2657,19 @@ XRE_main(int argc, char* argv[], const n
NS_TIMELINE_ENTER("appStartup->CreateHiddenWindow");
rv = appStartup->CreateHiddenWindow();
NS_TIMELINE_LEAVE("appStartup->CreateHiddenWindow");
NS_ENSURE_SUCCESS(rv, 1);
+#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2)
+ nsRefPtr<nsGTKToolkit> toolkit = GetGTKToolkit();
+ if (toolkit && desktopStartupID) {
+ toolkit->SetDesktopStartupID(nsDependentCString(desktopStartupID));
+ }
+#endif
+
// Extension Compatibility Checking and Startup
if (gAppData->flags & NS_XRE_ENABLE_EXTENSION_MANAGER) {
nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1"));
NS_ENSURE_TRUE(em, 1);
ar = CheckArg("install-global-extension", PR_TRUE);
@@ -2791,12 +2858,31 @@ XRE_main(int argc, char* argv[], const n
static char kEnvVar[MAXPATHLEN];
sprintf(kEnvVar, "XRE_BINARY_PATH=%s", gBinaryPath);
PR_SetEnv(kEnvVar);
}
#endif
+#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_TOOLKIT_GTK2)
+ nsGTKToolkit* toolkit = GetGTKToolkit();
+ if (toolkit) {
+ nsCAutoString currentDesktopStartupID;
+ toolkit->GetDesktopStartupID(&currentDesktopStartupID);
+ if (!currentDesktopStartupID.IsEmpty()) {
+ nsCAutoString desktopStartupEnv;
+ desktopStartupEnv.AssignLiteral("DESKTOP_STARTUP_ID=");
+ desktopStartupEnv.Append(currentDesktopStartupID);
+ // Leak it with extreme prejudice!
+ PR_SetEnv(ToNewCString(desktopStartupEnv));
+ }
+ }
+#endif
+
rv = LaunchChild(nativeApp, appInitiatedRestart, upgraded ? -1 : 0);
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
}
+#ifdef HAVE_DESKTOP_STARTUP_ID
+ free(desktopStartupID);
+#endif
+
return NS_FAILED(rv) ? 1 : 0;
}