Skip to content

Commit e3a9a86

Browse files
committed
Back out 6b23b52e68d6 - e92f98e8a335 (bug 632404, 552864, 658995) because of Tp4 regression.
1 parent 93063fa commit e3a9a86

27 files changed

+304
-690
lines changed

browser/app/Makefile.in

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,29 @@ include $(topsrcdir)/config/rules.mk
9191
else
9292
# Build a binary bootstrapping with XRE_main
9393

94+
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
9495
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
96+
else
97+
PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
98+
endif
9599

96100
CPPSRCS = nsBrowserApp.cpp
97101

98102
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
99103
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
100-
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
101104

102-
DEFINES += -DXPCOM_GLUE
103-
STL_FLAGS=
105+
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
106+
LIBS += $(DIST)/bin/XUL
107+
TK_LIBS := $(TK_LIBS)
108+
else
109+
EXTRA_DSO_LIBS += xul
110+
endif
104111

105112
LIBS += \
113+
$(STATIC_COMPONENTS_LINKER_PATH) \
106114
$(EXTRA_DSO_LIBS) \
107-
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
115+
$(XPCOM_GLUE_LDOPTS) \
116+
$(NSPR_LIBS) \
108117
$(NULL)
109118

110119
ifdef MOZ_JPROF
@@ -185,9 +194,18 @@ endif
185194

186195
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
187196

188-
libs::
189-
cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
197+
$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
198+
cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
199+
-e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
200+
chmod +x $@
201+
202+
libs:: $(MOZ_APP_NAME)
203+
$(INSTALL) $< $(DIST)/bin
204+
205+
install:: $(MOZ_APP_NAME)
206+
$(SYSINSTALL) $< $(DESTDIR)$(bindir)
190207

208+
GARBAGE += $(MOZ_APP_NAME)
191209
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
192210

