[SVN-Commit] r669 - branches/experimental/www/firefox branches/experimental/www/firefox-beta branches/experimental/www/firefox/files trunk/www/firefox trunk/www/firefox/files

svn-freebsd-gecko at chruetertee.ch svn-freebsd-gecko at chruetertee.ch
Sat Nov 5 14:39:39 UTC 2011


Author: beat
Date: Sat Nov  5 14:39:31 2011
New Revision: 669

Log:
- Sync with ports

Added:
   branches/experimental/www/firefox/files/patch-browser-app-Makefile.in
   branches/experimental/www/firefox/files/patch-browser-app-nsBrowserApp.cpp
   trunk/www/firefox/files/patch-browser-app-Makefile.in
   trunk/www/firefox/files/patch-browser-app-nsBrowserApp.cpp
Modified:
   branches/experimental/www/firefox-beta/Makefile
   branches/experimental/www/firefox/Makefile
   trunk/www/firefox/Makefile

Modified: branches/experimental/www/firefox-beta/Makefile
==============================================================================
--- branches/experimental/www/firefox-beta/Makefile	Sat Nov  5 12:54:03 2011	(r668)
+++ branches/experimental/www/firefox-beta/Makefile	Sat Nov  5 14:39:31 2011	(r669)
@@ -2,7 +2,7 @@
 # Date created:			2002/10/21
 # Whom:				Alan Eldridge <alane at FreeBSD.org>
 #
-# $FreeBSD: ports/www/firefox/Makefile,v 1.251 2011/09/30 15:07:49 beat Exp $
+# $FreeBSD: ports/www/firefox/Makefile,v 1.255 2011/11/02 18:42:50 eadler Exp $
 #
 
 PORTNAME=	firefox
@@ -139,6 +139,7 @@
 
 port-pre-install:
 	${ECHO_CMD} 'share/applications/${MOZILLA}.desktop' >> ${PLISTF}
+	${ECHO_CMD} "@exec mkdir -p %D/include/firefox/nss" >> ${PLISTD}
 	${ECHO_CMD} "@dirrmtry share/applications" >> ${PLISTD}
 	${ECHO_CMD} 'share/pixmaps/${FIREFOX_ICON}' >> ${PLISTF}
 

Modified: branches/experimental/www/firefox/Makefile
==============================================================================
--- branches/experimental/www/firefox/Makefile	Sat Nov  5 12:54:03 2011	(r668)
+++ branches/experimental/www/firefox/Makefile	Sat Nov  5 14:39:31 2011	(r669)
@@ -2,12 +2,12 @@
 # Date created:			2002/10/21
 # Whom:				Alan Eldridge <alane at FreeBSD.org>
 #
-# $FreeBSD: ports/www/firefox/Makefile,v 1.252 2011/10/19 19:29:28 beat Exp $
+# $FreeBSD: ports/www/firefox/Makefile,v 1.255 2011/11/02 18:42:50 eadler Exp $
 #
 
 PORTNAME=	firefox
 DISTVERSION=	7.0.1
-PORTREVISION=	1
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	${MASTER_SITE_MOZILLA}
@@ -146,15 +146,9 @@
 	(cd ${WRKSRC} && ${GMAKE} distclean)
 .endif
 
-post-build:
-	${RM} ${WRKSRC}/dist/bin/${PORTNAME}
-	${ECHO_CMD} "#!/bin/sh" > ${WRKSRC}/dist/bin/${PORTNAME}
-	${ECHO_CMD} "cd ${PREFIX}/lib/firefox && ./run-mozilla.sh ./firefox-bin" \
-		>> ${WRKSRC}/dist/bin/${PORTNAME}
-	${CHMOD} 755 ${WRKSRC}/dist/bin/${PORTNAME}
-
 port-pre-install:
 	${ECHO_CMD} 'share/applications/${MOZILLA}.desktop' >> ${PLISTF}
+	${ECHO_CMD} "@exec mkdir -p %D/include/firefox/nss" >> ${PLISTD}
 	${ECHO_CMD} "@dirrmtry share/applications" >> ${PLISTD}
 	${ECHO_CMD} 'share/pixmaps/${FIREFOX_ICON}' >> ${PLISTF}
 

