1 From: Lubos Lunak <llunak@suse.cz>, Ginn Chen <ginn.chen@sun.com> |
|
2 Subject: Firefox 3.5 broken startup notification |
|
3 References: |
|
4 http://bugzilla.novell.com/show_bug.cgi?id=518603 |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=416053 |
|
6 https://bugzilla.mozilla.org/show_bug.cgi?id=534845 |
|
7 |
|
8 diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp |
|
9 --- a/toolkit/xre/nsAppRunner.cpp |
|
10 +++ b/toolkit/xre/nsAppRunner.cpp |
|
11 @@ -3370,23 +3370,16 @@ XRE_main(int argc, char* argv[], const n |
|
12 } |
|
13 dirProvider.DoStartup(); |
|
14 |
|
15 PRBool shuttingDown = PR_FALSE; |
|
16 appStartup->GetShuttingDown(&shuttingDown); |
|
17 |
|
18 nsCOMPtr<nsICommandLineRunner> cmdLine; |
|
19 |
|
20 -#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2) |
|
21 - nsRefPtr<nsGTKToolkit> toolkit = GetGTKToolkit(); |
|
22 - if (toolkit && !desktopStartupID.IsEmpty()) { |
|
23 - toolkit->SetDesktopStartupID(desktopStartupID); |
|
24 - } |
|
25 -#endif |
|
26 - |
|
27 nsCOMPtr<nsIFile> workingDir; |
|
28 rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(workingDir)); |
|
29 NS_ENSURE_SUCCESS(rv, 1); |
|
30 |
|
31 if (!shuttingDown) { |
|
32 cmdLine = do_CreateInstance("@mozilla.org/toolkit/command-line;1"); |
|
33 NS_ENSURE_TRUE(cmdLine, 1); |
|
34 |
|
35 @@ -3404,16 +3397,23 @@ XRE_main(int argc, char* argv[], const n |
|
36 |
|
37 NS_TIMELINE_ENTER("appStartup->CreateHiddenWindow"); |
|
38 rv = appStartup->CreateHiddenWindow(); |
|
39 NS_TIMELINE_LEAVE("appStartup->CreateHiddenWindow"); |
|
40 NS_ENSURE_SUCCESS(rv, 1); |
|
41 |
|
42 MOZ_SPLASHSCREEN_UPDATE(50); |
|
43 |
|
44 +#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2) |
|
45 + nsRefPtr<nsGTKToolkit> toolkit = GetGTKToolkit(); |
|
46 + if (toolkit && !desktopStartupID.IsEmpty()) { |
|
47 + toolkit->SetDesktopStartupID(desktopStartupID); |
|
48 + } |
|
49 +#endif |
|
50 + |
|
51 // Extension Compatibility Checking and Startup |
|
52 if (gAppData->flags & NS_XRE_ENABLE_EXTENSION_MANAGER) { |
|
53 nsCOMPtr<nsIExtensionManager> em(do_GetService("@mozilla.org/extensions/manager;1")); |
|
54 NS_ENSURE_TRUE(em, 1); |
|
55 |
|
56 if (upgraded) { |
|
57 rv = em->CheckForMismatches(&needsRestart); |
|
58 if (NS_FAILED(rv)) { |
|
59 @@ -3581,30 +3581,23 @@ XRE_main(int argc, char* argv[], const n |
|
60 #ifdef XP_MACOSX |
|
61 if (gBinaryPath) { |
|
62 static char kEnvVar[MAXPATHLEN]; |
|
63 sprintf(kEnvVar, "XRE_BINARY_PATH=%s", gBinaryPath); |
|
64 PR_SetEnv(kEnvVar); |
|
65 } |
|
66 #endif |
|
67 |
|
68 -// XXXkt s/MOZ_TOOLKIT_GTK2/MOZ_WIDGET_GTK2/? |
|
69 -// but the hidden window has been destroyed so toolkit is NULL anyway. |
|
70 -#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_TOOLKIT_GTK2) |
|
71 - nsGTKToolkit* toolkit = GetGTKToolkit(); |
|
72 - if (toolkit) { |
|
73 - nsCAutoString currentDesktopStartupID; |
|
74 - toolkit->GetDesktopStartupID(¤tDesktopStartupID); |
|
75 - if (!currentDesktopStartupID.IsEmpty()) { |
|
76 - nsCAutoString desktopStartupEnv; |
|
77 - desktopStartupEnv.AssignLiteral("DESKTOP_STARTUP_ID="); |
|
78 - desktopStartupEnv.Append(currentDesktopStartupID); |
|
79 - // Leak it with extreme prejudice! |
|
80 - PR_SetEnv(ToNewCString(desktopStartupEnv)); |
|
81 - } |
|
82 +#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK2) |
|
83 + if (!desktopStartupID.IsEmpty()) { |
|
84 + nsCAutoString desktopStartupEnv; |
|
85 + desktopStartupEnv.AssignLiteral("DESKTOP_STARTUP_ID="); |
|
86 + desktopStartupEnv.Append(desktopStartupID); |
|
87 + // Leak it with extreme prejudice! |
|
88 + PR_SetEnv(ToNewCString(desktopStartupEnv)); |
|
89 } |
|
90 #endif |
|
91 |
|
92 #ifdef MOZ_WIDGET_GTK2 |
|
93 MOZ_gdk_display_close(display); |
|
94 #endif |
|
95 |
|
96 rv = LaunchChild(nativeApp, appInitiatedRestart); |
|