193211
endif
@@ -255,7 +273,7 @@ libs repackage:: $(PROGRAM) application.ini
255273
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
256274
$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
257275
ifdef LIBXUL_SDK
258-
cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox
276+
cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox-bin
259277
else
260278
$(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
261279
rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS

browser/app/macbuild/Contents/Info.plist.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
</dict>
144144
</array>
145145
<key>CFBundleExecutable</key>
146-
<string>firefox</string>
146+
<string>firefox-bin</string>
147147
<key>CFBundleGetInfoString</key>
148148
<string>%APP_NAME% %APP_VERSION%</string>
149149
<key>CFBundleIconFile</key>

browser/app/nsBrowserApp.cpp

Lines changed: 15 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
*
3737
* ***** END LICENSE BLOCK ***** */
3838

39-
#include "nsXPCOMGlue.h"
4039
#include "nsXULAppAPI.h"
4140
#ifdef XP_WIN
4241
#include <windows.h>
@@ -45,7 +44,6 @@
4544

4645
#include <stdio.h>
4746
#include <stdarg.h>
48-
#include <string.h>
4947

5048
#include "plstr.h"
5149
#include "prprf.h"
@@ -56,14 +54,11 @@
5654
#include "nsStringGlue.h"
5755

5856
#ifdef XP_WIN
57+
// we want to use the DLL blocklist if possible
58+
#define XRE_WANT_DLL_BLOCKLIST
5959
// we want a wmain entry point
6060
#include "nsWindowsWMain.cpp"
61-
#define snprintf _snprintf
62-
#define strcasecmp _stricmp
6361
#endif
64-
#include "BinaryPath.h"
65-
66-
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
6762

6863
static void Output(const char *fmt, ... )
6964
{
@@ -90,12 +85,12 @@ static PRBool IsArg(const char* arg, const char* s)
9085
{
9186
if (*++arg == '-')
9287
++arg;
93-
return !strcasecmp(arg, s);
88+
return !PL_strcasecmp(arg, s);
9489
}
9590

9691
#if defined(XP_WIN) || defined(XP_OS2)
9792
if (*arg == '/')
98-
return !strcasecmp(++arg, s);
93+
return !PL_strcasecmp(++arg, s);
9994
#endif
10095

10196
return PR_FALSE;
@@ -111,46 +106,22 @@ class ScopedLogging
111106
~ScopedLogging() { NS_LogTerm(); }
112107
};
113108

114-
XRE_GetFileFromPathType XRE_GetFileFromPath;
115-
XRE_CreateAppDataType XRE_CreateAppData;
116-
XRE_FreeAppDataType XRE_FreeAppData;
117-
#ifdef XRE_HAS_DLL_BLOCKLIST
118-
XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
119-
#endif
120-
XRE_mainType XRE_main;
121-
122-
static const nsDynamicFunctionLoad kXULFuncs[] = {
123-
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
124-
{ "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
125-
{ "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
126-
#ifdef XRE_HAS_DLL_BLOCKLIST
127-
{ "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
128-
#endif
129-
{ "XRE_main", (NSFuncPtr*) &XRE_main },
130-
{ nsnull, nsnull }
131-
};
132-
133-
static int do_main(const char *exePath, int argc, char* argv[])
109+
int main(int argc, char* argv[])
134110
{
111+
ScopedLogging log;
112+
135113
nsCOMPtr<nsILocalFile> appini;
136-
#ifdef XP_WIN
137-
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
138-
// encoded path, so it is safe to convert it
139-
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
140-
getter_AddRefs(appini));
141-
#else
142-
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
143-
getter_AddRefs(appini));
144-
#endif
114+
nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
145115
if (NS_FAILED(rv)) {
116+
Output("Couldn't calculate the application directory.");
146117
return 255;
147118
}
148-
149119
appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
150120

151121
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
152122
// Note that -app must be the *first* argument.
153-
const char *appDataFile = getenv("XUL_APP_FILE");
123+
char *appEnv = nsnull;
124+
const char *appDataFile = PR_GetEnv("XUL_APP_FILE");
154125
if (appDataFile && *appDataFile) {
155126
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
156127
if (NS_FAILED(rv)) {
@@ -170,12 +141,8 @@ static int do_main(const char *exePath, int argc, char* argv[])
170141
return 255;
171142
}
172143

173-
char appEnv[MAXPATHLEN];
174-
snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
175-
if (putenv(appEnv)) {
176-
Output("Couldn't set %s.\n", appEnv);
177-
return 255;
178-
}
144+
appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
145+
PR_SetEnv(appEnv);
179146
argv[2] = argv[0];
180147
argv += 2;
181148
argc -= 2;
@@ -190,62 +157,7 @@ static int do_main(const char *exePath, int argc, char* argv[])
190157

191158
int result = XRE_main(argc, argv, appData);
192159
XRE_FreeAppData(appData);
193-
return result;
194-
}
195-
196-
int main(int argc, char* argv[])
197-
{
198-
char exePath[MAXPATHLEN];
199-
200-
nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
201-
if (NS_FAILED(rv)) {
202-
Output("Couldn't calculate the application directory.\n");
203-
return 255;
204-
}
205-
206-
char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
207-
if (!lastSlash || (lastSlash - exePath > MAXPATHLEN - sizeof(XPCOM_DLL) - 1))
208-
return 255;
209-
210-
strcpy(++lastSlash, XPCOM_DLL);
211-
212-
#ifdef XP_WIN
213-
// GetProcessIoCounters().ReadOperationCount seems to have little to
214-
// do with actual read operations. It reports 0 or 1 at this stage
215-
// in the program. Luckily 1 coincides with when prefetch is
216-
// enabled. If Windows prefetch didn't happen we can do our own
217-
// faster dll preloading.
218-
IO_COUNTERS ioCounters;
219-
if (GetProcessIoCounters(GetCurrentProcess(), &ioCounters)
220-
&& !ioCounters.ReadOperationCount)
221-
#endif
222-
{
223-
XPCOMGlueEnablePreload();
224-
}
225-
226-
227-
rv = XPCOMGlueStartup(exePath);
228-
if (NS_FAILED(rv)) {
229-
Output("Couldn't load XPCOM.\n");
230-
return 255;
231-
}
232-
233-
rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
234-
if (NS_FAILED(rv)) {
235-
Output("Couldn't load XRE functions.\n");
236-
return 255;
237-
}
238-
239-
#ifdef XRE_HAS_DLL_BLOCKLIST
240-
XRE_SetupDllBlocklist();
241-
#endif
242-
243-
int result;
244-
{
245-
ScopedLogging log;
246-
result = do_main(exePath, argc, argv);
247-
}
248-
249-
XPCOMGlueShutdown();
160+
if (appEnv)
161+
PR_smprintf_free(appEnv);
250162
return result;
251163
}

dom/plugins/ipc/PluginProcessChild.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ PluginProcessChild::Init()
146146
protectCurrentDirectory = false;
147147
}
148148
if (protectCurrentDirectory) {
149-
SanitizeEnvironmentVariables();
150149
NS_SetDllDirectory(L"");
151150
}
152151

ipc/app/MozillaRuntimeMain.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ main(int argc, char* argv[])
7373
// avoid it for unsupported plugins. See PluginProcessChild::Init for
7474
// the details.
7575
if (proctype != GeckoProcessType_Plugin) {
76-
mozilla::SanitizeEnvironmentVariables();
7776
mozilla::NS_SetDllDirectory(L"");
7877
}
7978
#endif

netwerk/base/src/nsStandardURL.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,7 @@ nsStandardURL::~nsStandardURL()
325325
}
326326

327327
#ifdef DEBUG_DUMP_URLS_AT_SHUTDOWN
328-
struct DumpLeakedURLs {
329-
DumpLeakedURLs() {}
330-
~DumpLeakedURLs();
331-
};
332-
333-
DumpLeakedURLs::~DumpLeakedURLs()
328+
static void DumpLeakedURLs()
334329
{
335330
if (!PR_CLIST_IS_EMPTY(&gAllURLs)) {
336331
printf("Leaked URLs:\n");
@@ -368,12 +363,8 @@ nsStandardURL::ShutdownGlobalObjects()
368363
NS_IF_RELEASE(gCharsetMgr);
369364

370365
#ifdef DEBUG_DUMP_URLS_AT_SHUTDOWN
371-
if (gInitialized) {
372-
// This instanciates a dummy class, and will trigger the class
373-
// destructor when libxul is unloaded. This is equivalent to atexit(),
374-
// but gracefully handles dlclose().
375-
static DumpLeakedURLs d;
376-
}
366+
if (gInitialized)
367+
atexit(DumpLeakedURLs);
377368
#endif
378369
}
379370

profile/dirserviceprovider/src/nsProfileLock.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,7 @@ nsresult nsProfileLock::LockWithSymlink(const nsACString& lockFilePath, PRBool a
390390
if (!setupPidLockCleanup++)
391391
{
392392
// Clean up on normal termination.
393-
// This instanciates a dummy class, and will trigger the class
394-
// destructor when libxul is unloaded. This is equivalent to atexit(),
395-
// but gracefully handles dlclose().
396-
static RemovePidLockFilesExiting r;
393+
atexit(RemovePidLockFilesExiting);
397394

398395
// Clean up on abnormal termination, using POSIX sigaction.
399396
// Don't arm a handler if the signal is being ignored, e.g.,

profile/dirserviceprovider/src/nsProfileLock.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,14 @@ class nsProfileLock
9999
LHANDLE mLockFileHandle;
100100
#elif defined (XP_UNIX)
101101

102-
struct RemovePidLockFilesExiting {
103-
RemovePidLockFilesExiting() {}
104-
~RemovePidLockFilesExiting() {
105-
RemovePidLockFiles(PR_FALSE);
106-
}
107-
};
102+
static void RemovePidLockFilesExiting()
103+
{
104+
// We can't implement this function with a default parameter on
105+
// RemovePidLockFiles(aFatalSignal) since we register
106+
// atexit(RemovePidLockFilesExiting).
107+
108+
RemovePidLockFiles(PR_FALSE);
109+
}
108110

109111
static void RemovePidLockFiles(PRBool aFatalSignal);
110112
static void FatalSignalHandler(int signo

toolkit/xre/Makefile.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ endif
9292

9393
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
9494
CPPSRCS += nsNativeAppSupportWin.cpp
95-
CPPSRCS += nsWindowsDllBlocklist.cpp
9695
DEFINES += -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE
9796
EXPORTS = nsWindowsDllInterceptor.h
9897
else
@@ -192,7 +191,6 @@ LOCAL_INCLUDES += \
192191
-I$(topsrcdir)/dom/ipc \
193192
-I$(topsrcdir)/toolkit/crashreporter \
194193
-I$(topsrcdir)/dom/base \
195-
-I$(topsrcdir)/xpcom/build \
196194
$(NULL)
197195

198196
LOCAL_INCLUDES += \

0 commit comments

Comments
 (0)