Added: branches/experimental/www/firefox/files/patch-browser-app-Makefile.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/experimental/www/firefox/files/patch-browser-app-Makefile.in	Sat Nov  5 14:39:31 2011	(r669)
@@ -0,0 +1,63 @@
+--- browser/app/Makefile.in	2011-09-28 22:24:36.000000000 +0200
++++ ../../ff6/mozilla-release/browser/app/Makefile.in	2011-09-02 22:15:19.000000000 +0200
+@@ -92,22 +91,35 @@
+ else
+ # Build a binary bootstrapping with XRE_main
+ 
++ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
++else
++PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
++endif
+ 
+ CPPSRCS = nsBrowserApp.cpp
+ 
+ LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
+ LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
+-LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
+ 
+-DEFINES += -DXPCOM_GLUE
+-STL_FLAGS=
++ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
++LIBS += $(DIST)/bin/XUL
++TK_LIBS := $(TK_LIBS)
++else
++EXTRA_DSO_LIBS += xul
++endif
+ 
+ LIBS += \
++	$(STATIC_COMPONENTS_LINKER_PATH) \
+ 	$(EXTRA_DSO_LIBS) \
+-	$(XPCOM_STANDALONE_GLUE_LDOPTS) \
++	$(XPCOM_GLUE_LDOPTS) \
++	$(NSPR_LIBS) \
+ 	$(NULL)
+ 
++ifdef MOZ_JPROF
++LIBS += -ljprof
++endif
++
+ ifndef MOZ_WINCONSOLE
+ ifdef MOZ_DEBUG
+ MOZ_WINCONSOLE = 1
+@@ -182,9 +194,18 @@
+ 
+ ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
+ 
+-libs:: 
+-	cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
++$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
++	cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
++		-e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
++	chmod +x $@
++
++libs:: $(MOZ_APP_NAME)
++	$(INSTALL) $< $(DIST)/bin
++
++install:: $(MOZ_APP_NAME)
++	$(SYSINSTALL) $< $(DESTDIR)$(bindir)
+ 
++GARBAGE += $(MOZ_APP_NAME)
+ GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
+ 
+ endif

