bug 507288: move greprefs/*js into res/greprefs.js r=bsmedberg
authorTaras Glek <tglek@mozilla.com>
Sun, 04 Oct 2009 12:44:52 +0200
changeset 33442 0e8fae2dd64c1b0e8b318e581305846051cc1d37
parent 33441 ddc7f06560c6585a65f003e6ec159e30895395ce
child 33443 44694b467f519f6c7f7d61587cd18abba21aa3a2
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs507288
milestone1.9.3a1pre
bug 507288: move greprefs/*js into res/greprefs.js r=bsmedberg cdiff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
browser/installer/package-manifest.in
browser/installer/removed-files.in
modules/libpref/src/Makefile.in
modules/libpref/src/nsPrefService.cpp
netwerk/base/public/Makefile.in
xpinstall/public/Makefile.in
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -358,19 +358,17 @@
 @BINPATH@/icons/*.png
 #endif
 
 ; [Default Preferences]
 ; All the pref files must be part of base to prevent migration bugs
 @BINPATH@/@PREF_DIR@/firefox.js
 @BINPATH@/@PREF_DIR@/firefox-branding.js
 @BINPATH@/@PREF_DIR@/channel-prefs.js
-@BINPATH@/greprefs/all.js
-@BINPATH@/greprefs/security-prefs.js
-@BINPATH@/greprefs/xpinstall.js
+@BINPATH@/greprefs.js
 @BINPATH@/defaults/autoconfig/platform.js
 @BINPATH@/defaults/autoconfig/prefcalls.js
 
 ; [Layout Engine Resources]
 ; Style Sheets, Graphics and other Resources used by the layout engine. 
 @BINPATH@/res/hiddenWindow.html
 @BINPATH@/res/ua.css
 @BINPATH@/res/html.css
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -775,16 +775,19 @@ components/xpcom_threads.xpt
 components/xpcom_xpti.xpt
 components/xpconnect.xpt
 components/xpinstall.xpt
 components/xulapp.xpt
 components/xuldoc.xpt
 components/xultmpl.xpt
 components/zipwriter.xpt
 components/firefox.xpt
+greprefs/all.js
+greprefs/security-prefs.js
+greprefs/xpinstall.js
 run-mozilla.sh
 firefox
 dependentlibs.list
 components/nsProgressDialog.js
 #endif
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 readme.txt
@@ -805,9 +808,9 @@ mozcrt19.dll
 #endif
 #endif
 xpicleanup@BIN_SUFFIX@
 chrome.manifest
 install.rdf
 @DLL_PREFIX@jsj@DLL_SUFFIX@
 #ifdef XP_WIN
 components/brwsrcmp.dll
-#endif
\ No newline at end of file
+#endif
--- a/modules/libpref/src/Makefile.in
+++ b/modules/libpref/src/Makefile.in
@@ -67,28 +67,37 @@ DEFINES += -DOS_ARCH=$(OS_ARCH) \
            -DMOZ_WIDGET_TOOLKIT=$(MOZ_WIDGET_TOOLKIT) \
            $(NULL)
 
 # this comes from a system header; we should probably be using XP_WINCE or something
 ifdef WINCE
 DEFINES += -DWINCE=1
 endif
 
-PREF_JS_EXPORTS	= $(srcdir)/init/all.js
-
 EXTRA_DSO_LDOPTS = \
 		$(LIBS_DIR) \
 		$(MOZ_COMPONENT_LIBS) \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 GARBAGE		+= $(addprefix $(DIST)/bin/defaults/pref/, \
-			all.js mailnews.js editor.js \
+			mailnews.js editor.js \
 			aix.js beos.js unix.js winpref.js os2prefs.js openvms.js photon.js)
 
+GARBAGE		+= greprefs.js
+
+GREPREF_FILES = $(topsrcdir)/xpinstall/public/xpinstall.js $(topsrcdir)/netwerk/base/public/security-prefs.js $(srcdir)/init/all.js
+
 # Optimizer bug with GCC 3.2.2 on OS/2
 ifeq ($(OS_ARCH), OS2)
 nsPrefService.$(OBJ_SUFFIX): nsPrefService.cpp
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO_CXX)
 	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS)
 endif
+
+
+greprefs.js: $(GREPREF_FILES)
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $^ > $@
+
+libs:: greprefs.js
+	$(INSTALL) $^ $(DIST)/bin/
--- a/modules/libpref/src/nsPrefService.cpp
+++ b/modules/libpref/src/nsPrefService.cpp
@@ -459,18 +459,18 @@ static nsresult openPrefFile(nsIFile* aF
     NS_TIMELINE_MARK_FUNCTION1("load pref file", str.get());
   }
 #endif
 
   nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), aFile);
   if (NS_FAILED(rv)) 
     return rv;        
 
-  PRInt64 fileSize;
-  rv = aFile->GetFileSize(&fileSize);
+  PRUint32 fileSize;
+  rv = inStr->Available(&fileSize);
   if (NS_FAILED(rv))
     return rv;
 
   nsAutoArrayPtr<char> fileBuffer(new char[fileSize]);
   if (fileBuffer == nsnull)
     return NS_ERROR_OUT_OF_MEMORY;
 
   PrefParseState ps;
@@ -635,28 +635,29 @@ static nsresult pref_LoadPrefsInDirList(
 
 //----------------------------------------------------------------------------------------
 // Initialize default preference JavaScript buffers from
 // appropriate TEXT resources
 //----------------------------------------------------------------------------------------
 static nsresult pref_InitInitialObjects()
 {
   nsCOMPtr<nsIFile> aFile;
+  nsCOMPtr<nsIFile> greprefsFile;
   nsCOMPtr<nsIFile> defaultPrefDir;
   nsresult          rv;
 
   // first we parse the GRE default prefs. This also works if we're not using a GRE, 
 
-  rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(defaultPrefDir));
+  rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = defaultPrefDir->AppendNative(NS_LITERAL_CSTRING("greprefs"));
+  rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js"));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = pref_LoadPrefsInDir(defaultPrefDir, nsnull, 0);
+  rv = openPrefFile(greprefsFile);
   if (NS_FAILED(rv)) {
     NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?");
   }
 
   // now parse the "application" default preferences
   rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir));
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/netwerk/base/public/Makefile.in
+++ b/netwerk/base/public/Makefile.in
@@ -141,13 +141,11 @@ EXPORTS		= \
 		nsNetUtil.h \
 		nsNetStrings.h \
 		nsChannelProperties.h \
 		nsURIHashKey.h \
 		nsReadLine.h \
 		nsASocketHandler.h \
 		$(NULL)
 
-PREF_JS_EXPORTS = $(srcdir)/security-prefs.js
-
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DIMPL_NS_NET
--- a/xpinstall/public/Makefile.in
+++ b/xpinstall/public/Makefile.in
@@ -57,11 +57,9 @@ XPIDLSRCS	= \
 		nsPICertNotification.idl \
 		$(NULL)
 
 EXPORTS		= \
 		nsIDOMInstallTriggerGlobal.h \
 		nsSoftwareUpdateIIDs.h \
 		$(NULL)
 
-PREF_JS_EXPORTS	= $(srcdir)/xpinstall.js
-
 include $(topsrcdir)/config/rules.mk