Added: branches/experimental/www/firefox/files/patch-browser-app-nsBrowserApp.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/experimental/www/firefox/files/patch-browser-app-nsBrowserApp.cpp	Sat Nov  5 14:39:31 2011	(r669)
@@ -0,0 +1,221 @@
+--- browser/app/nsBrowserApp.cpp	2011-09-28 22:24:36.000000000 +0200
++++ ../../ff6/mozilla-release/browser/app/nsBrowserApp.cpp	2011-09-02 22:15:19.000000000 +0200
+@@ -36,19 +36,14 @@
+  *
+  * ***** END LICENSE BLOCK ***** */
+ 
+-#include "nsXPCOMGlue.h"
+ #include "nsXULAppAPI.h"
+-#if defined(XP_WIN)
++#ifdef XP_WIN
+ #include <windows.h>
+ #include <stdlib.h>
+-#elif defined(XP_UNIX)
+-#include <sys/time.h>
+-#include <sys/resource.h>
+ #endif
+ 
+ #include <stdio.h>
+ #include <stdarg.h>
+-#include <string.h>
+ 
+ #include "plstr.h"
+ #include "prprf.h"
+@@ -59,16 +54,11 @@
+ #include "nsStringGlue.h"
+ 
+ #ifdef XP_WIN
++// we want to use the DLL blocklist if possible
++#define XRE_WANT_DLL_BLOCKLIST
+ // we want a wmain entry point
+ #include "nsWindowsWMain.cpp"
+-#define snprintf _snprintf
+-#define strcasecmp _stricmp
+ #endif
+-#include "BinaryPath.h"
+-
+-#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
+-
+-#include "mozilla/Telemetry.h"
+ 
+ static void Output(const char *fmt, ... )
+ {
+@@ -95,12 +85,12 @@
+   {
+     if (*++arg == '-')
+       ++arg;
+-    return !strcasecmp(arg, s);
++    return !PL_strcasecmp(arg, s);
+   }
+ 
+ #if defined(XP_WIN) || defined(XP_OS2)
+   if (*arg == '/')
+-    return !strcasecmp(++arg, s);
++    return !PL_strcasecmp(++arg, s);
+ #endif
+ 
+   return PR_FALSE;
+@@ -116,48 +106,22 @@
+   ~ScopedLogging() { NS_LogTerm(); }
+ };
+ 
+-XRE_GetFileFromPathType XRE_GetFileFromPath;
+-XRE_CreateAppDataType XRE_CreateAppData;
+-XRE_FreeAppDataType XRE_FreeAppData;
+-#ifdef XRE_HAS_DLL_BLOCKLIST
+-XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
+-#endif
+-XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
+-XRE_mainType XRE_main;
+-
+-static const nsDynamicFunctionLoad kXULFuncs[] = {
+-    { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
+-    { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
+-    { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
+-#ifdef XRE_HAS_DLL_BLOCKLIST
+-    { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
+-#endif
+-    { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
+-    { "XRE_main", (NSFuncPtr*) &XRE_main },
+-    { nsnull, nsnull }
+-};
+-
+-static int do_main(const char *exePath, int argc, char* argv[])
++int main(int argc, char* argv[])
+ {
++  ScopedLogging log;
++
+   nsCOMPtr<nsILocalFile> appini;
+-#ifdef XP_WIN
+-  // exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
+-  // encoded path, so it is safe to convert it
+-  nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
+-                                getter_AddRefs(appini));
+-#else
+-  nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
+-                                      getter_AddRefs(appini));
+-#endif
++  nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
+   if (NS_FAILED(rv)) {
++    Output("Couldn't calculate the application directory.");
+     return 255;
+   }
+-
+   appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
+ 
+   // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
+   // Note that -app must be the *first* argument.
+-  const char *appDataFile = getenv("XUL_APP_FILE");
++  char *appEnv = nsnull;
++  const char *appDataFile = PR_GetEnv("XUL_APP_FILE");
+   if (appDataFile && *appDataFile) {
+     rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
+     if (NS_FAILED(rv)) {
+@@ -177,12 +141,8 @@
+       return 255;
+     }
+ 
+-    char appEnv[MAXPATHLEN];
+-    snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
+-    if (putenv(appEnv)) {
+-      Output("Couldn't set %s.\n", appEnv);
+-      return 255;
+-    }
++    appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
++    PR_SetEnv(appEnv);
+     argv[2] = argv[0];
+     argv += 2;
+     argc -= 2;
+@@ -197,90 +157,7 @@
+ 
+   int result = XRE_main(argc, argv, appData);
+   XRE_FreeAppData(appData);
+-  return result;
+-}
+-
+-int main(int argc, char* argv[])
+-{
+-  char exePath[MAXPATHLEN];
+-
+-  nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
+-  if (NS_FAILED(rv)) {
+-    Output("Couldn't calculate the application directory.\n");
+-    return 255;
+-  }
+-
+-  char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
+-  if (!lastSlash || (lastSlash - exePath > MAXPATHLEN - sizeof(XPCOM_DLL) - 1))
+-    return 255;
+-
+-  strcpy(++lastSlash, XPCOM_DLL);
+-
+-  int gotCounters;
+-#if defined(XP_UNIX)
+-  struct rusage initialRUsage;
+-  gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
+-#elif defined(XP_WIN)
+-  // GetProcessIoCounters().ReadOperationCount seems to have little to
+-  // do with actual read operations. It reports 0 or 1 at this stage
+-  // in the program. Luckily 1 coincides with when prefetch is
+-  // enabled. If Windows prefetch didn't happen we can do our own
+-  // faster dll preloading.
+-  IO_COUNTERS ioCounters;
+-  gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
+-  if (gotCounters && !ioCounters.ReadOperationCount)
+-#endif
+-  {
+-      XPCOMGlueEnablePreload();
+-  }
+-
+-
+-  rv = XPCOMGlueStartup(exePath);
+-  if (NS_FAILED(rv)) {
+-    Output("Couldn't load XPCOM.\n");
+-    return 255;
+-  }
+-
+-  rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
+-  if (NS_FAILED(rv)) {
+-    Output("Couldn't load XRE functions.\n");
+-    return 255;
+-  }
+-
+-#ifdef XRE_HAS_DLL_BLOCKLIST
+-  XRE_SetupDllBlocklist();
+-#endif
+-
+-  if (gotCounters) {
+-#if defined(XP_WIN)
+-    XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
+-                            int(ioCounters.ReadOperationCount));
+-    XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
+-                            int(ioCounters.ReadTransferCount / 1024));
+-    IO_COUNTERS newIoCounters;
+-    if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
+-      XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
+-                              int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
+-      XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
+-                              int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
+-    }
+-#elif defined(XP_UNIX)
+-    XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
+-                            int(initialRUsage.ru_majflt));
+-    struct rusage newRUsage;
+-    if (!getrusage(RUSAGE_SELF, &newRUsage)) {
+-      XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
+-                              int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
+-    }
+-#endif
+-  }
+-
+-  int result;
+-  {
+-    ScopedLogging log;
+-    result = do_main(exePath, argc, argv);
+-  }
+-
+-  XPCOMGlueShutdown();
++  if (appEnv)
++    PR_smprintf_free(appEnv);
+   return result;
+ }

Modified: trunk/www/firefox/Makefile
==============================================================================
--- trunk/www/firefox/Makefile	Sat Nov  5 12:54:03 2011	(r668)
+++ trunk/www/firefox/Makefile	Sat Nov  5 14:39:31 2011	(r669)
@@ -2,12 +2,12 @@
 # Date created:			2002/10/21
 # Whom:				Alan Eldridge <alane at FreeBSD.org>
 #
-# $FreeBSD: ports/www/firefox/Makefile,v 1.252 2011/10/19 19:29:28 beat Exp $
+# $FreeBSD: ports/www/firefox/Makefile,v 1.255 2011/11/02 18:42:50 eadler Exp $
 #
 
 PORTNAME=	firefox
 DISTVERSION=	7.0.1
-PORTREVISION=	1
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	${MASTER_SITE_MOZILLA}
@@ -137,15 +137,9 @@
 	(cd ${WRKSRC} && ${GMAKE} distclean)
 .endif
 
-post-build:
-	${RM} ${WRKSRC}/dist/bin/${PORTNAME}
-	${ECHO_CMD} "#!/bin/sh" > ${WRKSRC}/dist/bin/${PORTNAME}
-	${ECHO_CMD} "cd ${PREFIX}/lib/firefox && ./run-mozilla.sh ./firefox-bin" \
-		>> ${WRKSRC}/dist/bin/${PORTNAME}
-	${CHMOD} 755 ${WRKSRC}/dist/bin/${PORTNAME}
-
 port-pre-install:
 	${ECHO_CMD} 'share/applications/${MOZILLA}.desktop' >> ${PLISTF}
+	${ECHO_CMD} "@exec mkdir -p %D/include/firefox/nss" >> ${PLISTD}
 	${ECHO_CMD} "@dirrmtry share/applications" >> ${PLISTD}
 	${ECHO_CMD} 'share/pixmaps/${FIREFOX_ICON}' >> ${PLISTF}
 

Added: trunk/www/firefox/files/patch-browser-app-Makefile.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/www/firefox/files/patch-browser-app-Makefile.in	Sat Nov  5 14:39:31 2011	(r669)
@@ -0,0 +1,63 @@
+--- browser/app/Makefile.in	2011-09-28 22:24:36.000000000 +0200
++++ ../../ff6/mozilla-release/browser/app/Makefile.in	2011-09-02 22:15:19.000000000 +0200
+@@ -92,22 +91,35 @@
+ else
+ # Build a binary bootstrapping with XRE_main
+ 
++ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
++else
++PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
++endif
+ 
+ CPPSRCS = nsBrowserApp.cpp
+ 
+ LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
+ LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
+-LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
+ 
+-DEFINES += -DXPCOM_GLUE
+-STL_FLAGS=
++ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
++LIBS += $(DIST)/bin/XUL
++TK_LIBS := $(TK_LIBS)
++else
++EXTRA_DSO_LIBS += xul
++endif
+ 
+ LIBS += \
++	$(STATIC_COMPONENTS_LINKER_PATH) \
+ 	$(EXTRA_DSO_LIBS) \
+-	$(XPCOM_STANDALONE_GLUE_LDOPTS) \
++	$(XPCOM_GLUE_LDOPTS) \
++	$(NSPR_LIBS) \
+ 	$(NULL)
+ 
++ifdef MOZ_JPROF
++LIBS += -ljprof
++endif
++
+ ifndef MOZ_WINCONSOLE
+ ifdef MOZ_DEBUG
+ MOZ_WINCONSOLE = 1
+@@ -182,9 +194,18 @@
+ 
+ ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
+ 
+-libs:: 
+-	cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
++$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
++	cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
++		-e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
++	chmod +x $@
++
++libs:: $(MOZ_APP_NAME)
++	$(INSTALL) $< $(DIST)/bin
++
++install:: $(MOZ_APP_NAME)
++	$(SYSINSTALL) $< $(DESTDIR)$(bindir)
+ 
++GARBAGE += $(MOZ_APP_NAME)
+ GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
+ 
+ endif

Added: trunk/www/firefox/files/patch-browser-app-nsBrowserApp.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/www/firefox/files/patch-browser-app-nsBrowserApp.cpp	Sat Nov  5 14:39:31 2011	(r669)
@@ -0,0 +1,221 @@
+--- browser/app/nsBrowserApp.cpp	2011-09-28 22:24:36.000000000 +0200
++++ ../../ff6/mozilla-release/browser/app/nsBrowserApp.cpp	2011-09-02 22:15:19.000000000 +0200
+@@ -36,19 +36,14 @@
+  *
+  * ***** END LICENSE BLOCK ***** */
+ 
+-#include "nsXPCOMGlue.h"
+ #include "nsXULAppAPI.h"
+-#if defined(XP_WIN)
++#ifdef XP_WIN
+ #include <windows.h>
+ #include <stdlib.h>
+-#elif defined(XP_UNIX)
+-#include <sys/time.h>
+-#include <sys/resource.h>
+ #endif
+ 
+ #include <stdio.h>
+ #include <stdarg.h>
+-#include <string.h>
+ 
+ #include "plstr.h"
+ #include "prprf.h"
+@@ -59,16 +54,11 @@
+ #include "nsStringGlue.h"
+ 
+ #ifdef XP_WIN
++// we want to use the DLL blocklist if possible
++#define XRE_WANT_DLL_BLOCKLIST
+ // we want a wmain entry point
+ #include "nsWindowsWMain.cpp"
+-#define snprintf _snprintf
+-#define strcasecmp _stricmp
+ #endif
+-#include "BinaryPath.h"
+-
+-#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
+-
+-#include "mozilla/Telemetry.h"
+ 
+ static void Output(const char *fmt, ... )
+ {
+@@ -95,12 +85,12 @@
+   {
+     if (*++arg == '-')
+       ++arg;
+-    return !strcasecmp(arg, s);
++    return !PL_strcasecmp(arg, s);
+   }
+ 
+ #if defined(XP_WIN) || defined(XP_OS2)
+   if (*arg == '/')
+-    return !strcasecmp(++arg, s);
++    return !PL_strcasecmp(++arg, s);
+ #endif
+ 
+   return PR_FALSE;
+@@ -116,48 +106,22 @@
+   ~ScopedLogging() { NS_LogTerm(); }
+ };
+ 
+-XRE_GetFileFromPathType XRE_GetFileFromPath;
+-XRE_CreateAppDataType XRE_CreateAppData;
+-XRE_FreeAppDataType XRE_FreeAppData;
+-#ifdef XRE_HAS_DLL_BLOCKLIST
+-XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
+-#endif
+-XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
+-XRE_mainType XRE_main;
+-
+-static const nsDynamicFunctionLoad kXULFuncs[] = {
+-    { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
+-    { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
+-    { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
+-#ifdef XRE_HAS_DLL_BLOCKLIST
+-    { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
+-#endif
+-    { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
+-    { "XRE_main", (NSFuncPtr*) &XRE_main },
+-    { nsnull, nsnull }
+-};
+-
+-static int do_main(const char *exePath, int argc, char* argv[])
++int main(int argc, char* argv[])
+ {
++  ScopedLogging log;
++
+   nsCOMPtr<nsILocalFile> appini;
+-#ifdef XP_WIN
+-  // exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
+-  // encoded path, so it is safe to convert it
+-  nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
+-                                getter_AddRefs(appini));
+-#else
+-  nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
+-                                      getter_AddRefs(appini));
+-#endif
++  nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
+   if (NS_FAILED(rv)) {
++    Output("Couldn't calculate the application directory.");
+     return 255;
+   }
+-
+   appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
+ 
+   // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
+   // Note that -app must be the *first* argument.
+-  const char *appDataFile = getenv("XUL_APP_FILE");
++  char *appEnv = nsnull;
++  const char *appDataFile = PR_GetEnv("XUL_APP_FILE");
+   if (appDataFile && *appDataFile) {
+     rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
+     if (NS_FAILED(rv)) {
+@@ -177,12 +141,8 @@
+       return 255;
+     }
+ 
+-    char appEnv[MAXPATHLEN];
+-    snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
+-    if (putenv(appEnv)) {
+-      Output("Couldn't set %s.\n", appEnv);
+-      return 255;
+-    }
++    appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
++    PR_SetEnv(appEnv);
+     argv[2] = argv[0];
+     argv += 2;
+     argc -= 2;
+@@ -197,90 +157,7 @@
+ 
+   int result = XRE_main(argc, argv, appData);
+   XRE_FreeAppData(appData);
+-  return result;
+-}
+-
+-int main(int argc, char* argv[])
+-{
+-  char exePath[MAXPATHLEN];
+-
+-  nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
+-  if (NS_FAILED(rv)) {
+-    Output("Couldn't calculate the application directory.\n");
+-    return 255;
+-  }
+-
+-  char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
+-  if (!lastSlash || (lastSlash - exePath > MAXPATHLEN - sizeof(XPCOM_DLL) - 1))
+-    return 255;
+-
+-  strcpy(++lastSlash, XPCOM_DLL);
+-
+-  int gotCounters;
+-#if defined(XP_UNIX)
+-  struct rusage initialRUsage;
+-  gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
+-#elif defined(XP_WIN)
+-  // GetProcessIoCounters().ReadOperationCount seems to have little to
+-  // do with actual read operations. It reports 0 or 1 at this stage
+-  // in the program. Luckily 1 coincides with when prefetch is
+-  // enabled. If Windows prefetch didn't happen we can do our own
+-  // faster dll preloading.
+-  IO_COUNTERS ioCounters;
+-  gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
+-  if (gotCounters && !ioCounters.ReadOperationCount)
+-#endif
+-  {
+-      XPCOMGlueEnablePreload();
+-  }
+-
+-
+-  rv = XPCOMGlueStartup(exePath);
+-  if (NS_FAILED(rv)) {
+-    Output("Couldn't load XPCOM.\n");
+-    return 255;
+-  }
+-
+-  rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
+-  if (NS_FAILED(rv)) {
+-    Output("Couldn't load XRE functions.\n");
+-    return 255;
+-  }
+-
+-#ifdef XRE_HAS_DLL_BLOCKLIST
+-  XRE_SetupDllBlocklist();
+-#endif
+-
+-  if (gotCounters) {
+-#if defined(XP_WIN)
+-    XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
+-                            int(ioCounters.ReadOperationCount));
+-    XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
+-                            int(ioCounters.ReadTransferCount / 1024));
+-    IO_COUNTERS newIoCounters;
+-    if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
+-      XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
+-                              int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
+-      XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
+-                              int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
+-    }
+-#elif defined(XP_UNIX)
+-    XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
+-                            int(initialRUsage.ru_majflt));
+-    struct rusage newRUsage;
+-    if (!getrusage(RUSAGE_SELF, &newRUsage)) {
+-      XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
+-                              int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
+-    }
+-#endif
+-  }
+-
+-  int result;
+-  {
+-    ScopedLogging log;
+-    result = do_main(exePath, argc, argv);
+-  }
+-
+-  XPCOMGlueShutdown();
++  if (appEnv)
++    PR_smprintf_free(appEnv);
+   return result;
+ }


More information about the freebsd-gecko mailing list