Merge mozila-central onto cedar
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 23 Mar 2011 12:06:04 -0400
changeset 63658 9a935a225b1a30b3d49152f9e86d6188cb2f902a
parent 63657 9c0816e8ad5664491b1a7d02ae23fd0d0335217e (current diff)
parent 63546 7ed3b1c14e926682d424f33d67340dbe6ab70222 (diff)
child 63669 e44b2614a7bc57d752844a9e529e833d1f958975
push idunknown
push userunknown
push dateunknown
milestone2.2a1pre
Merge mozila-central onto cedar
browser/app/apprunner-beos.rsrc
build/cygwin-wrapper
config/make-jars.pl
content/base/src/nsDocument.cpp
content/html/document/src/nsHTMLDocument.cpp
content/xml/document/public/nsIFIXptr.idl
content/xml/document/public/nsIModifyableXPointer.idl
content/xml/document/public/nsIXPointer.idl
content/xml/tests/xpointer/xpointer.xml
content/xslt/src/xpath/nsXPath1Scheme.cpp
content/xslt/src/xpath/nsXPath1Scheme.h
gfx/src/thebes/nsSystemFontsBeOS.cpp
gfx/src/thebes/nsSystemFontsBeOS.h
gfx/thebes/gfxBeOSPlatform.cpp
gfx/thebes/gfxBeOSPlatform.h
gfx/thebes/gfxBeOSSurface.cpp
gfx/thebes/gfxBeOSSurface.h
intl/uconv/src/nsBeOSCharset.cpp
js/src/build/cygwin-wrapper
js/src/config/preprocessor.pl
modules/libpr0n/decoders/icon/beos/Makefile.in
modules/libpr0n/decoders/icon/beos/nsIconChannel.cpp
modules/libpr0n/decoders/icon/beos/nsIconChannel.h
modules/libpref/src/init/all.js
modules/plugin/base/src/nsPluginsDirBeOS.cpp
toolkit/components/alerts/public/Makefile.in
toolkit/components/alerts/public/nsIAlertsService.idl
toolkit/components/alerts/public/nsINotificationsList.idl
toolkit/components/alerts/src/Makefile.in
toolkit/components/alerts/src/mac/Makefile.in
toolkit/components/alerts/src/mac/growl/CFGrowlAdditions.c
toolkit/components/alerts/src/mac/growl/CFGrowlAdditions.h
toolkit/components/alerts/src/mac/growl/CFGrowlDefines.h
toolkit/components/alerts/src/mac/growl/CFMutableDictionaryAdditions.c
toolkit/components/alerts/src/mac/growl/CFMutableDictionaryAdditions.h
toolkit/components/alerts/src/mac/growl/CFURLAdditions.c
toolkit/components/alerts/src/mac/growl/CFURLAdditions.h
toolkit/components/alerts/src/mac/growl/GrowlAbstractSingletonObject.h
toolkit/components/alerts/src/mac/growl/GrowlApplicationBridge.h
toolkit/components/alerts/src/mac/growl/GrowlApplicationBridge.m
toolkit/components/alerts/src/mac/growl/GrowlDefines.h
toolkit/components/alerts/src/mac/growl/GrowlDefinesInternal.h
toolkit/components/alerts/src/mac/growl/GrowlPathUtilities.h
toolkit/components/alerts/src/mac/growl/GrowlPathUtilities.m
toolkit/components/alerts/src/mac/growl/GrowlPathway.h
toolkit/components/alerts/src/mac/growl/GrowlPreferencesController.h
toolkit/components/alerts/src/mac/growl/GrowlTicketController.h
toolkit/components/alerts/src/mac/growl/Makefile.in
toolkit/components/alerts/src/mac/growl/license.txt
toolkit/components/alerts/src/mac/mozGrowlDelegate.h
toolkit/components/alerts/src/mac/mozGrowlDelegate.mm
toolkit/components/alerts/src/mac/nsAlertsImageLoadListener.h
toolkit/components/alerts/src/mac/nsAlertsImageLoadListener.mm
toolkit/components/alerts/src/mac/nsAlertsService.h
toolkit/components/alerts/src/mac/nsAlertsService.mm
toolkit/components/alerts/src/mac/nsAlertsServiceModule.cpp
toolkit/components/alerts/src/mac/nsNotificationsList.h
toolkit/components/alerts/src/mac/nsNotificationsList.mm
toolkit/components/alerts/src/nsAlertsService.cpp
toolkit/components/alerts/src/nsAlertsService.h
toolkit/components/autocomplete/public/Makefile.in
toolkit/components/autocomplete/public/nsIAutoCompleteController.idl
toolkit/components/autocomplete/public/nsIAutoCompleteInput.idl
toolkit/components/autocomplete/public/nsIAutoCompletePopup.idl
toolkit/components/autocomplete/public/nsIAutoCompleteResult.idl
toolkit/components/autocomplete/public/nsIAutoCompleteSearch.idl
toolkit/components/autocomplete/public/nsIAutoCompleteSimpleResult.idl
toolkit/components/autocomplete/src/Makefile.in
toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
toolkit/components/autocomplete/src/nsAutoCompleteController.h
toolkit/components/autocomplete/src/nsAutoCompleteSimpleResult.cpp
toolkit/components/autocomplete/src/nsAutoCompleteSimpleResult.h
toolkit/components/commandlines/public/Makefile.in
toolkit/components/commandlines/public/nsICommandLine.idl
toolkit/components/commandlines/public/nsICommandLineHandler.idl
toolkit/components/commandlines/public/nsICommandLineRunner.idl
toolkit/components/commandlines/public/nsICommandLineValidator.idl
toolkit/components/commandlines/src/Makefile.in
toolkit/components/commandlines/src/nsCommandLine.cpp
toolkit/components/contentprefs/src/Makefile.in
toolkit/components/contentprefs/src/nsContentPrefService.js
toolkit/components/contentprefs/src/nsContentPrefService.manifest
toolkit/components/downloads/public/Makefile.in
toolkit/components/downloads/public/nsIDownload.idl
toolkit/components/downloads/public/nsIDownloadManager.idl
toolkit/components/downloads/public/nsIDownloadManagerUI.idl
toolkit/components/downloads/public/nsIDownloadProgressListener.idl
toolkit/components/downloads/src/Makefile.in
toolkit/components/downloads/src/nsDownloadManager.cpp
toolkit/components/downloads/src/nsDownloadManager.h
toolkit/components/downloads/src/nsDownloadManagerUI.js
toolkit/components/downloads/src/nsDownloadManagerUI.manifest
toolkit/components/downloads/src/nsDownloadProxy.h
toolkit/components/downloads/src/nsDownloadScanner.cpp
toolkit/components/downloads/src/nsDownloadScanner.h
toolkit/components/feeds/public/Makefile.in
toolkit/components/feeds/public/nsIFeed.idl
toolkit/components/feeds/public/nsIFeedContainer.idl
toolkit/components/feeds/public/nsIFeedElementBase.idl
toolkit/components/feeds/public/nsIFeedEntry.idl
toolkit/components/feeds/public/nsIFeedGenerator.idl
toolkit/components/feeds/public/nsIFeedListener.idl
toolkit/components/feeds/public/nsIFeedPerson.idl
toolkit/components/feeds/public/nsIFeedProcessor.idl
toolkit/components/feeds/public/nsIFeedResult.idl
toolkit/components/feeds/public/nsIFeedTextConstruct.idl
toolkit/components/feeds/public/nsIScriptableUnescapeHTML.idl
toolkit/components/feeds/src/FeedProcessor.js
toolkit/components/feeds/src/FeedProcessor.manifest
toolkit/components/feeds/src/Makefile.in
toolkit/components/feeds/src/nsScriptableUnescapeHTML.cpp
toolkit/components/feeds/src/nsScriptableUnescapeHTML.h
toolkit/components/filepicker/public/Makefile.in
toolkit/components/filepicker/public/nsIFileView.idl
toolkit/components/filepicker/src/Makefile.in
toolkit/components/filepicker/src/nsFilePicker.js
toolkit/components/filepicker/src/nsFilePicker.manifest
toolkit/components/filepicker/src/nsFileView.cpp
toolkit/components/find/public/Makefile.in
toolkit/components/find/public/nsIFindService.idl
toolkit/components/find/src/Makefile.in
toolkit/components/find/src/nsFindService.cpp
toolkit/components/find/src/nsFindService.h
toolkit/components/microformats/src/Makefile.in
toolkit/components/microformats/src/Microformats.js
toolkit/components/parentalcontrols/public/Makefile.in
toolkit/components/parentalcontrols/public/nsIParentalControlsService.idl
toolkit/components/parentalcontrols/src/Makefile.in
toolkit/components/parentalcontrols/src/nsParentalControlsServiceWin.cpp
toolkit/components/parentalcontrols/src/nsParentalControlsServiceWin.h
toolkit/components/passwordmgr/public/Makefile.in
toolkit/components/passwordmgr/public/nsILoginInfo.idl
toolkit/components/passwordmgr/public/nsILoginManager.idl
toolkit/components/passwordmgr/public/nsILoginManagerCrypto.idl
toolkit/components/passwordmgr/public/nsILoginManagerIEMigrationHelper.idl
toolkit/components/passwordmgr/public/nsILoginManagerPrompter.idl
toolkit/components/passwordmgr/public/nsILoginManagerStorage.idl
toolkit/components/passwordmgr/public/nsILoginMetaInfo.idl
toolkit/components/passwordmgr/src/Makefile.in
toolkit/components/passwordmgr/src/crypto-SDR.js
toolkit/components/passwordmgr/src/nsLoginInfo.js
toolkit/components/passwordmgr/src/nsLoginManager.js
toolkit/components/passwordmgr/src/nsLoginManagerPrompter.js
toolkit/components/passwordmgr/src/passwordmgr.manifest
toolkit/components/passwordmgr/src/storage-Legacy.js
toolkit/components/passwordmgr/src/storage-mozStorage.js
toolkit/components/places/nsLivemarkService.js
toolkit/components/places/public/Makefile.in
toolkit/components/places/public/mozIAsyncHistory.idl
toolkit/components/places/public/mozIPlacesAutoComplete.idl
toolkit/components/places/public/nsIAnnotationService.idl
toolkit/components/places/public/nsIBrowserHistory.idl
toolkit/components/places/public/nsIDynamicContainer.idl
toolkit/components/places/public/nsIFaviconService.idl
toolkit/components/places/public/nsILivemarkService.idl
toolkit/components/places/public/nsIMicrosummaryService.idl
toolkit/components/places/public/nsINavBookmarksService.idl
toolkit/components/places/public/nsINavHistoryService.idl
toolkit/components/places/public/nsIPlacesImportExportService.idl
toolkit/components/places/public/nsITaggingService.idl
toolkit/components/places/public/nsPIPlacesDatabase.idl
toolkit/components/places/public/nsPIPlacesHistoryListenersNotifier.idl
toolkit/components/places/src/AsyncFaviconHelpers.cpp
toolkit/components/places/src/AsyncFaviconHelpers.h
toolkit/components/places/src/Helpers.cpp
toolkit/components/places/src/Helpers.h
toolkit/components/places/src/History.cpp
toolkit/components/places/src/History.h
toolkit/components/places/src/Makefile.in
toolkit/components/places/src/PlaceInfo.cpp
toolkit/components/places/src/PlaceInfo.h
toolkit/components/places/src/PlacesCategoriesStarter.js
toolkit/components/places/src/PlacesDBUtils.jsm
toolkit/components/places/src/PlacesUtils.jsm
toolkit/components/places/src/SQLFunctions.cpp
toolkit/components/places/src/SQLFunctions.h
toolkit/components/places/src/VisitInfo.cpp
toolkit/components/places/src/VisitInfo.h
toolkit/components/places/src/nsAnnoProtocolHandler.cpp
toolkit/components/places/src/nsAnnoProtocolHandler.h
toolkit/components/places/src/nsAnnotationService.cpp
toolkit/components/places/src/nsAnnotationService.h
toolkit/components/places/src/nsFaviconService.cpp
toolkit/components/places/src/nsFaviconService.h
toolkit/components/places/src/nsLivemarkService.js
toolkit/components/places/src/nsMaybeWeakPtr.cpp
toolkit/components/places/src/nsMaybeWeakPtr.h
toolkit/components/places/src/nsMicrosummaryService.js
toolkit/components/places/src/nsMorkHistoryImporter.cpp
toolkit/components/places/src/nsNavBookmarks.cpp
toolkit/components/places/src/nsNavBookmarks.h
toolkit/components/places/src/nsNavHistory.cpp
toolkit/components/places/src/nsNavHistory.h
toolkit/components/places/src/nsNavHistoryQuery.cpp
toolkit/components/places/src/nsNavHistoryQuery.h
toolkit/components/places/src/nsNavHistoryResult.cpp
toolkit/components/places/src/nsNavHistoryResult.h
toolkit/components/places/src/nsPlacesAutoComplete.js
toolkit/components/places/src/nsPlacesAutoComplete.manifest
toolkit/components/places/src/nsPlacesExpiration.js
toolkit/components/places/src/nsPlacesImportExportService.cpp
toolkit/components/places/src/nsPlacesImportExportService.h
toolkit/components/places/src/nsPlacesIndexes.h
toolkit/components/places/src/nsPlacesMacros.h
toolkit/components/places/src/nsPlacesModule.cpp
toolkit/components/places/src/nsPlacesTables.h
toolkit/components/places/src/nsPlacesTriggers.h
toolkit/components/places/src/nsTaggingService.js
toolkit/components/places/src/toolkitplaces.manifest
toolkit/components/places/src/utils.js
toolkit/components/satchel/public/Makefile.in
toolkit/components/satchel/public/nsIFormAutoComplete.idl
toolkit/components/satchel/public/nsIFormFillController.idl
toolkit/components/satchel/public/nsIFormHistory.idl
toolkit/components/satchel/public/nsIInputListAutoComplete.idl
toolkit/components/satchel/src/Makefile.in
toolkit/components/satchel/src/formSubmitListener.js
toolkit/components/satchel/src/nsFormAutoComplete.js
toolkit/components/satchel/src/nsFormAutoCompleteResult.jsm
toolkit/components/satchel/src/nsFormFillController.cpp
toolkit/components/satchel/src/nsFormFillController.h
toolkit/components/satchel/src/nsFormHistory.js
toolkit/components/satchel/src/nsInputListAutoComplete.js
toolkit/components/satchel/src/satchel.manifest
toolkit/components/startup/src/Makefile.in
toolkit/components/startup/src/nsAppStartup.cpp
toolkit/components/startup/src/nsAppStartup.h
toolkit/components/startup/src/nsTryToClose.js
toolkit/components/startup/src/nsTryToClose.manifest
toolkit/components/startup/src/nsUserInfo.h
toolkit/components/startup/src/nsUserInfoMac.h
toolkit/components/startup/src/nsUserInfoMac.mm
toolkit/components/startup/src/nsUserInfoOS2.cpp
toolkit/components/startup/src/nsUserInfoUnix.cpp
toolkit/components/startup/src/nsUserInfoWin.cpp
toolkit/components/typeaheadfind/public/Makefile.in
toolkit/components/typeaheadfind/public/nsITypeAheadFind.idl
toolkit/components/typeaheadfind/src/Makefile.in
toolkit/components/typeaheadfind/src/nsTypeAheadFind.cpp
toolkit/components/typeaheadfind/src/nsTypeAheadFind.h
toolkit/components/url-classifier/public/Makefile.in
toolkit/components/url-classifier/public/nsIUrlClassifierDBService.idl
toolkit/components/url-classifier/public/nsIUrlClassifierHashCompleter.idl
toolkit/components/url-classifier/public/nsIUrlClassifierStreamUpdater.idl
toolkit/components/url-classifier/public/nsIUrlClassifierTable.idl
toolkit/components/url-classifier/public/nsIUrlClassifierUtils.idl
toolkit/components/url-classifier/public/nsIUrlListManager.idl
toolkit/components/url-classifier/src/Makefile.in
toolkit/components/url-classifier/src/nsURLClassifier.manifest
toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp
toolkit/components/url-classifier/src/nsUrlClassifierDBService.h
toolkit/components/url-classifier/src/nsUrlClassifierHashCompleter.cpp
toolkit/components/url-classifier/src/nsUrlClassifierHashCompleter.h
toolkit/components/url-classifier/src/nsUrlClassifierLib.js
toolkit/components/url-classifier/src/nsUrlClassifierListManager.js
toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.cpp
toolkit/components/url-classifier/src/nsUrlClassifierStreamUpdater.h
toolkit/components/url-classifier/src/nsUrlClassifierUtils.cpp
toolkit/components/url-classifier/src/nsUrlClassifierUtils.h
toolkit/components/urlformatter/public/Makefile.in
toolkit/components/urlformatter/public/nsIURLFormatter.idl
toolkit/components/urlformatter/src/Makefile.in
toolkit/components/urlformatter/src/nsURLFormatter.js
toolkit/components/urlformatter/src/nsURLFormatter.manifest
toolkit/mozapps/Makefile.in
toolkit/mozapps/jar.mn
toolkit/profile/public/Makefile.in
toolkit/profile/public/nsIProfileMigrator.idl
toolkit/profile/public/nsIToolkitProfile.idl
toolkit/profile/public/nsIToolkitProfileService.idl
toolkit/profile/src/Makefile.in
toolkit/profile/src/nsToolkitProfileService.cpp
toolkit/xre/nsNativeAppSupportBeOS.cpp
uriloader/exthandler/beos/nsMIMEInfoBeOS.cpp
uriloader/exthandler/beos/nsMIMEInfoBeOS.h
uriloader/exthandler/beos/nsOSHelperAppService.cpp
uriloader/exthandler/beos/nsOSHelperAppService.h
widget/public/nsIDragSessionBeOS.h
widget/src/beos/Makefile.in
widget/src/beos/nsAppShell.cpp
widget/src/beos/nsAppShell.h
widget/src/beos/nsBeOSCursors.h
widget/src/beos/nsBidiKeyboard.cpp
widget/src/beos/nsBidiKeyboard.h
widget/src/beos/nsCList.h
widget/src/beos/nsChildView.cpp
widget/src/beos/nsChildView.h
widget/src/beos/nsClipboard.cpp
widget/src/beos/nsClipboard.h
widget/src/beos/nsDeviceContextSpecB.cpp
widget/src/beos/nsDeviceContextSpecB.h
widget/src/beos/nsDragService.cpp
widget/src/beos/nsDragService.h
widget/src/beos/nsFilePicker.cpp
widget/src/beos/nsFilePicker.h
widget/src/beos/nsLookAndFeel.cpp
widget/src/beos/nsLookAndFeel.h
widget/src/beos/nsPopupWindow.cpp
widget/src/beos/nsPopupWindow.h
widget/src/beos/nsPrintOptionsBeOS.cpp
widget/src/beos/nsPrintOptionsBeOS.h
widget/src/beos/nsPrintdBeOS.h
widget/src/beos/nsScreenBeOS.cpp
widget/src/beos/nsScreenBeOS.h
widget/src/beos/nsScreenManagerBeOS.cpp
widget/src/beos/nsScreenManagerBeOS.h
widget/src/beos/nsSound.cpp
widget/src/beos/nsSound.h
widget/src/beos/nsSwitchToUIThread.h
widget/src/beos/nsToolkit.cpp
widget/src/beos/nsToolkit.h
widget/src/beos/nsWidgetFactory.cpp
widget/src/beos/nsWindow.cpp
widget/src/beos/nsWindow.h
widget/src/beos/nsdefs.h
widget/src/beos/resource.h
xpcom/glue/standalone/nsGlueLinkingBeOS.cpp
xpcom/reflect/xptcall/src/md/win32/xptcinvoke_alpha.cpp
xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_alpha.s
xpcom/reflect/xptcall/src/md/win32/xptcstubs_alpha.cpp
xpcom/reflect/xptcall/src/md/win32/xptcstubs_asm_alpha.s
--- a/Makefile.in
+++ b/Makefile.in
@@ -78,17 +78,17 @@ ifdef COMPILE_ENVIRONMENT
 include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
 endif
 
 
 include $(topsrcdir)/config/config.mk
 
 GARBAGE_DIRS += dist _javagen _profile _tests staticlib
 DIST_GARBAGE = config.cache config.log config.status config-defs.h \
-   dependencies.beos config/autoconf.mk \
+   config/autoconf.mk \
    unallmakefiles mozilla-config.h \
    netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
    $(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
 
 ifdef WINCE
 check::
 	$(PYTHON) $(topsrcdir)/build/mobile/devicemanager-utils.py copy $(DIST)/bin
 endif
@@ -129,24 +129,20 @@ endif
 include $(topsrcdir)/config/rules.mk
 
 distclean::
 	cat unallmakefiles | $(XARGS) rm -f
 	rm -f unallmakefiles $(DIST_GARBAGE)
 
 ifeq ($(OS_ARCH),WINNT)
 # we want to copy PDB files on Windows
-MAKE_SYM_STORE_ARGS := -c
+MAKE_SYM_STORE_ARGS := -c --vcs-info
 ifdef PDBSTR_PATH
 MAKE_SYM_STORE_ARGS += -i
 endif
-ifeq (,$(CYGWIN_WRAPPER))
-# this doesn't work with Cygwin Python
-MAKE_SYM_STORE_ARGS += --vcs-info
-endif
 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
 # PDB files don't get moved to dist, so we need to scan the whole objdir
 MAKE_SYM_STORE_PATH := .
 endif
 ifeq ($(OS_ARCH),Darwin)
 # need to pass arch flags for universal builds
 ifdef UNIVERSAL_BINARY
 MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
@@ -171,16 +167,19 @@ ifdef MOZ_SYMBOLS_EXTRA_BUILDID
 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
 endif
 
 export SYMBOL_INDEX_NAME = \
   $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)$(EXTRA_BUILDID)-symbols.txt
 
 buildsymbols:
 ifdef MOZ_CRASHREPORTER
+ifdef USE_ELF_HACK
+	$(MAKE) -C $(MOZ_BUILD_APP)/installer elfhack
+endif
 	echo building symbol store
 	$(RM) -rf $(DIST)/crashreporter-symbols
 	$(RM) -f "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
 	$(NSINSTALL) -D $(DIST)/crashreporter-symbols
 	$(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
 	  $(MAKE_SYM_STORE_ARGS)                                          \
 	  $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir))               \
 	  $(DUMP_SYMS_BIN)                                                \
--- a/accessible/src/Makefile.in
+++ b/accessible/src/Makefile.in
@@ -69,13 +69,8 @@ ifdef MOZ_XUL
 DIRS +=   xul
 endif
 
 ifndef DISABLE_XFORMS_HOOKS
 DIRS +=   xforms
 endif
 
 include $(topsrcdir)/config/rules.mk
-
-GARBAGE += $(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX)  $(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX).fake
-
-libs::
-	$(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) $(wildcard $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX).fake) .
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -38,16 +38,17 @@ DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
+EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsDocAccessibleWrap.cpp \
   nsRootAccessibleWrap.cpp \
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -38,16 +38,17 @@ DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
+EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
   
   
 CMMSRCS = nsAccessNodeWrap.mm \
           nsDocAccessibleWrap.mm \
           nsRootAccessibleWrap.mm \
           nsAccessibleWrap.mm \
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -38,16 +38,17 @@ DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
+EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsTextAccessibleWrap.cpp \
   nsDocAccessibleWrap.cpp \
--- a/accessible/src/other/Makefile.in
+++ b/accessible/src/other/Makefile.in
@@ -38,16 +38,17 @@ DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
+EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsRootAccessibleWrap.cpp \
   $(NULL)
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -7,16 +7,17 @@ builtin(include, build/autoconf/glib.m4)
 builtin(include, build/autoconf/libIDL.m4)dnl
 builtin(include, build/autoconf/nspr.m4)dnl
 builtin(include, build/autoconf/nss.m4)dnl
 builtin(include, build/autoconf/pkg.m4)dnl
 builtin(include, build/autoconf/freetype2.m4)dnl
 builtin(include, build/autoconf/codeset.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/mozprog.m4)dnl
+builtin(include, build/autoconf/mozheader.m4)dnl
 builtin(include, build/autoconf/acwinpaths.m4)dnl
 
 MOZ_PROG_CHECKMSYS()
 
 # Read the user's .mozconfig script.  We can't do this in
 # configure.in: autoconf puts the argument parsing code above anything
 # expanded from configure.in, and we need to get the configure options
 # from .mozconfig in place before that argument parsing code.
--- a/allmakefiles.sh
+++ b/allmakefiles.sh
@@ -64,16 +64,17 @@ build/pgo/js-input/Makefile
 build/unix/Makefile
 build/win32/Makefile
 build/win32/crashinjectdll/Makefile
 config/Makefile
 config/autoconf.mk
 config/mkdepend/Makefile
 config/nspr/Makefile
 config/doxygen.cfg
+config/expandlibs_config.py
 config/tests/src-simple/Makefile
 probes/Makefile
 extensions/Makefile
 "
 
 if [ "$WINCE" ]; then
   add_makefiles "
     build/wince/tools/Makefile
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -119,26 +119,31 @@ APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
 else
 MOZILLA_INTERNAL_API = 1
 APP_XPCOM_LIBS = $(XPCOM_LIBS)
 endif
 
 LIBS += \
 	$(STATIC_COMPONENTS_LINKER_PATH) \
 	$(EXTRA_DSO_LIBS) \
-	$(MOZ_JS_LIBS) \
 	$(APP_XPCOM_LIBS) \
 	$(NSPR_LIBS) \
+	$(NULL)
+
+ifdef BUILD_STATIC_LIBS
+LIBS += \
+	$(MOZ_JS_LIBS) \
 	$(TK_LIBS) \
 	$(NULL)
 
 # Add explicit X11 dependency when building against X11 toolkits
 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
 LIBS += $(XLDFLAGS) $(XLIBS) $(ZLIB_LIBS)
 endif
+endif
 
 ifdef MOZ_JPROF
 LIBS += -ljprof
 endif
 
 ifndef MOZ_WINCONSOLE
 ifdef MOZ_DEBUG
 MOZ_WINCONSOLE = 1
@@ -194,23 +199,16 @@ endif
 ifdef BUILD_STATIC_LIBS
 RCFLAGS += -DMOZ_STATIC_BUILD
 endif
 ifdef DEBUG
 RCFLAGS += -DDEBUG
 endif
 endif
 
-ifeq ($(OS_ARCH),BeOS)
-BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
-ifdef BUILD_STATIC_LIBS
-OS_LIBS += -ltracker -lgame
-endif
-endif
-
 ifeq ($(OS_ARCH),OS2)
 RESFILE=splashos2.res
 RCFLAGS += -DMOZ_PHOENIX
 ifdef BUILD_STATIC_LIBS
 RCFLAGS += -DMOZ_STATIC_BUILD -i $(DIST)/include
 endif
 ifdef DEBUG
 RCFLAGS += -DDEBUG
@@ -245,18 +243,16 @@ ifndef GNU_CC
 LDFLAGS += /HEAP:0x40000
 ifeq ($(OS_TEST),x86_64)
 # set stack to 2MB on x64 build.  See bug 582910
 LDFLAGS += -STACK:2097152
 endif
 endif
 endif
 
-$(PROGRAM): $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
-
 ifneq (,$(filter-out OS2 WINNT WINCE,$(OS_ARCH)))
 
 $(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)
deleted file mode 100644
index 145e9ca36dfca8072be0b28e2c1c6c93b6dff813..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/build.mk
+++ b/browser/build.mk
@@ -76,16 +76,19 @@ distclean::
 	@$(MAKE) -C browser/installer distclean
 
 source-package::
 	@$(MAKE) -C browser/installer source-package
 
 upload::
 	@$(MAKE) -C browser/installer upload
 
+l10n-check::
+	@$(MAKE) -C browser/locales l10n-check
+
 ifdef ENABLE_TESTS
 # Implemented in testing/testsuite-targets.mk
 
 mochitest-browser-chrome:
 	$(RUN_MOCHITEST) --browser-chrome
 	$(CHECK_TEST_ERROR)
 
 mochitest:: mochitest-browser-chrome
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -47,19 +47,17 @@
 #include "nsMacShellService.h"
 #elif defined(MOZ_WIDGET_GTK2)
 #include "nsGNOMEShellService.h"
 #endif
 
 #ifndef WINCE
 
 #include "nsProfileMigrator.h"
-#if !defined(XP_BEOS)
 #include "nsDogbertProfileMigrator.h"
-#endif
 #if !defined(XP_OS2)
 #include "nsOperaProfileMigrator.h"
 #endif
 #include "nsPhoenixProfileMigrator.h"
 #include "nsSeamonkeyProfileMigrator.h"
 #if defined(XP_WIN) && !defined(__MINGW32__)
 #include "nsIEProfileMigrator.h"
 #elif defined(XP_MACOSX)
@@ -90,19 +88,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindows
 #elif defined(XP_MACOSX)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
 #elif defined(MOZ_WIDGET_GTK2)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
 #endif
 
 #ifndef WINCE
 
-#if !defined(XP_BEOS)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDogbertProfileMigrator)
-#endif
 #if !defined(XP_OS2)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsOperaProfileMigrator)
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPhoenixProfileMigrator)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSeamonkeyProfileMigrator)
 #if defined(XP_WIN) && !defined(__MINGW32__)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEProfileMigrator)
@@ -138,19 +134,17 @@ NS_DEFINE_NAMED_CID(NS_SAFARIPROFILEMIGR
 NS_DEFINE_NAMED_CID(NS_MACIEPROFILEMIGRATOR_CID);
 NS_DEFINE_NAMED_CID(NS_OMNIWEBPROFILEMIGRATOR_CID);
 NS_DEFINE_NAMED_CID(NS_CAMINOPROFILEMIGRATOR_CID);
 NS_DEFINE_NAMED_CID(NS_ICABPROFILEMIGRATOR_CID);
 #endif
 #if !defined(XP_OS2)
 NS_DEFINE_NAMED_CID(NS_OPERAPROFILEMIGRATOR_CID);
 #endif
-#if !defined(XP_BEOS)
 NS_DEFINE_NAMED_CID(NS_DOGBERTPROFILEMIGRATOR_CID);
-#endif
 NS_DEFINE_NAMED_CID(NS_PHOENIXPROFILEMIGRATOR_CID);
 NS_DEFINE_NAMED_CID(NS_SEAMONKEYPROFILEMIGRATOR_CID);
 #endif /* WINCE */
 NS_DEFINE_NAMED_CID(NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID);
 
 static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
     { &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
 #if defined(XP_WIN)
@@ -170,19 +164,17 @@ static const mozilla::Module::CIDEntry k
     { &kNS_MACIEPROFILEMIGRATOR_CID, false, NULL, nsMacIEProfileMigratorConstructor },
     { &kNS_OMNIWEBPROFILEMIGRATOR_CID, false, NULL, nsOmniWebProfileMigratorConstructor },
     { &kNS_CAMINOPROFILEMIGRATOR_CID, false, NULL, nsCaminoProfileMigratorConstructor },
     { &kNS_ICABPROFILEMIGRATOR_CID, false, NULL, nsICabProfileMigratorConstructor },
 #endif
 #if !defined(XP_OS2)
     { &kNS_OPERAPROFILEMIGRATOR_CID, false, NULL, nsOperaProfileMigratorConstructor },
 #endif
-#if !defined(XP_BEOS)
     { &kNS_DOGBERTPROFILEMIGRATOR_CID, false, NULL, nsDogbertProfileMigratorConstructor },
-#endif
     { &kNS_PHOENIXPROFILEMIGRATOR_CID, false, NULL, nsPhoenixProfileMigratorConstructor },
     { &kNS_SEAMONKEYPROFILEMIGRATOR_CID, false, NULL, nsSeamonkeyProfileMigratorConstructor },
 #endif /* WINCE */
     { &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID, false, NULL, nsPrivateBrowsingServiceWrapperConstructor },
     { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
@@ -216,19 +208,17 @@ static const mozilla::Module::ContractID
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "macie", &kNS_MACIEPROFILEMIGRATOR_CID },
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "omniweb", &kNS_OMNIWEBPROFILEMIGRATOR_CID },
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "camino", &kNS_CAMINOPROFILEMIGRATOR_CID },
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "icab", &kNS_ICABPROFILEMIGRATOR_CID },
 #endif
 #if !defined(XP_OS2)
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera", &kNS_OPERAPROFILEMIGRATOR_CID },
 #endif
-#if !defined(XP_BEOS)
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert", &kNS_DOGBERTPROFILEMIGRATOR_CID },
-#endif
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix", &kNS_PHOENIXPROFILEMIGRATOR_CID },
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey", &kNS_SEAMONKEYPROFILEMIGRATOR_CID },
 #endif /* WINCE */
     { NS_PRIVATE_BROWSING_SERVICE_CONTRACTID, &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID },
     { NULL }
 };
 
 static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
--- a/browser/components/migration/src/Makefile.in
+++ b/browser/components/migration/src/Makefile.in
@@ -50,22 +50,19 @@ USE_STATIC_LIBS = 1
 endif
 
 
 CPPSRCS  = nsProfileMigrator.cpp \
            nsBrowserProfileMigratorUtils.cpp \
            nsNetscapeProfileMigratorBase.cpp \
            nsSeamonkeyProfileMigrator.cpp \
            nsPhoenixProfileMigrator.cpp \
+           nsDogbertProfileMigrator.cpp \
            $(NULL)
 
-ifneq ($(OS_ARCH),BeOS)
-CPPSRCS += nsDogbertProfileMigrator.cpp
-endif
-
 ifneq ($(OS_ARCH),OS2)
 CPPSRCS += nsOperaProfileMigrator.cpp
 endif
 
 ifeq ($(OS_ARCH)_$(GNU_CXX),WINNT_)
 CPPSRCS += nsIEProfileMigrator.cpp \
            $(NULL)
 endif
--- a/browser/components/migration/src/nsOperaProfileMigrator.cpp
+++ b/browser/components/migration/src/nsOperaProfileMigrator.cpp
@@ -80,29 +80,21 @@
 #define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("Opera 6 Preferences")
 #define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("Opera Global History")
 #define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("Bookmarks")
 #elif defined (XP_UNIX)
 #define OPERA_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING(".opera")
 #define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera6.ini")
 #define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
 #define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera6.adr")
-#elif defined (XP_BEOS)
-#define OPERA_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Opera")
-#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera.ini")
-#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
-#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera.adr")
 #else
 #error Need to define location of Opera Profile data.
 #endif
 
 #define OPERA_COOKIES_FILE_NAME NS_LITERAL_STRING("cookies4.dat")
-#ifdef XP_BEOS
-#define OPERA_COOKIES_FILE_NAME NS_LITERAL_STRING("cookies.dat")
-#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsBrowserProfileMigrator
 
 NS_IMPL_ISUPPORTS1(nsOperaProfileMigrator, nsIBrowserProfileMigrator)
 
 nsOperaProfileMigrator::nsOperaProfileMigrator()
 {
--- a/browser/components/migration/src/nsPhoenixProfileMigrator.cpp
+++ b/browser/components/migration/src/nsPhoenixProfileMigrator.cpp
@@ -284,21 +284,16 @@ nsPhoenixProfileMigrator::FillProfileDat
   
   phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
   phoenixRegistry->Append(NS_LITERAL_STRING("Application Registry"));
 #elif defined(XP_UNIX)
   fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
   
   phoenixRegistry->Append(NS_LITERAL_STRING(".phoenix"));
   phoenixRegistry->Append(NS_LITERAL_STRING("appreg"));
-#elif defined(XP_BEOS)
-   fileLocator->Get(NS_BEOS_SETTINGS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
-
-   phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
-   phoenixRegistry->Append(NS_LITERAL_STRING("appreg"));
 #elif defined(XP_OS2)
   fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(phoenixRegistry));
   
   phoenixRegistry->Append(NS_LITERAL_STRING("Phoenix"));
   phoenixRegistry->Append(NS_LITERAL_STRING("registry.dat"));
 #endif
 
 
--- a/browser/components/migration/src/nsProfileMigrator.cpp
+++ b/browser/components/migration/src/nsProfileMigrator.cpp
@@ -319,22 +319,16 @@ nsProfileMigrator::ImportRegistryProfile
   regFile->AppendNative(aAppName);
   regFile->AppendNative(NS_LITERAL_CSTRING("Application Registry"));
 #elif defined(XP_OS2)
   rv = dirService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile),
                        getter_AddRefs(regFile));
   NS_ENSURE_SUCCESS(rv, PR_FALSE);
   regFile->AppendNative(aAppName);
   regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
-#elif defined(XP_BEOS)
-  rv = dirService->Get(NS_BEOS_SETTINGS_DIR, NS_GET_IID(nsILocalFile),
-                       getter_AddRefs(regFile));
-  NS_ENSURE_SUCCESS(rv, PR_FALSE);
-  regFile->AppendNative(aAppName);
-  regFile->AppendNative(NS_LITERAL_CSTRING("appreg"));
 #else
   rv = dirService->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile),
                        getter_AddRefs(regFile));
   NS_ENSURE_SUCCESS(rv, PR_FALSE);
   nsCAutoString dotAppName;
   ToLowerCase(aAppName, dotAppName);
   dotAppName.Insert('.', 0);
   
--- a/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp
+++ b/browser/components/migration/src/nsSeamonkeyProfileMigrator.cpp
@@ -317,21 +317,16 @@ nsSeamonkeyProfileMigrator::FillProfileD
   
   seamonkeyRegistry->Append(NS_LITERAL_STRING("Mozilla"));
   seamonkeyRegistry->Append(NS_LITERAL_STRING("Application Registry"));
 #elif defined(XP_UNIX)
   fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(seamonkeyRegistry));
   
   seamonkeyRegistry->Append(NS_LITERAL_STRING(".mozilla"));
   seamonkeyRegistry->Append(NS_LITERAL_STRING("appreg"));
-#elif defined(XP_BEOS)
-   fileLocator->Get(NS_BEOS_SETTINGS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(seamonkeyRegistry));
-
-   seamonkeyRegistry->Append(NS_LITERAL_STRING("Mozilla"));
-   seamonkeyRegistry->Append(NS_LITERAL_STRING("appreg"));
 #elif defined(XP_OS2)
   fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(seamonkeyRegistry));
   
   seamonkeyRegistry->Append(NS_LITERAL_STRING("Mozilla"));
   seamonkeyRegistry->Append(NS_LITERAL_STRING("registry.dat"));
 #endif
 
   return GetProfileDataFromRegistry(seamonkeyRegistry, mProfileNames, mProfileLocations);
--- a/browser/config/version.txt
+++ b/browser/config/version.txt
@@ -1,1 +1,1 @@
-4.0b13pre
+4.2a1pre
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -113,16 +113,30 @@ MOZ_PKG_MAC_BACKGROUND=branding/backgrou
 MOZ_PKG_MAC_ICON=branding/disk.icns
 MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
 endif
 
 ifndef LIBXUL_SDK
 INSTALL_SDK = 1
 endif
 
+ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY))
+ifdef RUN_TEST_PROGRAM
+_ABS_RUN_TEST_PROGRAM = $(call core_abspath,$(RUN_TEST_PROGRAM))
+endif
+
+GENERATE_CACHE = \
+  $(_ABS_RUN_TEST_PROGRAM) $(_ABS_DIST)/bin/xpcshell$(BIN_SUFFIX) -g "$$PWD" -f $(topsrcdir)/browser/installer/precompile_cache.js -e 'populate_startupcache("omni.jar", "startupCache.zip");' && \
+  rm -rf jsloader && \
+  $(UNZIP) startupCache.zip && \
+  rm startupCache.zip && \
+  find jsloader | xargs touch -t 201001010000 && \
+  $(ZIP) -r9mX omni.jar jsloader
+endif
+
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 ifeq (bundle, $(MOZ_FS_LAYOUT))
 BINPATH = $(_BINPATH)
 DEFINES += -DAPPNAME=$(_APPNAME)
 else
 # Every other platform just winds up in dist/bin
 BINPATH = bin
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -79,17 +79,16 @@
 #else
 @BINPATH@/mozcrt19.dll
 @BINPATH@/mozcpp19.dll
 #endif
 #endif
 
 [browser]
 ; [Base Browser Files]
-@BINPATH@/jsloader/
 #ifndef XP_UNIX
 @BINPATH@/@MOZ_APP_NAME@.exe
 #else
 @BINPATH@/@MOZ_APP_NAME@-bin
 @BINPATH@/@MOZ_APP_NAME@
 #endif
 @BINPATH@/application.ini
 @BINPATH@/platform.ini
--- a/browser/installer/precompile_cache.js
+++ b/browser/installer/precompile_cache.js
@@ -40,110 +40,90 @@
 // see http://mxr.mozilla.org/mozilla-central/source/services/sync/Weave.js#76
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 function setenv(name, val) {
   try {
-        var environment = Components.classes["@mozilla.org/process/environment;1"].
-          getService(Components.interfaces.nsIEnvironment);
-        environment.set(name, val);
-  }
-  catch(e) {
+    var environment = Components.classes["@mozilla.org/process/environment;1"].
+      getService(Components.interfaces.nsIEnvironment);
+    environment.set(name, val);
+  } catch(e) {
     displayError("setenv", e);
   }
 }
 
 function load(url) {
-  print(url)
+  print(url);
   try {
-    Cu.import(url, null)
+    Cu.import(url, null);
   } catch(e) {
-    dump("Failed to import "+url + ":"+e+"\n");
+    dump("Failed to import " + url + ":" + e + "\n");
   }
 }
 
 function load_entries(entries, prefix) {
-  while(entries.hasMore()) {
+  while (entries.hasMore()) {
     var c = entries.getNext();
+    // Required to ensure sync js is only loaded in load_custom_entries.
+    // That function loads the sync js with the right URIs.
+    if (c.indexOf("services-sync") >= 0)
+      continue;
+    if (c.indexOf("services-crypto") >= 0)
+      continue;
     load(prefix + c);
   }
 }
 
+function load_custom_entries(entries, subst) {
+  while (entries.hasMore()) {
+    var c = entries.getNext();
+    load("resource://" + subst + "/" + c.replace("modules/" + subst + "/", ""));
+  }
+}
+
 function getGreDir() {
-  return Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("GreD", Ci.nsIFile);
+  return Cc["@mozilla.org/file/directory_service;1"].
+    getService(Ci.nsIProperties).get("GreD", Ci.nsIFile);
 }
 
 function openJar(file) {
-  var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci.nsIZipReader);
+  var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].
+    createInstance(Ci.nsIZipReader);
   zipreader.open(file);
   return zipreader;
 }
 
-// Check that files can be read from after closing zipreader
-function populate_omnijar() {
+function populate_startupcache(omnijarName, startupcacheName) {
   var file = getGreDir();
-  file.append("omni.jar");
-  setenv("MOZ_STARTUP_CACHE", file.path);
+  file.append(omnijarName);
   zipreader = openJar(file);
 
-  load_entries(zipreader.findEntries("components/*js"), "resource://gre/");
-  load_entries(zipreader.findEntries("modules/*jsm"), "resource://gre/");
+  var scFile = getGreDir();
+  scFile.append(startupcacheName);
+  setenv("MOZ_STARTUP_CACHE", scFile.path);
 
   // the sync part below doesn't work as smoothly
-  let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
+  let ioService = Cc["@mozilla.org/network/io-service;1"].
+    getService(Ci.nsIIOService);
   let uri = ioService.newURI("resource:///modules/services-sync/",
                              null, null);
   let resProt = ioService.getProtocolHandler("resource")
     .QueryInterface(Ci.nsIResProtocolHandler);
   resProt.setSubstitution("services-sync", uri);
 
-  var entries = zipreader.findEntries("modules/services-sync/*js");
-  while(entries.hasMore()) {
-    var c = entries.getNext();
-    load("resource://services-sync/" + c.replace("modules/services-sync/", ""));
-  }
+  uri = ioService.newURI("resource:///modules/services-crypto/",
+                         null, null);
+  resProt.setSubstitution("services-crypto", uri);
+
+  load_entries(zipreader.findEntries("components/*js"), "resource://gre/");
+
+  load_custom_entries(zipreader.findEntries("modules/services-sync/*js"),
+                      "services-sync");
+  load_custom_entries(zipreader.findEntries("modules/services-crypto/*js"),
+                      "services-crypto");
+
+  load_entries(zipreader.findEntries("modules/*js"), "resource://gre/");
+  load_entries(zipreader.findEntries("modules/*jsm"), "resource://gre/");
   zipreader.close();
 }
-
-function extract_files(jar, pattern, dest) {
-  var entries = jar.findEntries(pattern);
-  while(entries.hasMore()) {
-    var c = entries.getNext();
-    var file = dest.clone();
-    for each(name in c.split("/"))
-      file.append(name);
-
-    if (!file.parent.exists()) { 
-      file.parent.create(1 /* Ci.nsIFile.DIRECTORY doesn't work*/, 0700);
-      print("Created " + file.parent.path)
-    }
-
-    if (jar.getEntry(c).isDirectory)
-      continue;
-    
-    try {
-      jar.extract(c, file);
-      print("extracted "+file.path+":"+file.fileSize);
-    }catch(e) {
-      // This shouldn't happen, but if it does it means the cache entry will be generated at runtime
-      // instead of at package-time.
-      print("Failed to extract " + file.path);
-      print(e)
-    }
-  }
-
-}
-
-function extract_jsloader_to_dist_bin() {
-  var dist_bin = getGreDir().parent;
-  dist_bin.append("bin");
-
-  var file = getGreDir();
-  file.append("omni.jar");
-
-  var zipReader = openJar(file);
-  // this should really be zipReader.extract(...), but that method is too broken
-  extract_files(zipReader, "jsloader/*", dist_bin);
-  zipReader.close();
-}
--- a/browser/installer/windows/Makefile.in
+++ b/browser/installer/windows/Makefile.in
@@ -72,38 +72,48 @@ DEFINES += \
 	-DAB_CD=$(AB_CD) \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME} \
 	-DMOZILLA_VERSION=${MOZILLA_VERSION} \
 	$(NULL)
 
 include $(topsrcdir)/config/config.mk
 
+ifdef LOCALE_MERGEDIR
+PPL_LOCALE_ARGS = \
+  --l10n-dir=$(LOCALE_MERGEDIR)/browser/installer \
+  --l10n-dir=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer \
+  --l10n-dir=$(topsrcdir)/browser/locales/en-US/installer \
+  $(NULL)
+else
+PPL_LOCALE_ARGS=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer
+endif
+
 installer::
 	$(MAKE) -C .. installer-stage
 	$(MAKE) $(CONFIG_DIR)/setup.exe
 
 # For building the uninstaller during the application build so it can be
 # included for mar file generation.
 uninstaller::
 	$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(DIST)/branding/,$(BRANDING_FILES)) $(CONFIG_DIR)
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) \
 	  $(srcdir)/nsis/defines.nsi.in > $(CONFIG_DIR)/defines.nsi
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
 	  --preprocess-locale $(topsrcdir) \
-	  $(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer $(AB_CD) $(CONFIG_DIR)
+	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 
 $(CONFIG_DIR)/setup.exe::
 	$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(DIST)/branding/,$(BRANDING_FILES)) $(CONFIG_DIR)
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) \
 	  $(srcdir)/nsis/defines.nsi.in > $(CONFIG_DIR)/defines.nsi
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
 	  --preprocess-locale $(topsrcdir) \
-	  $(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer $(AB_CD) $(CONFIG_DIR)
+	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 
 GARBARGE_DIRS += instgen
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/makensis.mk
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -67,32 +67,32 @@ endif
 SUBMAKEFILES += \
 	$(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile \
 	$(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/Makefile \
 	$(NULL)
 
 # This makefile uses variable overrides from the libs-% target to
 # build non-default locales to non-default dist/ locations. Be aware!
 
+# XXXCallek Unused?
 APP_VERSION := $(shell cat $(srcdir)/../config/version.txt)
 
 PWD := $(CURDIR)
 
 # These are defaulted to be compatible with the files the wget-en-US target
 # pulls. You may override them if you provide your own files. You _must_
 # override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not
 # work in that case.
 ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE)
 WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
 RETRIEVE_WINDOWS_INSTALLER = 1
 
 MOZ_LANGPACK_EID=langpack-$(AB_CD)@firefox.mozilla.org
 
-PREF_JS_EXPORTS = $(firstword $(wildcard $(LOCALE_SRCDIR)/firefox-l10n.js) \
-                       $(srcdir)/en-US/firefox-l10n.js )
+PREF_JS_EXPORTS = $(call MERGE_FILE,firefox-l10n.js)
 
 ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
 MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
 MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
 MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
 MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
 endif
 
@@ -120,28 +120,26 @@ libs::
 	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(FINAL_TARGET)/defaults/existing-profile-defaults.js; \
 	fi
 install::
 	@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
 	  $(PERL) $(topsrcdir)/config/preprocessor.pl $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
 	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(DESTDIR)$(mozappdir)/defaults/existing-profile-defaults.js; \
 	fi
 
-README_FILES = \
-	README.txt \
-	$(NULL)
+README_FILE = $(call MERGE_FILE,README.txt)
 
 PROFILE_FILES = \
 	localstore.rdf \
 	mimeTypes.rdf \
 	$(NULL)
 
 PROFILE_CHROME = userChrome-example.css userContent-example.css
 
-libs:: $(addprefix $(LOCALE_SRCDIR)/,$(README_FILES))
+libs:: $(README_FILE)
 ifeq ($(OS_ARCH),WINNT)
 	$(EXIT_ON_ERROR) \
 	for file in $^; do \
 	  $(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $$file > $(FINAL_TARGET)/`basename $$file`; \
 	done
 else
 ifneq ($(OS_ARCH),OS2)
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
@@ -158,28 +156,28 @@ NO_JA_JP_MAC_AB_CD := $(if $(filter ja-J
 	  $(srcdir)/generic/profile/bookmarks.html.in \
 	  > $@
 
 libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ;
 
 libs:: $(addprefix generic/profile/,$(PROFILE_FILES))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
 
-libs:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
+libs:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile/chrome
 
 install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.html ;
 
 install:: $(addprefix generic/profile/,$(PROFILE_FILES))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile
 
-install:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
+install:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile/chrome
 
-SEARCH_PLUGINS = $(shell cat $(LOCALE_SRCDIR)/searchplugins/list.txt)
+SEARCH_PLUGINS = $(shell cat $(call MERGE_FILE,/searchplugins/list.txt))
 
 libs:: $(addsuffix .xml,$(SEARCH_PLUGINS))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/searchplugins
 
 install:: $(addsuffix .xml,$(SEARCH_PLUGINS))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/searchplugins
 
 
@@ -187,41 +185,36 @@ libs-%:
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref BOTH_MANIFESTS=1
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 
 
-repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
-repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES)
+repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
+repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
 	@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
 	$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
 	$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
 	$(MAKE) repackage-zip \
 	  AB_CD=$(AB_CD) \
 	  MOZ_PKG_FORMAT=SFX7Z \
-	  ZIP_IN=$(WIN32_INSTALLER_IN) \
-	  ZIP_OUT=$(WIN32_INSTALLER_OUT) \
+	  ZIP_IN="$(WIN32_INSTALLER_IN)" \
+	  ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
 	  SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
 	              $(topsrcdir)/browser/installer/windows/app.tag"
 
 ifeq (WINNT,$(OS_ARCH))
-repackage-win32-installer-%: $(WIN32_INSTALLER_IN) libs-%
-	@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN=$(WIN32_INSTALLER_IN)
+repackage-win32-installer-%:
+	@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
 else
 repackage-win32-installer-%: ;
 endif
 
-ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
-STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS
-else
-STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
-endif
 
 clobber-zip:
 	$(RM) $(STAGEDIST)/chrome/$(AB_CD).jar \
 	  $(STAGEDIST)/chrome/$(AB_CD).manifest \
 	  $(STAGEDIST)/defaults/pref/firefox-l10n.js
 	$(RM) -rf  $(STAGEDIST)/searchplugins \
 	  $(STAGEDIST)/dictionaries \
 	  $(STAGEDIST)/defaults/profile \
@@ -233,17 +226,17 @@ langpack: langpack-$(AB_CD)
 # This is a generic target that will make a langpack, repack ZIP (+tarball)
 # builds, and repack an installer if applicable. It is called from the
 # tinderbox scripts. Alter it with caution.
 
 installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
 	@echo "repackaging done"
 
 ifdef MOZ_UPDATER
-libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
+libs:: $(call MERGE_FILE,updater/updater.ini)
 ifeq ($(OS_ARCH),WINNT)
 	cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
 	  sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
 	  sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
 	  $(FINAL_TARGET)/updater.ini
 else
 	cat $< | \
 	  sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
@@ -252,69 +245,30 @@ else
 endif
 endif
 
 ifdef MOZ_CRASHREPORTER
 libs:: crashreporter-override.ini
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
 endif
 
-
 ident:
 	@printf "fx_revision "
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
 	    $(STAGEDIST)/application.ini App SourceStamp
 	@printf "buildid "
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
 	    $(STAGEDIST)/application.ini App BuildID
 
-#These make targets call prepare-repackages by setting different UPLOAD_DIR
-prepare-upload-latest-%:
-	@$(MAKE) prepare-repackages-$* UPLOAD_DIR=$(DIST)/upload/latest
-
-prepare-upload-dated-%:
-	@$(MAKE) prepare-repackages-$* UPLOAD_DIR=$(DIST)/upload/`date "+%Y-%m-%d-%H"`-$(MOZ_PKG_APPNAME)$(MOZ_APP_VERSION)-l10n
-
-#Each platform uploads their xpi files to different folders
-ifeq (Linux, $(OS_ARCH))
-XPI_DESTINATION = linux-xpi
-endif
-ifeq (Darwin, $(OS_ARCH))
-XPI_DESTINATION = mac-xpi
-endif
-ifeq (WINNT, $(OS_ARCH))
-XPI_DESTINATION = windows-xpi
-endif
-
-# This target will generate a UPLOAD_DIR folder with
-# l10n repackages in the way that we offer l10n nightlies
-#  1) ./ the binary
-#  2) ./{linux,mac,windows}-xpi/locale.xpi
-prepare-repackages-%:
-ifndef XPI_DESTINATION
-	$(error XPI_DESTINATION not defined; \
-	This is the folder where the xpi files will be moved to)
-endif
-ifndef UPLOAD_DIR
-	$(error UPLOAD_DIR not defined)
-endif
-	$(NSINSTALL) -D $(UPLOAD_DIR)
-	$(NSINSTALL) -D $(UPLOAD_DIR)/$(XPI_DESTINATION)
-# Move the langpack
-	mv $(DIST)/install/firefox-$(MOZ_APP_VERSION).$*.langpack.xpi \
-	   $(UPLOAD_DIR)/$(XPI_DESTINATION)/$*.xpi
-# Move the repackage
-	mv $(DIST)/firefox-$(MOZ_APP_VERSION).$*.* \
-	   $(UPLOAD_DIR)/.
-# Move the windows installer
-ifeq (WINNT, $(OS_ARCH))
-	mv $(DIST)/install/sea/firefox-$(MOZ_APP_VERSION).$*.win32.installer.exe \
-	   $(UPLOAD_DIR)/.
-endif
-# Set the permissions that the folders will have in ftp once uploaded
-	chmod -vR 775 $(UPLOAD_DIR)
-
 merge-%:
 ifdef LOCALE_MERGEDIR
 	$(RM) -rf $(LOCALE_MERGEDIR)
 	MACOSX_DEPLOYMENT_TARGET= compare-locales -m $(LOCALE_MERGEDIR) $(srcdir)/l10n.ini $(L10NBASEDIR) $*
 endif
 	@echo
+
+# test target, depends on make package
+# try to repack x-test, with just toolkit/defines.inc being there
+l10n-check::
+	$(RM) -rf x-test
+	$(NSINSTALL) -D x-test/toolkit
+	echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
+	$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
new file mode 100644
--- /dev/null
+++ b/build/autoconf/mozheader.m4
@@ -0,0 +1,65 @@
+dnl ***** BEGIN LICENSE BLOCK *****
+dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
+dnl
+dnl The contents of this file are subject to the Mozilla Public License Version
+dnl 1.1 (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl http://www.mozilla.org/MPL/
+dnl
+dnl Software distributed under the License is distributed on an "AS IS" basis,
+dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+dnl for the specific language governing rights and limitations under the
+dnl License.
+dnl
+dnl The Original Code is mozilla.org code.
+dnl
+dnl The Initial Developer of the Original Code is the
+dnl Mozilla Foundation <http://www.mozilla.org>
+dnl
+dnl Portions created by the Initial Developer are Copyright (C) 2009
+dnl the Initial Developer. All Rights Reserved.
+dnl
+dnl Contributor(s):
+dnl   Neil Rashbrook <neil@parkwaycc.co.uk>
+dnl
+dnl Alternatively, the contents of this file may be used under the terms of
+dnl either of the GNU General Public License Version 2 or later (the "GPL"),
+dnl or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+dnl in which case the provisions of the GPL or the LGPL are applicable instead
+dnl of those above. If you wish to allow use of your version of this file only
+dnl under the terms of either the GPL or the LGPL, and not to allow others to
+dnl use your version of this file under the terms of the MPL, indicate your
+dnl decision by deleting the provisions above and replace them with the notice
+dnl and other provisions required by the GPL or the LGPL. If you do not delete
+dnl the provisions above, a recipient may use your version of this file under
+dnl the terms of any one of the MPL, the GPL or the LGPL.
+dnl
+dnl ***** END LICENSE BLOCK *****
+
+dnl MOZ_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+AC_DEFUN(MOZ_CHECK_HEADER,
+[ dnl Do the transliteration at runtime so arg 1 can be a shell variable.
+  ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
+  AC_MSG_CHECKING([for $1])
+  AC_CACHE_VAL(ac_cv_header_$ac_safe,
+ [ AC_TRY_COMPILE([#include <$1>], ,
+                  eval "ac_cv_header_$ac_safe=yes",
+                  eval "ac_cv_header_$ac_safe=no") ])
+  if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+    AC_MSG_RESULT(yes)
+    ifelse([$2], , :, [$2])
+  else
+    AC_MSG_RESULT(no)
+    ifelse([$3], , , [$3])
+  fi
+])
+
+dnl MOZ_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+AC_DEFUN(MOZ_CHECK_HEADERS,
+[ for ac_hdr in $1
+  do
+    MOZ_CHECK_HEADER($ac_hdr,
+                     [ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+                       AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)
+  done
+])
deleted file mode 100755
--- a/build/cygwin-wrapper
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-#
-# Stupid wrapper to avoid win32 dospath/cygdrive issues
-# Try not to spawn programs from within this file. If the stuff in here looks royally 
-# confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643
-# and look at the older versions of this file that are easier to read, but
-# do basically the same thing
-#
-
-prog=$1
-shift
-if test -z "$prog"; then
-    exit 0
-fi
-
-# If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p
-mountpoint=$CYGDRIVE_MOUNT
-if test -z "$mountpoint"; then
-    mountpoint=`mount -p`
-    if test -z "$mountpoint"; then
-       print "Cannot determine cygwin mount points. Exiting"
-       exit 1
-    fi
-fi
-
-# Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p`
-mountpoint=${mountpoint#*/}
-mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
-mountpoint=${mountpoint%/}
-
-args=""
-up=""
-if test "${prog}" = "-up"; then
-    up=1
-    prog=${1}
-    shift
-fi
-
-process=1
-
-# Convert the mountpoint in parameters to Win32 filenames
-# For instance: /cygdrive/c/foo -> c:/foo
-for i in "${@}"
-do
-    if test "${i}" = "-wrap"; then
-        process=1
-    else
-        if test "${i}" = "-nowrap"; then
-            process=
-        else
-            if test -n "${process}"; then
-                if test -n "${up}"; then
-                    pathname=${i#-I[a-zA-Z]:/}
-                    if ! test "${pathname}" = "${i}"; then
-                        no_i=${i#-I}
-                        driveletter=${no_i%%:*}
-                        i=-I${mountpoint}/${driveletter}/${pathname}
-                    fi
-                else
-                    eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-                    if ! test "${leader}" = "${i}"; then
-                        eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
-                        eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
-                        driveletter=${no_mountpoint%%/*}
-                        i=${leader}${driveletter}:/${pathname}
-                    fi
-                fi
-            fi
-
-            args="${args} ${i}"
-        fi
-    fi
-done
-
-exec $prog $args
--- a/build/macosx/universal/mozconfig.common
+++ b/build/macosx/universal/mozconfig.common
@@ -48,42 +48,48 @@ ac_add_app_options i386 --with-macos-sdk
 ac_add_app_options x86_64 --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk
 
 # $MOZ_BUILD_APP is only defined when sourced by configure.  That's not a
 # problem, because the variables it affects only need to be set for
 # configure.
 if test -n "$MOZ_BUILD_APP" ; then
 if test "$MOZ_BUILD_APP" = "i386" -o  "$MOZ_BUILD_APP" = "ppc" -o "$MOZ_BUILD_APP" = "x86_64"; then
   TARGET_CPU=$MOZ_BUILD_APP
-  GCC_VERSION=4.2
+
+  if test -z "$CC" ; then
+     CC=gcc-4.2
+  fi
+
+  if test -z "$CXX" ; then
+     CXX=g++-4.2
+  fi
+
+  # $HOST_CXX is presently unused.  $HOST_CC will only be used during a cross
+  # compile.
+  HOST_CC=$CC
+  HOST_CXX=$CXX
+
+  NATIVE_CPU=`$topsrcdir/build/autoconf/config.guess | cut -f1 -d-`
+  if test "$NATIVE_CPU" = "powerpc" ; then
+    NATIVE_CPU=ppc
+  fi
 
   # It's not strictly necessary to specify -arch during native builds, but it
   # makes the merged about:buildconfig easier to follow, and it reduces
   # conditionalized differences between builds.
-  CC="gcc-$GCC_VERSION -arch $TARGET_CPU"
-  CXX="g++-$GCC_VERSION -arch $TARGET_CPU"
-
-  # $HOST_CXX is presently unused.  $HOST_CC will only be used during a cross
-  # compile.  Always use the 4.2 compiler, since it will always be present and
-  # will always work.
-  HOST_CC=gcc-4.2
-  HOST_CXX=g++-4.2
+  CC="$CC -arch $TARGET_CPU"
+  CXX="$CXX -arch $TARGET_CPU"
 
   # These must be set for cross builds, and don't hurt straight builds.
   RANLIB=ranlib
   AR=ar
   AS=$CC
   LD=ld
   STRIP="strip -x -S"
 
-  NATIVE_CPU=`$topsrcdir/build/autoconf/config.guess | cut -f1 -d-`
-  if test "$NATIVE_CPU" = "powerpc" ; then
-    NATIVE_CPU=ppc
-  fi
-
   # Let configure know that we mean business.
   if test "$NATIVE_CPU" != "$TARGET_CPU" ; then
     CROSS_COMPILE=1
   fi
 
   # Each per-CPU build should be entirely oblivious to the fact that a
   # universal binary will be produced.  The exception is packager.mk, which
   # needs to know to look for universal bits when building the .dmg.
--- a/build/pymake/pymake/builtins.py
+++ b/build/pymake/pymake/builtins.py
@@ -1,15 +1,40 @@
 # Basic commands implemented in Python
-import sys, os, shutil, time
+import errno, sys, os, shutil, time
 from getopt import getopt, GetoptError
 
 from process import PythonException
 
-__all__ = ["rm", "sleep", "touch"]
+__all__ = ["mkdir", "rm", "sleep", "touch"]
+
+def mkdir(args):
+  """
+  Emulate some of the behavior of mkdir(1).
+  Only supports the -p (--parents) argument.
+  """
+  try:
+    opts, args = getopt(args, "p", ["parents"])
+  except GetoptError, e:
+    raise PythonException, ("mkdir: %s" % e, 1)
+  parents = False
+  for o, a in opts:
+    if o in ('-p', '--parents'):
+      parents = True
+  for f in args:
+    try:
+      if parents:
+        os.makedirs(f)
+      else:
+        os.mkdir(f)
+    except OSError, e:
+      if e.errno == errno.EEXIST and parents:
+        pass
+      else:
+        raise PythonException, ("mkdir: %s" % e, 1)
 
 def rm(args):
   """
   Emulate most of the behavior of rm(1).
   Only supports the -r (--recursive) and -f (--force) arguments.
   """
   try:
     opts, args = getopt(args, "rRf", ["force", "recursive"])
--- a/build/pymake/pymake/implicit.py
+++ b/build/pymake/pymake/implicit.py
@@ -1,13 +1,14 @@
 """
 Implicit variables; perhaps in the future this will also include some implicit
 rules, at least match-anything cancellation rules.
 """
 
 variables = {
+    'MKDIR': '%pymake.builtins mkdir',
     'RM': '%pymake.builtins rm -f',
     'SLEEP': '%pymake.builtins sleep',
     'TOUCH': '%pymake.builtins touch',
     '.LIBPATTERNS': 'lib%.so lib%.a',
     '.PYMAKE': '1',
     }
 
new file mode 100644
--- /dev/null
+++ b/build/pymake/tests/mkdir-fail.mk
@@ -0,0 +1,7 @@
+#T returncode: 1
+all:
+	mkdir newdir/subdir
+	test ! -d newdir/subdir
+	test ! -d newdir
+	rm -r newdir
+	@echo TEST-PASS
new file mode 100644
--- /dev/null
+++ b/build/pymake/tests/mkdir.mk
@@ -0,0 +1,27 @@
+MKDIR ?= mkdir
+
+all:
+	$(MKDIR) newdir
+	test -d newdir
+	# subdir, parent exists
+	$(MKDIR) newdir/subdir
+	test -d newdir/subdir
+	# -p, existing dir
+	$(MKDIR) -p newdir
+	# -p, existing subdir
+	$(MKDIR) -p newdir/subdir
+	# multiple subdirs, existing parent
+	$(MKDIR) newdir/subdir1 newdir/subdir2
+	test -d newdir/subdir1 -a -d newdir/subdir2
+	rm -r newdir
+	# -p, subdir, no existing parent
+	$(MKDIR) -p newdir/subdir
+	test -d newdir/subdir
+	rm -r newdir
+	# -p, multiple subdirs, no existing parent
+	$(MKDIR) -p newdir/subdir1 newdir/subdir2
+	test -d newdir/subdir1 -a -d newdir/subdir2
+	# -p, multiple existing subdirs
+	$(MKDIR) -p newdir/subdir1 newdir/subdir2
+	rm -r newdir
+	@echo TEST-PASS
--- a/build/pymake/tests/rm.mk
+++ b/build/pymake/tests/rm.mk
@@ -3,11 +3,19 @@ all:
 	$(RM) nosuchfile
 	touch newfile
 	test -f newfile
 	$(RM) newfile
 	test ! -f newfile
 	mkdir newdir
 	test -d newdir
 	touch newdir/newfile
+	mkdir newdir/subdir
+	$(RM) -r newdir/subdir
+	test ! -d newdir/subdir
+	test -d newdir
+	mkdir newdir/subdir1 newdir/subdir2
+	$(RM) -r newdir/subdir1 newdir/subdir2
+	test ! -d newdir/subdir1 -a ! -d newdir/subdir2
+	test -d newdir
 	$(RM) -r newdir
 	test ! -d newdir
 	@echo TEST-PASS
--- a/build/unix/Makefile.in
+++ b/build/unix/Makefile.in
@@ -40,21 +40,19 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE       = build
 
-ifeq ($(USE_ELF_HACK)$(HOST_OS_ARCH)$(OS_ARCH),1LinuxLinux)
-ifneq (,$(filter %86 x86_64 arm,$(OS_TEST)))
+ifdef USE_ELF_HACK
 DIRS = elfhack
 endif
-endif
 
 include $(topsrcdir)/config/rules.mk
 
 libs:: $(srcdir)/run-mozilla.sh
 	$(INSTALL) $< $(DIST)/bin
 
 ifeq ($(OS_ARCH),OpenVMS)
 libs:: vms/mozilla.com vms/install.com vms/getinfo.com
--- a/build/unix/elfhack/elfhack.cpp
+++ b/build/unix/elfhack/elfhack.cpp
@@ -434,17 +434,17 @@ int do_relocation_section(Elf *elf, unsi
     section->shrink(new_rels.size() * section->getEntSize());
     ElfLocation *init = new ElfLocation(relhackcode, relhackcode->getEntryPoint());
     dyn->setValueForType(DT_INIT, init);
     // TODO: adjust the value according to the remaining number of relative relocations
     if (dyn->getValueForType(Rel_Type::d_tag_count))
         dyn->setValueForType(Rel_Type::d_tag_count, new ElfPlainValue(0));
 
     if (relhack->getOffset() + relhack->getSize() >= old_end) {
-        fprintf(stderr, "No gain. Aborting\n");
+        fprintf(stderr, "No gain. Skipping\n");
         return -1;
     }
     return 0;
 }
 
 static inline int backup_file(const char *name)
 {
     std::string fname(name);
@@ -454,31 +454,41 @@ static inline int backup_file(const char
 
 void do_file(const char *name, bool backup = false)
 {
     std::ifstream file(name, std::ios::in|std::ios::binary);
     Elf *elf = new Elf(file);
     unsigned int size = elf->getSize();
     fprintf(stderr, "%s: ", name);
 
+    for (ElfSection *section = elf->getSection(1); section != NULL;
+         section = section->getNext()) {
+        if (section->getName() &&
+            (strncmp(section->getName(), ".elfhack.", 9) == 0)) {
+            fprintf(stderr, "Already elfhacked. Skipping\n");
+            delete elf;
+            return;
+        }
+    }
+
     int exit = -1;
     switch (elf->getMachine()) {
     case EM_386:
         exit = do_relocation_section<Elf_Rel>(elf, R_386_RELATIVE);
         break;
     case EM_X86_64:
         exit = do_relocation_section<Elf_Rela>(elf, R_X86_64_RELATIVE);
         break;
     case EM_ARM:
         exit = do_relocation_section<Elf_Rel>(elf, R_ARM_RELATIVE);
         break;
     }
     if (exit == 0) {
         if (elf->getSize() >= size) {
-            fprintf(stderr, "No gain. Aborting\n");
+            fprintf(stderr, "No gain. Skipping\n");
         } else if (backup && backup_file(name) != 0) {
             fprintf(stderr, "Couln't create backup file\n");
         } else {
             std::ofstream ofile(name, std::ios::out|std::ios::binary|std::ios::trunc);
             elf->write(ofile);
             fprintf(stderr, "Reduced by %d bytes\n", size - elf->getSize());
         }
     }
--- a/build/unix/run-mozilla.sh
+++ b/build/unix/run-mozilla.sh
@@ -328,22 +328,16 @@ fi
 SHLIB_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${SHLIB_PATH:+":$SHLIB_PATH"}
 #
 ## Set LIBPATH for AIX
 LIBPATH=${MOZ_DIST_BIN}:${MRE_HOME}${LIBPATH:+":$LIBPATH"}
 #
 ## Set DYLD_LIBRARY_PATH for Mac OS X (Darwin)
 DYLD_LIBRARY_PATH=${MOZ_DIST_BIN}:${MRE_HOME}${DYLD_LIBRARY_PATH:+":$DYLD_LIBRARY_PATH"}
 #
-## Set LIBRARY_PATH for BeOS
-LIBRARY_PATH=${MOZ_DIST_BIN}:${MOZ_DIST_BIN}/components:${MRE_HOME}${LIBRARY_PATH:+":$LIBRARY_PATH"}
-#
-## Set ADDON_PATH for BeOS
-ADDON_PATH=${MOZ_DIST_BIN}${ADDON_PATH:+":$ADDON_PATH"}
-#
 ## Solaris Xserver(Xsun) tuning - use shared memory transport if available
 if [ "$XSUNTRANSPORT" = "" ]
 then 
         XSUNTRANSPORT="shmem" 
         XSUNSMESIZE="512"
         export XSUNTRANSPORT XSUNSMESIZE
 fi
 
--- a/config/JarMaker.py
+++ b/config/JarMaker.py
@@ -51,16 +51,19 @@ from time import localtime
 from optparse import OptionParser
 from MozZipFile import ZipFile
 from cStringIO import StringIO
 from datetime import datetime
 
 from utils import pushback_iter, lockFile
 from Preprocessor import Preprocessor
 from buildlist import addEntriesToListFile
+if sys.platform == "win32":
+  from ctypes import windll, WinError
+  CreateHardLink = windll.kernel32.CreateHardLinkA
 
 __all__ = ['JarMaker']
 
 class ZipEntry:
   '''Helper class for jar output.
 
   This class defines a simple file-like object for a zipfile.ZipEntry
   so that we can consecutively write to it and then close it.
@@ -401,17 +404,17 @@ class JarMaker(object):
         pp.do_include(inf)
         outf.close()
         inf.close()
         return
       # copy or symlink if newer or overwrite
       if (m.group('optOverwrite')
           or (getModTime(realsrc) >
               outHelper.getDestModTime(m.group('output')))):
-        if self.outputFormat == 'symlink' and hasattr(os, 'symlink'):
+        if self.outputFormat == 'symlink':
           outHelper.symlink(realsrc, out)
           return
         outf = outHelper.getOutput(out)
         # open in binary mode, this can be images etc
         inf = open(realsrc, 'rb')
         outf.write(inf.read())
         outf.close()
         inf.close()
@@ -463,17 +466,23 @@ class JarMaker(object):
     def symlink(self, src, dest):
       out = self.ensureDirFor(dest)
       # remove previous link or file
       try:
         os.remove(out)
       except OSError, e:
         if e.errno != errno.ENOENT:
           raise
-      os.symlink(src, out)
+      if sys.platform != "win32":
+        os.symlink(src, out)
+      else:
+        # On Win32, use ctypes to create a hardlink
+        rv = CreateHardLink(out, src, None)
+        if rv == 0:
+          raise WinError()
 
 def main():
   jm = JarMaker()
   p = jm.getCommandLineParser()
   (options, args) = p.parse_args()
   jm.processIncludes(options.I)
   jm.outputFormat = options.f
   if options.e:
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -163,17 +163,17 @@ export:: $(STL_WRAPPERS_SENTINEL)
 GARBAGE += $(STL_WRAPPERS_SENTINEL)
 GARBAGE_DIRS += stl_wrappers
 endif
 
 install::
 	$(SYSINSTALL) $(IFLAGS1) $(DEPTH)/mozilla-config.h $(DESTDIR)$(includedir)
 
 GARBAGE += \
-	$(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES) buildid $(srcdir)/*.pyc
+  $(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES) buildid $(srcdir)/*.pyc *.pyc
 
 ifndef CROSS_COMPILE
 ifdef USE_ELF_DYNSTR_GC
 elf-dynstr-gc: elf-dynstr-gc.c $(GLOBAL_DEPS)
 	$(CC) $(COMPILE_CFLAGS) $(GLIB_CFLAGS) -o $@ $< $(LDFLAGS) $(GLIB_LIBS) 
 endif
 endif
 
@@ -186,16 +186,17 @@ endif
 
 PYUNITS := \
   unit-Expression.py \
   unit-Preprocessor.py \
   unit-nsinstall.py \
   unit-printprereleasesuffix.py \
   unit-JarMaker.py \
   unit-buildlist.py \
+  unit-expandlibs.py \
   $(NULL)
 
 check:: check-python-modules check-jar-mn
 
 check-python-modules::
 	@$(EXIT_ON_ERROR) \
 	for test in $(PYUNITS); do \
 	  $(PYTHON) $(srcdir)/tests/$$test ; \
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -123,18 +123,16 @@ MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLO
 MOZ_MAIL_NEWS	= @MOZ_MAIL_NEWS@
 MOZ_PLAINTEXT_EDITOR_ONLY = @MOZ_PLAINTEXT_EDITOR_ONLY@
 BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@
 MOZ_ENABLE_LIBXUL = @MOZ_ENABLE_LIBXUL@
 ENABLE_TESTS	= @ENABLE_TESTS@
 IBMBIDI = @IBMBIDI@
 MOZ_UNIVERSALCHARDET = @MOZ_UNIVERSALCHARDET@
 ACCESSIBILITY = @ACCESSIBILITY@
-MOZ_VIEW_SOURCE = @MOZ_VIEW_SOURCE@
-MOZ_JSLOADER  = @MOZ_JSLOADER@
 MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@
 MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@
 XPCOM_USE_LEA = @XPCOM_USE_LEA@
 MOZ_INSTALLER	= @MOZ_INSTALLER@
 MOZ_UPDATER	= @MOZ_UPDATER@
 MOZ_UPDATE_CHANNEL	= @MOZ_UPDATE_CHANNEL@
 MOZ_UPDATE_PACKAGING	= @MOZ_UPDATE_PACKAGING@
 MOZ_NO_ACTIVEX_SUPPORT = @MOZ_NO_ACTIVEX_SUPPORT@
@@ -336,19 +334,16 @@ XLDFLAGS	= @XLDFLAGS@
 XLIBS		= @XLIBS@
 XEXT_LIBS	= @XEXT_LIBS@
 XCOMPOSITE_LIBS	= @XCOMPOSITE_LIBS@
 XSS_LIBS	= @XSS_LIBS@
 
 MOZ_THUMB2	= @MOZ_THUMB2@
 
 WIN_TOP_SRC	= @WIN_TOP_SRC@
-CYGWIN_WRAPPER	= @CYGWIN_WRAPPER@
-AS_PERL         = @AS_PERL@
-CYGDRIVE_MOUNT	= @CYGDRIVE_MOUNT@
 AR		= @AR@
 AR_FLAGS	= @AR_FLAGS@
 AR_EXTRACT	= @AR_EXTRACT@
 AR_LIST		= @AR_LIST@
 AR_DELETE	= @AR_DELETE@
 AS		= @AS@
 ASFLAGS		= @ASFLAGS@
 AS_DASH_C_FLAG	= @AS_DASH_C_FLAG@
@@ -366,16 +361,17 @@ MIDL_FLAGS	= @MIDL_FLAGS@
 DLL_PREFIX	= @DLL_PREFIX@
 LIB_PREFIX	= @LIB_PREFIX@
 OBJ_SUFFIX	= @OBJ_SUFFIX@
 LIB_SUFFIX	= @LIB_SUFFIX@
 DLL_SUFFIX	= @DLL_SUFFIX@
 BIN_SUFFIX	= @BIN_SUFFIX@
 ASM_SUFFIX	= @ASM_SUFFIX@
 IMPORT_LIB_SUFFIX = @IMPORT_LIB_SUFFIX@
+LIBS_DESC_SUFFIX = @LIBS_DESC_SUFFIX@
 USE_N32		= @USE_N32@
 HAVE_64BIT_OS	= @HAVE_64BIT_OS@
 
 # Temp hack.  It is not my intention to leave this crap in here for ever.
 # Im talking to fur right now to solve the problem without introducing 
 # NS_USE_NATIVE to the build system -ramiro.
 NS_USE_NATIVE = @NS_USE_NATIVE@
 
--- a/config/config.mk
+++ b/config/config.mk
@@ -94,26 +94,16 @@ core_winabspath = $(firstword $(subst /,
 # It will usually be the well-loved $(DIST)/bin, today, but can also be an
 # XPI-contents staging directory for ambitious and right-thinking extensions.
 FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)
 
 ifdef XPI_NAME
 DEFINES += -DXPI_NAME=$(XPI_NAME)
 endif
 
-# MAKE_JARS_TARGET is a staging area for make-jars.pl.  When packaging in
-# the jar format, make-jars leaves behind a directory structure that's not
-# needed in $(FINAL_TARGET).  For both, flat, and symlink, the directory
-# structure contains the chrome, so leave it in $(FINAL_TARGET).
-ifeq (jar,$(MOZ_CHROME_FILE_FORMAT))
-MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage)
-else
-MAKE_JARS_TARGET = $(FINAL_TARGET)
-endif
-
 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
 VERSION_NUMBER		= 50
 
 ifeq ($(HOST_OS_ARCH),WINNT)
 win_srcdir	:= $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
 BUILD_TOOLS	= $(WIN_TOP_SRC)/build/unix
 else
 win_srcdir	:= $(srcdir)
@@ -125,19 +115,16 @@ AUTOCONF_TOOLS	= $(topsrcdir)/build/auto
 
 ifeq ($(OS_ARCH),QNX)
 ifeq ($(OS_TARGET),NTO)
 LD		:= qcc -Vgcc_ntox86 -nostdlib
 else
 LD		:= $(CC)
 endif
 endif
-ifeq ($(OS_ARCH),BeOS)
-BEOS_ADDON_WORKAROUND	= 1
-endif
 
 #
 # Strip off the excessively long version numbers on these platforms,
 # but save the version to allow multiple versions of the same base
 # platform to be built in the same tree.
 #
 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
 OS_RELEASE	:= $(basename $(OS_RELEASE))
@@ -260,22 +247,16 @@ endif # WINNT && !GNU_CC
 
 ifndef BUILD_STATIC_LIBS
 _ENABLE_PIC=1
 endif
 ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
 _ENABLE_PIC=1
 endif
 
-# In Firefox, all components are linked into either libxul or the static
-# meta-component, and should be compiled with PIC.
-ifdef MOZ_META_COMPONENT
-_ENABLE_PIC=1
-endif
-
 # If module is going to be merged into the nsStaticModule, 
 # make sure that the entry points are translated and 
 # the module is built static.
 
 ifdef IS_COMPONENT
 ifdef EXPORT_LIBRARY
 ifneq (,$(BUILD_STATIC_LIBS))
 ifdef MODULE_NAME
@@ -337,20 +318,16 @@ endif
 endif
 
 ifndef STATIC_LIBRARY_NAME
 ifdef LIBRARY_NAME
 STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
 endif
 endif
 
-ifeq (WINNT,$(OS_ARCH))
-MOZ_FAKELIBS = 1
-endif
-
 # This comes from configure
 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
 NO_PROFILE_GUIDED_OPTIMIZE = 1
 endif
 
 # No sense in profiling tools
 ifdef INTERNAL_TOOLS
 NO_PROFILE_GUIDED_OPTIMIZE = 1
@@ -418,18 +395,17 @@ ifdef BUILD_STATIC_LIBS
 DEFINES += \
         -D_IMPL_NS_GFX \
         -D_IMPL_NS_MSG_BASE \
         -D_IMPL_NS_WIDGET \
         $(NULL)
 endif
 endif
 
-# Flags passed to make-jars.pl
-
+# Flags passed to JarMaker.py
 MAKE_JARS_FLAGS = \
 	-t $(topsrcdir) \
 	-f $(MOZ_CHROME_FILE_FORMAT) \
 	$(NULL)
 
 ifdef USE_EXTENSION_MANIFEST
 MAKE_JARS_FLAGS += -e
 endif
@@ -452,26 +428,26 @@ endif
 # Personal makefile customizations go in these optional make include files.
 #
 MY_CONFIG	:= $(DEPTH)/config/myconfig.mk
 MY_RULES	:= $(DEPTH)/config/myrules.mk
 
 #
 # Default command macros; can be overridden in <arch>.mk.
 #
-CCC		= $(CXX)
-NFSPWD		= $(CONFIG_TOOLS)/nfspwd
-PURIFY		= purify $(PURIFYOPTIONS)
-QUANTIFY	= quantify $(QUANTIFYOPTIONS)
+CCC = $(CXX)
+NFSPWD = $(CONFIG_TOOLS)/nfspwd
+PURIFY = purify $(PURIFYOPTIONS)
+QUANTIFY = quantify $(QUANTIFYOPTIONS)
 ifdef CROSS_COMPILE
-XPIDL_COMPILE 	= $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
-XPIDL_LINK	= $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
+XPIDL_COMPILE = $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
+XPIDL_LINK = $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
 else
-XPIDL_COMPILE 	= $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
-XPIDL_LINK	= $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
+XPIDL_COMPILE = $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
+XPIDL_LINK = $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
 endif
 
 # Java macros
 JAVA_GEN_DIR  = _javagen
 JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
 JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
 
 INCLUDES = \
@@ -678,21 +654,21 @@ ifeq (1,$(HAS_XCODE_2_1))
 XCODE_PRODUCT_DIR = build/$(BUILDSTYLE)
 else
 XCODE_PRODUCT_DIR = build
 endif # HAS_XCODE_2_1=1
 endif # OS_ARCH=Darwin
 
 
 ifdef MOZ_NATIVE_MAKEDEPEND
-MKDEPEND_DIR	=
-MKDEPEND	= $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND)
+MKDEPEND_DIR =
+MKDEPEND = $(MOZ_NATIVE_MAKEDEPEND)
 else
-MKDEPEND_DIR	= $(CONFIG_TOOLS)/mkdepend
-MKDEPEND	= $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
+MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
+MKDEPEND = $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
 endif
 
 # Set link flags according to whether we want a console.
 ifdef MOZ_WINCONSOLE
 ifeq ($(MOZ_WINCONSOLE),1)
 ifeq ($(OS_ARCH),OS2)
 BIN_FLAGS	+= -Zlinker -PM:VIO
 endif
@@ -736,32 +712,32 @@ endif
 ######################################################################
 # Now test variables that might have been set or overridden by $(MY_CONFIG).
 
 DEFINES		+= -DOSTYPE=\"$(OS_CONFIG)\"
 DEFINES		+= -DOSARCH=$(OS_ARCH)
 
 ######################################################################
 
-GARBAGE		+= $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB $(FAKE_LIBRARY)
+GARBAGE		+= $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
 
 ifeq ($(OS_ARCH),Darwin)
 ifndef NSDISTMODE
 NSDISTMODE=absolute_symlink
 endif
 PWD := $(CURDIR)
 endif
 
 ifdef NSINSTALL_BIN
-NSINSTALL	= $(CYGWIN_WRAPPER) $(NSINSTALL_BIN)
+NSINSTALL = $(NSINSTALL_BIN)
 else
 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
-NSINSTALL	= $(MOZ_TOOLS_DIR)/nsinstall
+NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
 else
-NSINSTALL	= $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
+NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
 endif # OS2
 endif # NSINSTALL_BIN
 
 
 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
 INSTALL		= $(NSINSTALL)
 else
 ifeq ($(NSDISTMODE),copy)
@@ -780,22 +756,16 @@ else
 INSTALL		= $(NSINSTALL) -R
 endif # absolute_symlink
 endif # copy
 endif # WINNT/OS2
 
 # Use nsinstall in copy mode to install files on the system
 SYSINSTALL	= $(NSINSTALL) -t
 
-ifeq ($(OS_ARCH),WINNT)
-ifneq (,$(CYGDRIVE_MOUNT))
-export CYGDRIVE_MOUNT
-endif
-endif
-
 #
 # Localization build automation
 #
 
 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
 # overridden by the command line. (Besides, AB_CD is prettier).
 AB_CD = $(MOZ_UI_LOCALE)
@@ -817,16 +787,26 @@ ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
 endif
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
 endif
 endif
 
+ifdef LOCALE_MERGEDIR
+MERGE_FILE = $(firstword \
+  $(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
+  $(wildcard $(LOCALE_SRCDIR)/$(1)) \
+  $(srcdir)/en-US/$(1) )
+else
+MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
+endif
+MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
+
 ifdef WINCE
 RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
 else
 ifeq (OS2,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
 else
 ifneq (WINNT,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
@@ -846,8 +826,17 @@ JAVAC_FLAGS += -g
 endif
 
 ifdef TIERS
 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
 endif
 
 OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
+
+EXPAND_LIBS = $(PYTHON) -I$(DEPTH)/config $(topsrcdir)/config/expandlibs.py
+EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py
+EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py
+EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
+EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
+EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
+EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
+EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist -- $(MKSHLIB)
new file mode 100644
--- /dev/null
+++ b/config/expandlibs.py
@@ -0,0 +1,125 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is a build helper for libraries
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Mike Hommey <mh@glandium.org>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+'''Expandlibs is a system that allows to replace some libraries with a
+descriptor file containing some linking information about them.
+
+The descriptor file format is as follows:
+---8<-----
+OBJS = a.o b.o ...
+LIBS = libfoo.a libbar.a ...
+--->8-----
+
+(In the example above, OBJ_SUFFIX is o and LIB_SUFFIX is a).
+
+Expandlibs also canonicalizes how to pass libraries to the linker, such
+that only the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} form needs to be used:
+given a list of files, expandlibs will replace items with the form
+${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} following these rules:
+
+- If a ${DLL_PREFIX}${ROOT}.${DLL_SUFFIX} or
+  ${DLL_PREFIX}${ROOT}.${IMPORT_LIB_SUFFIX} file exists, use that instead
+- If the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} file exists, use it
+- If a ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX}.${LIB_DESC_SUFFIX} file exists,
+  replace ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} with the OBJS and LIBS the
+  descriptor contains. And for each of these LIBS, also apply the same
+  rules.
+'''
+from __future__ import with_statement
+import sys, os
+import expandlibs_config as conf
+
+class LibDescriptor(dict):
+    KEYS = ['OBJS', 'LIBS']
+
+    def __init__(self, content=None):
+        '''Creates an instance of a lib descriptor, initialized with contents
+        from a list of strings when given. This is intended for use with
+        file.readlines()'''
+        if isinstance(content, list) and all([isinstance(item, str) for item in content]):
+            pass
+        elif content is not None:
+            raise TypeError("LibDescriptor() arg 1 must be None or a list of strings")
+        super(LibDescriptor, self).__init__()
+        for key in self.KEYS:
+            self[key] = []
+        if not content:
+            return
+        for key, value in [(s.strip() for s in item.split('=', 2)) for item in content if item.find('=') >= 0]:
+            if key in self.KEYS:
+                self[key] = value.split()
+
+    def __str__(self):
+        '''Serializes the lib descriptor'''
+        return '\n'.join('%s = %s' % (k, ' '.join(self[k])) for k in self.KEYS if len(self[k]))
+
+class ExpandArgs(list):
+    def __init__(self, args):
+        '''Creates a clone of the |args| list and performs file expansion on
+        each item it contains'''
+        super(ExpandArgs, self).__init__()
+        for arg in args:
+            self += self._expand(arg)
+
+    def _expand(self, arg):
+        '''Internal function doing the actual work'''
+        (root, ext) = os.path.splitext(arg)
+        if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
+            return [arg]
+        if len(conf.IMPORT_LIB_SUFFIX):
+            dll = root + conf.IMPORT_LIB_SUFFIX
+        else:
+            dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
+        if os.path.exists(dll):
+            return [dll]
+        if os.path.exists(arg):
+            return [arg]
+        return self._expand_desc(arg)
+
+    def _expand_desc(self, arg):
+        '''Internal function taking care of lib descriptor expansion only'''
+        if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
+            with open(arg + conf.LIBS_DESC_SUFFIX, 'r') as f:
+                desc = LibDescriptor(f.readlines())
+            objs = desc['OBJS']
+            for lib in desc['LIBS']:
+                objs += self._expand(lib)
+            return objs
+        return [arg]
+
+if __name__ == '__main__':
+    print " ".join(ExpandArgs(sys.argv[1:]))
new file mode 100644
--- /dev/null
+++ b/config/expandlibs_config.py.in
@@ -0,0 +1,56 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is a build helper for libraries
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Mike Hommey <mh@glandium.org>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+def normalize_suffix(suffix):
+    '''Returns a normalized suffix, i.e. ensures it starts with a dot and
+    doesn't starts or ends with whitespace characters'''
+    value = suffix.strip()
+    if len(value) and not value.startswith('.'):
+        value = '.' + value
+    return value
+
+# Variables from the build system
+AR = "@AR@"
+AR_EXTRACT = "@AR_EXTRACT@".replace('$(AR)', AR)
+DLL_PREFIX = "@DLL_PREFIX@"
+LIB_PREFIX = "@LIB_PREFIX@"
+OBJ_SUFFIX = normalize_suffix("@OBJ_SUFFIX@")
+LIB_SUFFIX = normalize_suffix("@LIB_SUFFIX@")
+DLL_SUFFIX = normalize_suffix("@DLL_SUFFIX@")
+IMPORT_LIB_SUFFIX = normalize_suffix("@IMPORT_LIB_SUFFIX@")
+LIBS_DESC_SUFFIX = normalize_suffix("@LIBS_DESC_SUFFIX@")
+EXPAND_LIBS_LIST_STYLE = "@EXPAND_LIBS_LIST_STYLE@"
new file mode 100644
--- /dev/null
+++ b/config/expandlibs_exec.py
@@ -0,0 +1,155 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is a build helper for libraries
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Mike Hommey <mh@glandium.org>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+'''expandlibs-exec.py applies expandlibs rules, and some more (see below) to
+a given command line, and executes that command line with the expanded
+arguments.
+
+With the --extract argument (useful for e.g. $(AR)), it extracts object files
+from static libraries (or use those listed in library descriptors directly).
+
+With the --uselist argument (useful for e.g. $(CC)), it replaces all object
+files with a list file. This can be used to avoid limitations in the length
+of a command line. The kind of list file format used depends on the
+EXPAND_LIBS_LIST_STYLE variable: 'list' for MSVC style lists (@file.list)
+or 'linkerscript' for GNU ld linker scripts.
+See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
+'''
+from __future__ import with_statement
+import sys
+import os
+from expandlibs import ExpandArgs
+import expandlibs_config as conf
+from optparse import OptionParser
+import subprocess
+import tempfile
+import shutil
+
+class ExpandArgsMore(ExpandArgs):
+    ''' Meant to be used as 'with ExpandArgsMore(args) as ...: '''
+    def __enter__(self):
+        self.tmp = []
+        return self
+        
+    def __exit__(self, type, value, tb):
+        '''Automatically remove temporary files'''
+        for tmp in self.tmp:
+            if os.path.isdir(tmp):
+                shutil.rmtree(tmp, True)
+            else:
+                os.remove(tmp)
+
+    def extract(self):
+        self[0:] = self._extract(self)
+
+    def _extract(self, args):
+        '''When a static library name is found, either extract its contents
+        in a temporary directory or use the information found in the
+        corresponding lib descriptor.
+        '''
+        ar_extract = conf.AR_EXTRACT.split()
+        newlist = []
+        for arg in args:
+            if os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
+                if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
+                    newlist += self._extract(self._expand_desc(arg))
+                elif os.path.exists(arg) and len(ar_extract):
+                    tmp = tempfile.mkdtemp(dir=os.curdir)
+                    self.tmp.append(tmp)
+                    subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
+                    objs = []
+                    for root, dirs, files in os.walk(tmp):
+                        objs += [os.path.join(root, f) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
+                    newlist += objs
+                else:
+                    newlist += [arg]
+            else:
+                newlist += [arg]
+        return newlist
+
+    def makelist(self):
+        '''Replaces object file names with a temporary list file, using a
+        list format depending on the EXPAND_LIBS_LIST_STYLE variable
+        '''
+        objs = [o for o in self if os.path.splitext(o)[1] == conf.OBJ_SUFFIX]
+        if not len(objs): return
+        fd, tmp = tempfile.mkstemp(suffix=".list",dir=os.curdir)
+        if conf.EXPAND_LIBS_LIST_STYLE == "linkerscript":
+            content = ["INPUT(%s)\n" % obj for obj in objs]
+            ref = tmp
+        elif conf.EXPAND_LIBS_LIST_STYLE == "list":
+            content = ["%s\n" % obj for obj in objs]
+            ref = "@" + tmp
+        else:
+            os.remove(tmp)
+            return
+        self.tmp.append(tmp)
+        f = os.fdopen(fd, "w")
+        f.writelines(content)
+        f.close()
+        idx = self.index(objs[0])
+        newlist = self[0:idx] + [ref] + [item for item in self[idx:] if item not in objs]
+        self[0:] = newlist
+
+def main():
+    parser = OptionParser()
+    parser.add_option("--extract", action="store_true", dest="extract",
+        help="when a library has no descriptor file, extract it first, when possible")
+    parser.add_option("--uselist", action="store_true", dest="uselist",
+        help="use a list file for objects when executing a command")
+    parser.add_option("--verbose", action="store_true", dest="verbose",
+        help="display executed command and temporary files content")
+
+    (options, args) = parser.parse_args()
+
+    with ExpandArgsMore(args) as args:
+        if options.extract:
+            args.extract()
+        if options.uselist:
+            args.makelist()
+
+        if options.verbose:
+            print >>sys.stderr, "Executing: " + " ".join(args)
+            for tmp in [f for f in args.tmp if os.path.isfile(f)]:
+                print >>sys.stderr, tmp + ":"
+                with open(tmp) as file:
+                    print >>sys.stderr, "".join(["    " + l for l in file.readlines()])
+            sys.stderr.flush()
+        exit(subprocess.call(args))
+
+if __name__ == '__main__':
+    main()
new file mode 100644
--- /dev/null
+++ b/config/expandlibs_gen.py
@@ -0,0 +1,57 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is a build helper for libraries
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Mike Hommey <mh@glandium.org>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+'''Given a list of object files and library names, prints a library
+descriptor to standard output'''
+
+import sys
+import os
+import expandlibs_config as conf
+from expandlibs import LibDescriptor
+
+def generate(args):
+    desc = LibDescriptor()
+    for arg in args:
+        if os.path.splitext(arg)[1] == conf.OBJ_SUFFIX:
+            desc['OBJS'].append(os.path.abspath(arg))
+        elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
+             (os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
+            desc['LIBS'].append(os.path.abspath(arg))
+    return desc
+
+if __name__ == '__main__':
+    print generate(sys.argv[1:])
deleted file mode 100644
--- a/config/make-jars.pl
+++ /dev/null
@@ -1,613 +0,0 @@
-#!/perl
-
-# make-jars [-f] [-v] [-l] [-x] [-a] [-e] [-d <chromeDir>] [-s <srcdir>] [-t <topsrcdir>] [-c <localedir>] [-j <jarDir>] [-z zipprog] [-o operating-system] < <jar.mn>
-
-my $cygwin_mountprefix = "";
-if ($^O eq "cygwin") {
-    $cygwin_mountprefix = $ENV{CYGDRIVE_MOUNT};
-    if ($cygwin_mountprefix eq "") {
-      $cygwin_mountprefix = `mount -p | awk '{ if (/^\\//) { print \$1; exit } }'`;
-      if ($cygwin_mountprefix eq "") {
-        print "Cannot determine cygwin mount points. Exiting.\n";
-        exit(1);
-      }
-    }
-    chomp($cygwin_mountprefix);
-    # Remove extra ^M caused by using dos-mode line-endings
-    chop $cygwin_mountprefix if (substr($cygwin_mountprefix, -1, 1) eq "\r");
-} else {
-    # we'll be pulling in some stuff from the script directory
-    require FindBin;
-    import FindBin;
-    push @INC, $FindBin::Bin;
-}
-
-use strict;
-
-use Getopt::Std;
-use Cwd;
-use File::stat;
-use Time::localtime;
-use File::Copy;
-use File::Path;
-use File::Spec;
-use File::Basename;
-use IO::File;
-use Config;
-require mozLock;
-import mozLock;
-
-my $objdir = getcwd;
-
-# if there's a "--", everything after it goes into $defines.  We don't do
-# this with the remaining args in @ARGV after the getopts call because
-# old versions of Getopt::Std don't understand "--".
-my $ddindex = 0;
-foreach my $arg (@ARGV) {
-  ++$ddindex;
-  last if ($arg eq "--");
-}
-my $defines = join(' ', @ARGV[ $ddindex .. $#ARGV ]);
-
-getopts("d:s:t:c:j:f:avqlD:o:p:xz:e");
-
-my $baseFilesDir = ".";
-if (defined($::opt_s)) {
-    $baseFilesDir = $::opt_s;
-}
-
-my $topSrcDir;
-if (defined($::opt_t)) {
-    $topSrcDir = $::opt_t;
-}
-
-my $localeDir;
-if (defined($::opt_c)) {
-    $localeDir = $::opt_c;
-}
-
-my $maxCmdline = 4000;
-if ($Config{'archname'} =~ /VMS/) {
-    $maxCmdline = 200;
-}
-
-my $chromeDir = ".";
-if (defined($::opt_d)) {
-    $chromeDir = $::opt_d;
-}
-
-my $jarDir = $chromeDir;
-if (defined($::opt_j)) {
-    $jarDir = $::opt_j;
-}
-
-my $verbose = 0;
-if (defined($::opt_v)) {
-    $verbose = 1;
-}
-
-my $quiet = 0;
-if (defined($::opt_q)) {
-    $quiet = 1;
-}
-
-my $fileformat = "jar";
-if (defined($::opt_f)) {
-    ($fileformat = $::opt_f) =~ tr/A-Z/a-z/;
-}
-
-if ("$fileformat" ne "jar" &&
-    "$fileformat" ne "flat" &&
-    "$fileformat" ne "symlink" &&
-    "$fileformat" ne "both") {
-    print "File format specified by -f option must be one of: jar, flat, both, or symlink.\n";
-    exit(1);
-}
-
-my $zipmoveopt = "";
-if ("$fileformat" eq "jar") {
-    $zipmoveopt = "-m -0";
-}
-if ("$fileformat" eq "both") {
-    $zipmoveopt = "-0";
-}
-
-my $nofilelocks = 0;
-if (defined($::opt_l)) {
-    $nofilelocks = 1;
-}
-
-my $autoreg = 1;
-if (defined($::opt_a)) {
-    $autoreg = 0;
-}
-
-my $useExtensionManifest = 0;
-if (defined($::opt_e)) {
-    $useExtensionManifest = 1;
-}
-
-my $preprocessor = "";
-if (defined($::opt_p)) {
-    $preprocessor = $::opt_p;
-}
-
-my $force_x11 = 0;
-if (defined($::opt_x)) {
-    $force_x11 = 1;
-}
-
-my $zipprog = $ENV{ZIP};
-if (defined($::opt_z)) {
-    $zipprog = $::opt_z;
-}
-
-if ($zipprog eq "") {
-    print "A valid zip program must be given via the -z option or the ZIP environment variable. Exiting.\n";
-    exit(1);
-}
-
-my $force_os;
-if (defined($::opt_o)) {
-    $force_os = $::opt_o;
-}
-
-if ($verbose) {
-    print "make-jars "
-        . "-v -d $chromeDir "
-        . "-j $jarDir "
-        . "-z $zipprog "
-        . ($fileformat ? "-f $fileformat " : "")
-        . ($nofilelocks ? "-l " : "")
-        . ($baseFilesDir ? "-s $baseFilesDir " : "")
-        . "\n";
-}
-
-my $win32 = ($^O =~ /((MS)?win32)|msys|cygwin|os2/i) ? 1 : 0;
-my $macos = ($^O =~ /MacOS|darwin/i) ? 1 : 0;
-my $unix  = !($win32 || $macos) ? 1 : 0;
-my $vms   = ($^O =~ /VMS/i) ? 1 : 0;
-
-if ($force_x11) {
-    $win32 = 0;
-    $macos = 0;
-    $unix = 1;
-}
-
-if (defined($force_os)) {
-    $win32 = 0;
-    $macos = 0;
-    $unix = 0;
-    if ($force_os eq "WINNT") {
-    $win32 = 1;
-    } elsif ($force_os eq "OS2") {
-    $win32 = 1;
-    } elsif ($force_os eq "Darwin") {
-    $macos = 1;
-    } else {
-    $unix = 1;
-    }
-}
-
-sub foreignPlatformFile
-{
-   my ($jarfile) = @_;
-   
-   if (!$win32 && index($jarfile, "-win") != -1) {
-     return 1;
-   }
-   
-   if (!$unix && index($jarfile, "-unix") != -1) {
-     return 1; 
-   }
-
-   if (!$macos && index($jarfile, "-mac") != -1) {
-     return 1;
-   }
-
-   return 0;
-}
-
-sub foreignPlatformPath
-{
-   my ($jarpath) = @_;
-   
-   if (!$win32 && index($jarpath, "-platform/win") != -1) {
-     return 1;
-   }
-   
-   if (!$unix && index($jarpath, "-platform/unix") != -1) {
-     return 1; 
-   }
-
-   if (!$macos && index($jarpath, "-platform/mac") != -1) {
-     return 1;
-   }
-
-   return 0;
-}
-
-sub zipErrorCheck($$)
-{
-    my ($err,$lockfile) = @_;
-    return if ($err == 0 || $err == 12);
-    mozUnlock($lockfile) if (!$nofilelocks);
-    die ("Error invoking zip: $err");
-}
-
-sub JarIt
-{
-    my ($destPath, $jarPath, $jarfile, $args, $overrides) = @_;
-    my $oldDir = cwd();
-    my $jarchive = _moz_abs2rel("$jarPath/$jarfile.jar", "$destPath/$jarfile", 1);
-    chdir("$destPath/$jarfile");
-
-    if ("$fileformat" eq "flat" || "$fileformat" eq "symlink") {
-        unlink($jarchive) if ( -e $jarchive);
-        chdir($oldDir);
-        return 0;
-    }
-
-    #print "cd $destPath/$jarfile\n";
-    my $argOpt = "-X";
-    $argOpt = "-uX" if ( -e $jarchive);
-
-    my $lockfile = "../$jarfile.lck";
-
-    mozLock($lockfile) if (!$nofilelocks);
-
-    if (!($args eq "")) {
-        my $err = 0; 
-
-        #print "$zipprog $zipmoveopt -uX $jarchive $args\n";
-
-        # Handle posix cmdline limits
-        while (length($args) > $maxCmdline) {
-            #print "Exceeding POSIX cmdline limit: " . length($args) . "\n";
-            my $subargs = substr($args, 0, $maxCmdline-1);
-            my $pos = rindex($subargs, " ");
-            $subargs = substr($args, 0, $pos);
-            $args = substr($args, $pos);
-
-            #print "$zipprog $zipmoveopt -uX $jarchive $subargs\n";
-            #print "Length of subargs: " . length($subargs) . "\n";
-            system("$zipprog $zipmoveopt $argOpt $jarchive $subargs") == 0 or
-                $err = $? >> 8;
-            zipErrorCheck($err,$lockfile);
-        }
-        #print "Length of args: " . length($args) . "\n";
-        #print "$zipprog $zipmoveopt -uX $jarchive $args\n";
-        system("$zipprog $zipmoveopt $argOpt $jarchive $args") == 0 or
-            $err = $? >> 8;
-        zipErrorCheck($err,$lockfile);
-    }
-
-    if (!($overrides eq "")) {
-        my $err = 0; 
-        print "+++ overriding $overrides\n" unless $quiet;
-          
-        while (length($overrides) > $maxCmdline) {
-            #print "Exceeding POSIX cmdline limit: " . length($overrides) . "\n";
-            my $subargs = substr($overrides, 0, $maxCmdline-1);
-            my $pos = rindex($subargs, " ");
-            $subargs = substr($overrides, 0, $pos);
-            $overrides = substr($overrides, $pos);
-
-            #print "$zipprog $zipmoveopt -X $jarchive $subargs\n";       
-            #print "Length of subargs: " . length($subargs) . "\n";
-            system("$zipprog $zipmoveopt -X $jarchive $subargs") == 0 or
-                $err = $? >> 8;
-            zipErrorCheck($err,$lockfile);
-        }
-        #print "Length of args: " . length($overrides) . "\n";
-        #print "$zipprog $zipmoveopt -X $jarchive $overrides\n";
-        system("$zipprog $zipmoveopt -X $jarchive $overrides\n") == 0 or 
-        $err = $? >> 8;
-        zipErrorCheck($err,$lockfile);
-    }
-    mozUnlock($lockfile) if (!$nofilelocks);
-    chdir($oldDir);
-    #print "cd $oldDir\n";
-}
-
-sub _moz_rel2abs
-{
-    my ($path, $isdir) = @_;
-    $path = File::Spec->catfile(getcwd, $path)
-        unless File::Spec->file_name_is_absolute($path);
-    $path = File::Spec->canonpath($path);
-    $path =~ s|\\|/|g if $path =~ s/^([A-Z]:\\)/\L$1/;
-    my (@dirs) = reverse split(m:/:, $path);
-    shift @dirs unless $isdir;
-    my ($up) = File::Spec->updir();
-    foreach (reverse 0 .. $#dirs) {
-        splice(@dirs, $_, 2) if ($dirs[$_] eq $up);
-    }
-    return reverse @dirs;
-}
-
-sub _moz_abs2rel
-{
-    my ($target, $basedir, $isdir) = @_;
-    my (@target) = _moz_rel2abs($target, 1);
-    my (@basedir) = _moz_rel2abs($basedir, $isdir);
-    shift @target, shift @basedir
-        while @target && @basedir && $target[0] eq $basedir[0];
-    return File::Spec->catfile((File::Spec->updir()) x @basedir, @target);
-}
-
-sub UniqIt
-{
-    my $manifest = shift;
-
-    return if (scalar(@_) == 0); # no entries, don't bother
-
-    my %lines = map { $_ => 1 } @_;
-
-    my $lockfile = "$manifest.lck";
-    print "+++ updating chrome $manifest\n" unless $quiet;
-
-    my $dir = dirname($manifest);
-    mkpath($dir, 0, 0755);
-
-    mozLock($lockfile) if (!$nofilelocks);
-    if (-f $manifest) {
-        unless (open(FILE, "<$manifest")) {
-            mozUnlock($lockfile) if (!$nofilelocks);
-            die "error: can't open $manifest: $!";
-        };
-
-        # Read through the file: if the lines already exist, no need to write
-        # them again.
-        while (defined($_ = <FILE>)) {
-            chomp;
-            delete $lines{$_};
-        }
-        close(FILE);
-    }
-
-    unless (open(FILE, ">>$manifest")) {
-        mozUnlock($lockfile) if (!$nofilelocks);
-        die "error: can't open $manifest: $!";
-    };
-
-    print FILE map("$_\n", keys(%lines));
-    close(FILE) or my $err = 1;
-    mozUnlock($lockfile) if (!$nofilelocks);
-
-    if ($err) {
-        die "error: can't close $manifest: $!";
-    }
-}
-
-sub RegIt
-{
-    my ($chromeDir, $jarFileName, $chromeType, $pkgName) = @_;\
-    chop($pkgName) if ($pkgName =~ m/\/$/);
-    #print "RegIt:  $chromeDir, $jarFileName, $chromeType, $pkgName\n";
-
-    my $line;
-    if ($fileformat eq "flat" || $fileformat eq "symlink") {
-        $line = "$chromeType,install,url,resource:/chrome/$jarFileName/$chromeType/$pkgName/";
-    } else {
-        $line = "$chromeType,install,url,jar:resource:/chrome/$jarFileName.jar!/$chromeType/$pkgName/";
-    }
-    my $installedChromeFile = "$jarDir/installed-chrome.txt";
-    UniqIt($installedChromeFile, $line);
-}
-
-sub EnsureFileInDir
-{
-    my ($destPath, $srcPath, $destFile, $srcFile, $override, $preproc) = @_;
-    my $objPath;
-
-    #print "EnsureFileInDir($destPath, $srcPath, $destFile, $srcFile, $override)\n";
-
-    my $src = $srcFile;
-    if (defined($src)) {
-        if ($src =~ m|^/|) {
-            # "absolute" patch from topSrcDir
-            defined($topSrcDir) || die("Command-line option -t <topsrcdir> missing.");
-            $src = $topSrcDir.$srcFile;
-        } elsif ($srcFile =~ s|^\%|/|) {
-            defined($localeDir) || die("Command-line option -c <localedir> missing.");
-            $src = $localeDir.$srcFile;
-        } elsif (! -e $src ) {
-            $src = "$srcPath/$srcFile";
-        }
-    }
-    else {
-        $src = "$srcPath/$destFile";
-        # check for the complete jar path in the dest dir
-        if (!-e $src) {
-            #else check for just the file name in the dest dir
-            my $dir = "";
-            my $file;
-            if ($destFile =~ /([\w\d.\-\_\\\/\+]+)[\\\/]([\w\d.\-\_]+)/) {
-                $dir = $1;
-                $file = $2;
-            }
-            else {
-                die "file not found: $srcPath/$destFile";
-            }
-            $src = "$srcPath/$file";
-            if (!-e $src) {
-                die "file not found: $srcPath/$destFile";
-            }
-        }
-    }
-
-    $srcPath = $src;
-    $destPath = "$destPath/$destFile";
-
-    my $srcStat = stat($srcPath);
-    my $srcMtime = $srcStat ? $srcStat->mtime : 0;
-
-    my $destStat = stat($destPath);
-    my $destMtime = $destStat ? $destStat->mtime : 0;
-    #print "destMtime = $destMtime, srcMtime = $srcMtime\n";
-
-    if (!-e $destPath || $destMtime < $srcMtime || $override) {
-        #print "copying $destPath, from $srcPath\n";
-        my $dir = "";
-        my $file;
-        if ($destPath =~ /(.+)[\\\/]([\w\d.\-\_]+)/) {
-            $dir = $1;
-            $file = $2;
-        }
-        else {
-            $file = $destPath;
-        }
-
-        if ($srcPath) {
-            $file = $srcPath;
-        }
-        $objPath = "$objdir/$destFile";
-
-        if (!-e $file) {
-            if (!-e $objPath) {
-                die "error: file '$file' doesn't exist";
-            } else {
-                $file = "$objPath";
-            }
-        }
-        if (!-e $dir) {
-            mkpath($dir, 0, 0775) || die "can't mkpath $dir: $!";
-        }
-        unlink $destPath;       # in case we had a symlink on unix
-        if ($preproc) {
-            my $preproc_flags = '';
-            if ($srcPath =~ /\.css$/o) {
-                $preproc_flags = '--marker=%';
-            }
-
-            my $preproc_file = $file;
-            if ($^O eq 'cygwin' && $file =~ /^[a-zA-Z]:/) {
-                # convert to a cygwin path
-                $preproc_file =~ s|^([a-zA-Z]):|$cygwin_mountprefix/\1|;
-            }
-            if ($vms) {
-                # use a temporary file otherwise cmd is too long for system()
-                my $tmpFile = "$destPath.tmp";
-                open(TMP, ">$tmpFile") || die("$tmpFile: $!");
-                print(TMP "$^X $preprocessor $preproc_flags $defines $preproc_file > $destPath");
-                close(TMP);
-                print "+++ preprocessing $preproc_file > $destPath\n" unless $quiet;
-                if (system("bash \"$tmpFile\"") != 0) {
-                    die "Preprocessing of $file failed (VMS): ".($? >> 8);
-                }
-                unlink("$tmpFile") || die("$tmpFile: $!");
-            } else {
-                if (system("$^X $preprocessor $preproc_flags $defines $preproc_file > $destPath") != 0) {
-                    die "Preprocessing of $file failed: ".($? >> 8);
-                }
-            }
-        } elsif ("$fileformat" eq "symlink") {
-            $file = _moz_abs2rel($file, $destPath);
-            symlink($file, $destPath) || die "symlink($file, $destPath) failed: $!";
-            return 1;
-        } else {
-            copy($file, $destPath) || die "copy($file, $destPath) failed: $!";
-        }
-
-        # fix the mod date so we don't jar everything (is this faster than just jarring everything?)
-        my $mtime = stat($file)->mtime || die $!;
-        my $atime = stat($file)->atime;
-        $atime = $mtime if !defined($atime);
-        utime($atime, $mtime, $destPath);
-
-        return 1;
-    }
-    return 0;
-}
-
-my @gLines = <STDIN>;
-
-while (defined($_ = shift @gLines)) {
-    chomp;
-
-start: 
-    if (/^([\w\d.\-\_\\\/]+).jar\:\s*$/) {
-        my $jarfile = $1;
-        my $args = "";
-        my $overrides = "";
-        my $cwd = cwd();
-        my @manifestLines;
-
-        print "+++ making chrome $cwd  => $jarDir/$jarfile.jar\n" unless $quiet;
-        while (defined($_ = shift @gLines)) {
-            if (/^\s+([\w\d.\-\_\\\/\+]+)\s*(\(\%?[\w\d.\-\_\\\/]+\))?$\s*/) {
-                my $dest = $1;
-                my $srcPath = defined($2) ? substr($2, 1, -1) : $2;
-                EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 0, 0);
-                $args = "$args$dest ";
-                if (!foreignPlatformFile($jarfile) && !foreignPlatformPath($dest) && $autoreg &&
-                    $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
-                {
-                    my $chrome_type = $1;
-                    my $pkg_name = $2;
-                    RegIt($chromeDir, $jarfile, $chrome_type, $pkg_name);
-                }
-            } elsif (/^\+\s+([\w\d.\-\_\\\/\+]+)\s*(\(\%?[\w\d.\-\_\\\/]+\))?$\s*/) {
-                my $dest = $1;
-                my $srcPath = defined($2) ? substr($2, 1, -1) : $2;
-                EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 1, 0);
-                $overrides = "$overrides$dest ";
-                if (!foreignPlatformFile($jarfile) && !foreignPlatformPath($dest) && $autoreg &&
-                    $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
-                {
-                    my $chrome_type = $1;
-                    my $pkg_name = $2;
-                    RegIt($chromeDir, $jarfile, $chrome_type, $pkg_name);
-                }
-            } elsif (/^\*\+?\s+([\w\d.\-\_\\\/\+]+)\s*(\(\%?[\w\d.\-\_\\\/]+\))?$\s*/) {
-                # preprocessed (always override)
-                my $dest = $1;
-                my $srcPath = defined($2) ? substr($2, 1, -1) : $2;
-                EnsureFileInDir("$chromeDir/$jarfile", $baseFilesDir, $dest, $srcPath, 1, 1);
-                $overrides = "$overrides$dest ";
-                if (!foreignPlatformFile($jarfile) && !foreignPlatformPath($dest) && $autoreg &&
-                    $dest =~ /([\w\d.\-\_\+]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
-                {
-                    my $chrome_type = $1;
-                    my $pkg_name = $2;
-                    RegIt($chromeDir, $jarfile, $chrome_type, $pkg_name);
-                }
-            } elsif (/^\%\s+(.*)$/) {
-                my $path = $1;
-
-                my $jarpath = $jarfile;
-                $jarpath = "chrome/".$jarfile if $useExtensionManifest;
-
-                if ($fileformat eq "flat" || $fileformat eq "symlink") {
-                    $path =~ s|\%|$jarpath/$1|;
-                } else {
-                    $path =~ s|\%|jar:$jarpath.jar!/$1|;
-                }
-
-                push @manifestLines, $path;
-            } elsif (/^\s*$/) {
-                # end with blank line
-                last;
-            } else {
-                my $manifest = "$jarDir/$jarfile.manifest";
-                my $manifest = "$jarDir/../chrome.manifest" if $useExtensionManifest;
-                UniqIt($manifest, @manifestLines);
-                JarIt($chromeDir, $jarDir, $jarfile, $args, $overrides);
-                goto start;
-            }
-        }
-        my $manifest = "$jarDir/$jarfile.manifest";
-        $manifest = "$jarDir/../chrome.manifest" if $useExtensionManifest;
-        UniqIt($manifest, @manifestLines);
-        JarIt($chromeDir, $jarDir, $jarfile, $args, $overrides);
-
-    } elsif (/^\s*\#.*$/) {
-        # skip comments
-    } elsif (/^\s*$/) {
-        # skip blank lines
-    } else {
-        close;
-        die "bad jar rule head at: $_";
-    }
-}
--- a/config/milestone.txt
+++ b/config/milestone.txt
@@ -5,9 +5,9 @@
 #    x.x.x.x
 #    x.x.x+
 #
 # Referenced by milestone.pl.
 # Hopefully I'll be able to automate replacement of *all*
 # hardcoded milestones in the tree from these two files.
 #--------------------------------------------------------
 
-2.0b13pre
+2.2a1pre
old mode 100755
new mode 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -78,22 +78,16 @@ endif
 # ELOG prints out failed command when building silently (gmake -s).
 ifneq (,$(findstring s, $(filter-out --%, $(MAKEFLAGS))))
   ELOG := $(EXEC) sh $(BUILD_TOOLS)/print-failed-commands.sh
 else
   ELOG :=
 endif
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
-ifndef GNU_CC
-_LIBNAME_RELATIVE_PATHS=1
-endif
-endif
-
-ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
 _VPATH_SRCS = $(abspath $<)
 else
 _VPATH_SRCS = $<
 endif
 
 # Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
 VPATH += $(DIST)/lib
 ifdef LIBXUL_SDK
@@ -106,40 +100,19 @@ endif
 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
 # expands to dir/foo.lib on platforms with import libs and
 # -Ldir -lfoo otherwise
 
 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
 # expands to $(DIST)/lib/foo.lib on platforms with import libs and
 # -lfoo otherwise
 
-ifdef _LIBNAME_RELATIVE_PATHS
 EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
-else
-EXPAND_LIBNAME = $(addprefix -l,$(1))
-EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1))
-EXPAND_MOZLIBNAME = $(addprefix -l,$(1))
-endif
-
-ifdef MOZ_FAKELIBS
-# If a lib.fake is present, replace it with @lib.fake, otherwise just pass
-# the library name through unchanged.
-EXPAND_FAKELIBS = $(foreach f,$(1),$(if $(wildcard $(f).fake),@$(wildcard $(f).fake),$(f)))
-
-# Also override EXPAND_LIBNAME_PATH and EXPAND_MOZLIBNAME on non-RELATIVE_PATH
-# platforms, so we can shortcut linking -lfoo if we have foo.a.fake
-ifndef _LIBNAME_RELATIVE_PATHS
-EXPAND_LIBNAME_PATH = $(if $(wildcard $(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,-L$(2) $(addprefix -l,$(1)))
-EXPAND_MOZLIBNAME = $(if $(wildcard $(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,$(addprefix -l,$(1)))
-endif
-else
-EXPAND_FAKELIBS = $1
-endif
 
 ifdef EXTRA_DSO_LIBS
 EXTRA_DSO_LIBS	:= $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
 endif
 
 ################################################################################
 # Testing frameworks support
 ################################################################################
@@ -219,17 +192,17 @@ endif # XPCSHELL_TESTS
 ifdef CPP_UNIT_TESTS
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
 CPPSRCS += $(CPP_UNIT_TESTS)
 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 INCLUDES += -I$(DIST)/include/testing
-LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS) -ljs_static
+LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
 
 # ...and run them the usual way
 check::
 	@$(EXIT_ON_ERROR) \
 	  for f in $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS)); do \
 	    XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
 	  done
 
@@ -244,22 +217,23 @@ endif # ENABLE_TESTS
 # Library rules
 #
 # If BUILD_STATIC_LIBS or FORCE_STATIC_LIB is set, build a static library.
 # Otherwise, build a shared library.
 #
 
 ifndef LIBRARY
 ifdef STATIC_LIBRARY_NAME
-LIBRARY			:= $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
-ifdef MOZ_FAKELIBS
-ifndef SUPPRESS_FAKELIB
-FAKE_LIBRARY = $(LIBRARY).fake
-endif # SUPPRESS_FAKELIB
-endif # MOZ_FAKELIBS
+_LIBRARY		:= $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX)
+# Only build actual library if it is installed in DIST/lib or SDK
+ifeq (,$(SDK_LIBRARY)$(DIST_INSTALL)$(NO_EXPAND_LIBS))
+LIBRARY			:= $(_LIBRARY).$(LIBS_DESC_SUFFIX)
+else
+LIBRARY			:= $(_LIBRARY) $(_LIBRARY).$(LIBS_DESC_SUFFIX)
+endif
 endif # STATIC_LIBRARY_NAME
 endif # LIBRARY
 
 ifndef HOST_LIBRARY
 ifdef HOST_LIBRARY_NAME
 HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
 endif
 endif
@@ -556,26 +530,16 @@ TAG_PROGRAM		= xargs etags -a
 ifneq ($(CPPSRCS)$(CMMSRCS),)
 CPP_PROG_LINK		= 1
 endif
 ifneq ($(HOST_CPPSRCS)$(HOST_CMMSRCS),)
 HOST_CPP_PROG_LINK	= 1
 endif
 
 #
-# Make sure to wrap static libs inside linker specific flags to turn on & off
-# inclusion of all symbols inside the static libs
-#
-ifndef NO_LD_ARCHIVE_FLAGS
-ifdef SHARED_LIBRARY_LIBS
-EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS)) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS)
-endif
-endif
-
-#
 # This will strip out symbols that the component should not be 
 # exporting from the .dynsym section.
 #
 ifdef IS_COMPONENT
 EXTRA_DSO_LDOPTS += $(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
 endif # IS_COMPONENT
 
 #
@@ -850,58 +814,56 @@ ifdef MODULE_NAME
 endif
 endif # BUILD_STATIC_LIBS
 else # !IS_COMPONENT
 	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME)
 endif # IS_COMPONENT
 endif # EXPORT_LIBRARY
 endif # LIBRARY_NAME
 
-# Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
-LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(LIBS))
-HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX), $(HOST_LIBS))
-DSO_LDOPTS_DEPS = $(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS))
-
-ifndef _LIBNAME_RELATIVE_PATHS
-
-LIBS_DEPS += $(filter -l%, $(LIBS))
-HOST_LIBS_DEPS += $(filter -l%, $(HOST_LIBS))
-DSO_LDOPTS_DEPS += $(filter -l%, $(EXTRA_DSO_LDOPTS))
+ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
+$(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
+endif
 
-_LIBDIRS = $(patsubst -L%,%,$(filter -L%, $(LIBS) $(HOST_LIBS) $(EXTRA_DSO_LDOPTS)))
-ifneq (,$(_LIBDIRS))
-vpath $(LIB_PREFIX)%.$(LIB_SUFFIX) $(_LIBDIRS)
-ifdef IMPORT_LIB_SUFFIX
-vpath $(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX) $(_LIBDIRS)
-endif # IMPORT_LIB_SUFFIX
-vpath $(DLL_PREFIX)%$(DLL_SUFFIX) $(_LIBDIRS)
-endif # _LIBDIRS
-
-endif # _LIBNAME_RELATIVE_PATHS
+# Create dependencies on static (and shared EXTRA_DSO_LIBS) libraries
+DO_EXPAND_LIBS = $(foreach f,$(1),$(if $(filter %.$(LIB_SUFFIX),$(f)),$(if $(wildcard $(f).$(LIBS_DESC_SUFFIX)),$(f).$(LIBS_DESC_SUFFIX),$(if $(wildcard $(f)),$(f)))))
+LIBS_DEPS = $(call DO_EXPAND_LIBS,$(filter %.$(LIB_SUFFIX),$(LIBS)))
+SHARED_LIBRARY_LIBS_DEPS = $(call DO_EXPAND_LIBS,$(SHARED_LIBRARY_LIBS))
+HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
+DSO_LDOPTS_DEPS = $(call DO_EXPAND_LIBS,$(EXTRA_DSO_LIBS) $(filter %.$(LIB_SUFFIX), $(EXTRA_DSO_LDOPTS)))
 
 # Dependencies which, if modified, should cause everything to rebuild
 GLOBAL_DEPS += Makefile Makefile.in $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
 
 ##############################################
 ifdef PARALLEL_DIRS
 libs:: $(PARALLEL_DIRS_libs)
 
 $(PARALLEL_DIRS_libs): %_libs: %/Makefile
 	+@$(call SUBMAKE,libs,$*)
 endif
 
+ifdef EXPORT_LIBRARY
+ifeq ($(EXPORT_LIBRARY),1)
+ifdef IS_COMPONENT
+EXPORT_LIBRARY = $(DEPTH)/staticlib/components
+else
+EXPORT_LIBRARY = $(DEPTH)/staticlib
+endif
+else
+# If EXPORT_LIBRARY has a value, we'll be installing there. We also need to cleanup there
+GARBAGE += $(foreach lib,$(LIBRARY),$(EXPORT_LIBRARY)/$(lib))
+endif
+endif # EXPORT_LIBRARY
+
 libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
 ifndef NO_DIST_INSTALL
 ifdef LIBRARY
 ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
-ifdef IS_COMPONENT
-	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DEPTH)/staticlib/components
-else
-	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DEPTH)/staticlib
-endif
+	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(EXPORT_LIBRARY)
 endif # EXPORT_LIBRARY
 ifdef DIST_INSTALL
 ifdef IS_COMPONENT
 	$(error Shipping static component libs makes no sense.)
 else
 	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
 endif
 endif # DIST_INSTALL
@@ -909,29 +871,23 @@ endif # LIBRARY
 ifdef SHARED_LIBRARY
 ifdef IS_COMPONENT
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
 endif
-ifdef BEOS_ADDON_WORKAROUND
-	( cd $(FINAL_TARGET)/components && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
-endif
 else # ! IS_COMPONENT
 ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
 	$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
 else
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
 endif
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
-ifdef BEOS_ADDON_WORKAROUND
-	( cd $(FINAL_TARGET) && $(CC) -nostart -o $(SHARED_LIBRARY).stub $(SHARED_LIBRARY) )
-endif
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
 ifdef PROGRAM
 	$(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
 endif
 ifdef SIMPLE_PROGRAMS
 	$(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
 endif
@@ -1017,20 +973,20 @@ alltags:
 
 #
 # PROGRAM = Foo
 # creates OBJS, links with LIBS to create Foo
 #
 $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS)
 	@rm -f $@.manifest
 ifeq (WINCE,$(OS_ARCH))
-	$(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
+	$(EXPAND_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 else
 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-	$(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
+	$(EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 ifdef MSMANIFEST_TOOL
 	@if test -f $@.manifest; then \
 		if test -f "$(srcdir)/$@.manifest"; then \
 			echo "Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
 			mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		else \
 			echo "Embedding manifest from $@.manifest"; \
 			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
@@ -1042,35 +998,29 @@ ifdef MSMANIFEST_TOOL
 endif	# MSVC with manifest tool
 ifdef MOZ_PROFILE_GENERATE
 # touch it a few seconds into the future to work around FAT's
 # 2-second granularity
 	touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
 endif
 else # !WINNT || GNU_CC
 ifeq ($(CPP_PROG_LINK),1)
-	$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(call EXPAND_FAKELIBS,$(WRAP_MALLOC_LIB)) $(EXE_DEF_FILE)
+	$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE)
 else # ! CPP_PROG_LINK
-	$(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(EXE_DEF_FILE)
+	$(EXPAND_CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
 endif # CPP_PROG_LINK
 endif # WINNT && !GNU_CC
 endif # WINCE
 
 ifdef ENABLE_STRIP
 	$(STRIP) $@
 endif
 ifdef MOZ_POST_PROGRAM_COMMAND
 	$(MOZ_POST_PROGRAM_COMMAND) $@
 endif
-ifeq ($(OS_ARCH),BeOS)
-ifdef BEOS_PROGRAM_RESOURCE
-	xres -o $@ $(BEOS_PROGRAM_RESOURCE)
-	mimeset $@
-endif
-endif # BeOS
 
 $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
 ifeq (WINCE,$(OS_ARCH))
 	$(HOST_LD) -NOLOGO -OUT:$@ $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
 ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
 	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 ifdef MSMANIFEST_TOOL
@@ -1101,31 +1051,31 @@ endif
 # in one directory, it assumes everything to compile Foo is in
 # Foo.o (from either Foo.c or Foo.cpp).
 #
 # SIMPLE_PROGRAMS = Foo Bar
 # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
 #
 $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
 ifeq (WINCE,$(OS_ARCH))
-	$(LD) -nologo  -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
+	$(EXPAND_LD) -nologo  -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 else
 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-	$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS))
+	$(EXPAND_LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
 ifdef MSMANIFEST_TOOL
 	@if test -f $@.manifest; then \
 		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
 		rm -f $@.manifest; \
 	fi
 endif	# MSVC with manifest tool
 else
 ifeq ($(CPP_PROG_LINK),1)
-	$(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)) $(BIN_FLAGS)
+	$(EXPAND_CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
 else
-	$(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)) $(BIN_FLAGS)
+	$(EXPAND_CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS)
 endif # CPP_PROG_LINK
 endif # WINNT && !GNU_CC
 endif # WINCE
 
 ifdef ENABLE_STRIP
 	$(STRIP) $@
 endif
 ifdef MOZ_POST_PROGRAM_COMMAND
@@ -1167,83 +1117,27 @@ ifeq ($(CPP_PROG_LINK),1)
 	$(QUANTIFY) $(CCC) -o $^.quantify $(CXXFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
 else
 	$(QUANTIFY) $(CC) -o $^.quantify $(CFLAGS) $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS)
 endif
 ifndef NO_DIST_INSTALL
 	$(INSTALL) $(IFLAGS2) $^.quantify $(FINAL_TARGET)
 endif
 
-#
-# This allows us to create static versions of the shared libraries
-# that are built using other static libraries.  Confused...?
-#
-ifdef SHARED_LIBRARY_LIBS
-ifeq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
-ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB))
-LOBJS	+= $(SHARED_LIBRARY_LIBS)
-endif
-else
-NONFAKE_SHARED_LIBRARY_LIBS = $(filter-out %.fake,$(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS)))
-ifeq (,$(NONFAKE_SHARED_LIBRARY_LIBS))
-# All of our SHARED_LIBRARY_LIBS have fake equivalents. Score!
-# Just pass the original object files around.
-# For shared libraries, these are already included in EXTRA_DSO_LDOPTS
-# above.
-ifndef SHARED_LIBRARY
-LOBJS += $(shell cat $(addsuffix .fake,$(SHARED_LIBRARY_LIBS)))
-endif
-SKIP_SUB_LOBJS := 1
-else
-ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH)))
-CLEANUP1	:= | egrep -v '(________64ELEL_|__.SYMDEF)'
-CLEANUP2	:= rm -f ________64ELEL_ __.SYMDEF
-else
-CLEANUP2	:= true
-endif
-SUB_LOBJS	= $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
-endif # EXPAND_FAKELIBS
-endif # SHARED_LIBRARY_LIBS
-endif
-ifdef MOZILLA_PROBE_LIBS
-PROBE_LOBJS	= $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
-endif
 ifdef DTRACE_PROBE_OBJ
 EXTRA_DEPS += $(DTRACE_PROBE_OBJ)
 endif
 
-$(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
-	rm -f $@
-ifndef SKIP_SUB_LOBJS
-ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
-ifdef SHARED_LIBRARY_LIBS
-	@rm -f $(SUB_LOBJS)
-	@for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
-endif
-endif
-endif # SKIP_SUB_LOBJS
-	$(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
+$(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+	rm -f $(LIBRARY)
+	$(EXPAND_AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS)
 	$(RANLIB) $@
-ifndef MOZ_FAKELIBS
-# Don't clean these up if we're building a fake lib, because then
-# we'll reference nonexistent object files in our fake lib.
-	@rm -f foodummyfilefoo $(SUB_LOBJS)
-endif
-# Also produce a .fake file that just contains the names of the object files.
-# This can be used as a response file to the linker later instead of
-# linking the actual static library.
-ifdef MOZ_FAKELIBS
-ifndef SUPPRESS_FAKELIB
-ifeq (WINNT_,$(HOST_OS_ARCH)_$(.PYMAKE))
-	echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(subst \,\\,$(call core_winabspath,$(f))))) " > $@.fake
-else
-	echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(call core_abspath,$(f)))) " > $@.fake
-endif
-endif
-endif
+
+$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)): $(filter %.$(LIB_SUFFIX),$(LIBRARY)) $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+	$(EXPAND_LIBS_GEN) $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) > $@
 
 ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH)))
 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
 endif
 
 ifeq ($(OS_ARCH),OS2)
 $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
 	rm -f $@
@@ -1261,37 +1155,33 @@ ifeq ($(OS_ARCH),OS2)
 	$(RANLIB) $@
 endif # OS/2
 
 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
 	rm -f $@
 	$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
 	$(HOST_RANLIB) $@
 
-ifdef NO_LD_ARCHIVE_FLAGS
-SUB_SHLOBJS = $(SUB_LOBJS)
-endif
-
 ifdef HAVE_DTRACE
 ifndef XP_MACOSX
 ifdef DTRACE_PROBE_OBJ
 ifndef DTRACE_LIB_DEPENDENT
 $(DTRACE_PROBE_OBJ): $(OBJS)
 	dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o $(DTRACE_PROBE_OBJ) $(OBJS)
 endif
 endif
 endif
 endif
 
 # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
 # so instead of deleting .o files after repacking them into a dylib, we make
 # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
 # so no need to conditionalize on OS version or debugging format.
 
-$(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS) $(LIBRARY) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
+$(SHARED_LIBRARY): $(OBJS) $(LOBJS) $(DEF_FILE) $(RESFILE) $(SHARED_LIBRARY_LIBS_DEPS) $(LIBRARY) $(EXTRA_DEPS) $(DSO_LDOPTS_DEPS) $(GLOBAL_DEPS)
 ifndef INCREMENTAL_LINKER
 	rm -f $@
 endif
 ifeq ($(OS_ARCH),OpenVMS)
 	@if test ! -f $(VMS_SYMVEC_FILE); then \
 	  if test -f $(VMS_SYMVEC_FILE_MODULE); then \
 	    echo Creating specific component options file $(VMS_SYMVEC_FILE); \
 	    cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
@@ -1299,73 +1189,39 @@ ifeq ($(OS_ARCH),OpenVMS)
 	fi
 ifdef IS_COMPONENT
 	@if test ! -f $(VMS_SYMVEC_FILE); then \
 	  echo Creating generic component options file $(VMS_SYMVEC_FILE); \
 	  cp $(VMS_SYMVEC_FILE_COMP) $(VMS_SYMVEC_FILE); \
 	fi
 endif
 endif # OpenVMS
-ifdef NO_LD_ARCHIVE_FLAGS
-ifdef SHARED_LIBRARY_LIBS
-	@rm -f $(SUB_SHLOBJS)
-	@for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
-ifeq ($(OS_ARCH),Darwin)
-	@echo Making symlinks to the original object files in the archive libraries $(SHARED_LIBRARY_LIBS)
-	@for lib in $(SHARED_LIBRARY_LIBS); do \
-		libdir=`echo $$lib|sed -e 's,/[^/]*\.a,,'`; \
-		ofiles=`$(AR_LIST) $${lib}`; \
-		for ofile in $$ofiles; do \
-			if [ -f $$libdir/$$ofile ]; then \
-				rm -f $$ofile; \
-				ln -s $$libdir/$$ofile $$ofile; \
-			fi; \
-		done; \
-	done
+ifdef DTRACE_LIB_DEPENDENT
+ifndef XP_MACOSX
+	dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o  $(DTRACE_PROBE_OBJ) $(shell $(EXPAND_LIBS) $(MOZILLA_PROBE_LIBS))
 endif
-endif # SHARED_LIBRARY_LIBS
-endif # NO_LD_ARCHIVE_FLAGS
-ifdef DTRACE_LIB_DEPENDENT
-	@rm -f $(PROBE_LOBJS)
-	@for lib in $(MOZILLA_PROBE_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done
-ifndef XP_MACOSX
-	dtrace -G -C -s $(MOZILLA_DTRACE_SRC) -o  $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS)
-endif
-	@for lib in $(MOZILLA_PROBE_LIBS); do \
-		ofiles=`$(AR_LIST) $${lib}`; \
-		$(AR_DELETE) $${lib} $$ofiles; \
-	done
-	$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE)
-	@rm -f $(PROBE_LOBJS)
+	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(MOZILLA_PROBE_LIBS) $(RESFILE) $(LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
 	@rm -f $(DTRACE_PROBE_OBJ)
-	@for lib in $(MOZILLA_PROBE_LIBS); do \
-		if [ -L $${lib} ]; then rm -f `readlink $${lib}`; fi; \
-	done
-	@rm -f $(MOZILLA_PROBE_LIBS)
-
 else # ! DTRACE_LIB_DEPENDENT
-	$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE)
+	$(EXPAND_MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
 endif # DTRACE_LIB_DEPENDENT
 
 ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
 ifdef MSMANIFEST_TOOL
 ifdef EMBED_MANIFEST_AT
 	@if test -f $@.manifest; then \
 		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
 		rm -f $@.manifest; \
 	fi
 endif   # EMBED_MANIFEST_AT
 endif	# MSVC with manifest tool
 ifdef MOZ_PROFILE_GENERATE
 	touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
 endif
 endif	# WINNT && !GCC
-ifneq ($(OS_ARCH),Darwin)
-	@rm -f $(SUB_SHLOBJS)
-endif # Darwin
 	@rm -f foodummyfilefoo $(DELETE_AFTER_LINK)
 	chmod +x $@
 ifdef ENABLE_STRIP
 	$(STRIP) $@
 endif
 ifdef MOZ_POST_DSO_LIB_COMMAND
 	$(MOZ_POST_DSO_LIB_COMMAND) $@
 endif
@@ -1551,32 +1407,27 @@ ifneq (,$(filter OS2 WINNT WINCE,$(OS_AR
 SEP := ;
 else
 SEP := :
 endif
 
 EMPTY :=
 SPACE := $(EMPTY) $(EMPTY)
 
-# Cygwin and MSYS have their own special path form, but javac expects the source
-# and class paths to be in the DOS form (i.e. e:/builds/...).  This function
-# does the appropriate conversion on Windows, but is a noop on other systems.
+# MSYS has its own special path form, but javac expects the source and class
+# paths to be in the DOS form (i.e. e:/builds/...).  This function does the
+# appropriate conversion on Windows, but is a noop on other systems.
 ifeq (,$(filter-out WINNT WINCE, $(HOST_OS_ARCH)))
-ifdef CYGWIN_WRAPPER
-normalizepath = $(foreach p,$(1),$(shell cygpath -m $(p)))
-else
-# assume MSYS
 #  We use 'pwd -W' to get DOS form of the path.  However, since the given path
 #  could be a file or a non-existent path, we cannot call 'pwd -W' directly
 #  on the path.  Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
 #  on it, then merge with the rest of the path.
 root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
 non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
 normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
-endif
 else
 normalizepath = $(1)
 endif
 
 _srcdir = $(call normalizepath,$(srcdir))
 ifdef JAVA_SOURCEPATH
 SP = $(subst $(SPACE),$(SEP),$(call normalizepath,$(strip $(JAVA_SOURCEPATH))))
 _JAVA_SOURCEPATH = ".$(SEP)$(_srcdir)$(SEP)$(SP)"
@@ -1591,43 +1442,37 @@ else
 _JAVA_CLASSPATH = .
 endif
 
 _JAVA_DIR = _java
 $(_JAVA_DIR)::
 	$(NSINSTALL) -D $@
 
 $(_JAVA_DIR)/%.class: %.java $(GLOBAL_DEPS) $(_JAVA_DIR)
-	$(CYGWIN_WRAPPER) $(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
+	$(JAVAC) $(JAVAC_FLAGS) -classpath $(_JAVA_CLASSPATH) \
 			-sourcepath $(_JAVA_SOURCEPATH) -d $(_JAVA_DIR) $(_VPATH_SRCS)
 
 $(JAVA_LIBRARY): $(addprefix $(_JAVA_DIR)/,$(JAVA_SRCS:.java=.class)) $(GLOBAL_DEPS)
 	$(JAR) cf $@ -C $(_JAVA_DIR) .
 
 GARBAGE_DIRS += $(_JAVA_DIR)
 
 ###############################################################################
 # Update Makefiles
 ###############################################################################
 
-# In GNU make 3.80, makefiles must use the /cygdrive syntax, even if we're
-# processing them with AS perl. See bug 232003
-ifdef AS_PERL
-CYGWIN_TOPSRCDIR = -nowrap -p $(topsrcdir) -wrap
-endif
-
 # Note: Passing depth to make-makefile is optional.
 #       It saves the script some work, though.
 Makefile: Makefile.in
-	@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR)
+	@$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH)
 
 ifdef SUBMAKEFILES
 # VPATH does not work on some machines in this case, so add $(srcdir)
 $(SUBMAKEFILES): % : $(srcdir)/%.in
-	$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $@
+	$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $@
 endif
 
 ifdef AUTOUPDATE_CONFIGURE
 $(topsrcdir)/configure: $(topsrcdir)/configure.in
 	(cd $(topsrcdir) && $(AUTOCONF)) && (cd $(DEPTH) && ./config.status --recheck)
 endif
 
 ###############################################################################
--- a/config/tests/unit-JarMaker.py
+++ b/config/tests/unit-JarMaker.py
@@ -5,16 +5,112 @@ from filecmp import dircmp
 from tempfile import mkdtemp
 from shutil import rmtree, copy2
 from zipfile import ZipFile
 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
 from mozunit import MozTestRunner
 from JarMaker import JarMaker
 
+if sys.platform == "win32":
+    import ctypes
+    from ctypes import POINTER, WinError
+    DWORD = ctypes.c_ulong
+    LPDWORD = POINTER(DWORD)
+    HANDLE = ctypes.c_void_p
+    GENERIC_READ = 0x80000000
+    FILE_SHARE_READ = 0x00000001
+    OPEN_EXISTING = 3
+    MAX_PATH = 260
+
+    class FILETIME(ctypes.Structure):
+        _fields_ = [("dwLowDateTime", DWORD),
+                    ("dwHighDateTime", DWORD)]
+
+    class BY_HANDLE_FILE_INFORMATION(ctypes.Structure):
+        _fields_ = [("dwFileAttributes", DWORD),
+                    ("ftCreationTime", FILETIME),
+                    ("ftLastAccessTime", FILETIME),
+                    ("ftLastWriteTime", FILETIME),
+                    ("dwVolumeSerialNumber", DWORD),
+                    ("nFileSizeHigh", DWORD),
+                    ("nFileSizeLow", DWORD),
+                    ("nNumberOfLinks", DWORD),
+                    ("nFileIndexHigh", DWORD),
+                    ("nFileIndexLow", DWORD)]
+
+    # http://msdn.microsoft.com/en-us/library/aa363858
+    CreateFile = ctypes.windll.kernel32.CreateFileA
+    CreateFile.argtypes = [ctypes.c_char_p, DWORD, DWORD, ctypes.c_void_p,
+                           DWORD, DWORD, HANDLE]
+    CreateFile.restype = HANDLE
+
+    # http://msdn.microsoft.com/en-us/library/aa364952
+    GetFileInformationByHandle = ctypes.windll.kernel32.GetFileInformationByHandle
+    GetFileInformationByHandle.argtypes = [HANDLE, POINTER(BY_HANDLE_FILE_INFORMATION)]
+    GetFileInformationByHandle.restype = ctypes.c_int
+
+    # http://msdn.microsoft.com/en-us/library/aa364996
+    GetVolumePathName = ctypes.windll.kernel32.GetVolumePathNameA
+    GetVolumePathName.argtypes = [ctypes.c_char_p, ctypes.c_char_p, DWORD]
+    GetVolumePathName.restype = ctypes.c_int
+
+    # http://msdn.microsoft.com/en-us/library/aa364993
+    GetVolumeInformation = ctypes.windll.kernel32.GetVolumeInformationA
+    GetVolumeInformation.argtypes = [ctypes.c_char_p, ctypes.c_char_p, DWORD,
+                                     LPDWORD, LPDWORD, LPDWORD, ctypes.c_char_p,
+                                     DWORD]
+    GetVolumeInformation.restype = ctypes.c_int
+
+def symlinks_supported(path):
+    if sys.platform == "win32":
+        # Add 1 for a trailing backslash if necessary, and 1 for the terminating
+        # null character.
+        volpath = ctypes.create_string_buffer(len(path) + 2)
+        rv = GetVolumePathName(path, volpath, len(volpath))
+        if rv == 0:
+            raise WinError()
+
+        fsname = ctypes.create_string_buffer(MAX_PATH + 1)
+        rv = GetVolumeInformation(volpath, None, 0, None, None, None, fsname,
+                                  len(fsname))
+        if rv == 0:
+            raise WinError()
+
+        # Return true only if the fsname is NTFS
+        return fsname.value == "NTFS"
+    else:
+        return True
+
+def _getfileinfo(path):
+    """Return information for the given file. This only works on Windows."""
+    fh = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, None, OPEN_EXISTING, 0, None)
+    if fh is None:
+        raise WinError()
+    info = BY_HANDLE_FILE_INFORMATION()
+    rv = GetFileInformationByHandle(fh, info)
+    if rv == 0:
+        raise WinError()
+    return info
+
+def is_symlink_to(dest, src):
+    if sys.platform == "win32":
+        # Check if both are on the same volume and have the same file ID
+        destinfo = _getfileinfo(dest)
+        srcinfo = _getfileinfo(src)
+        return (destinfo.dwVolumeSerialNumber == srcinfo.dwVolumeSerialNumber and
+                destinfo.nFileIndexHigh == srcinfo.nFileIndexHigh and
+                destinfo.nFileIndexLow == srcinfo.nFileIndexLow)
+    else:
+        # Read the link and check if it is correct
+        if not os.path.islink(dest):
+            return False
+        target = os.path.abspath(os.readlink(dest))
+        abssrc = os.path.abspath(src)
+        return target == abssrc
 
 class _TreeDiff(dircmp):
     """Helper to report rich results on difference between two directories.
     """
     def _fillDiff(self, dc, rv, basepath="%s"):
         rv['right_only'] += map(lambda l: basepath % l, dc.right_only)
         rv['left_only'] += map(lambda l: basepath % l, dc.left_only)
         rv['diff_files'] += map(lambda l: basepath % l, dc.diff_files)
@@ -98,35 +194,57 @@ class TestJarMaker(unittest.TestCase):
                         copy2(os.path.join(path, file), stagedir)
             # compare both dirs
             os.chdir('..')
             td = _TreeDiff('ref', 'stage')
             return td.allResults('reference', 'build')
         finally:
             os.chdir(cwd)
 
-    def test_a_simple_jar(self):
-        '''Test a simple jar.mn'''
+    def _create_simple_setup(self):
         # create src content
         jarf = open(os.path.join(self.srcdir, 'jar.mn'), 'w')
         jarf.write('''test.jar:
  dir/foo (bar)
 ''')
         jarf.close()
         open(os.path.join(self.srcdir,'bar'),'w').write('content\n')
         # create reference
-        refpath  = os.path.join(self.refdir, 'chrome', 'test.jar', 'dir')
+        refpath = os.path.join(self.refdir, 'chrome', 'test.jar', 'dir')
         os.makedirs(refpath)
-        open(os.path.join(refpath, 'foo'), 'w').write('content\n')
+        open(os.path.join(refpath, 'foo'), 'w').write('content\n')        
+
+    def test_a_simple_jar(self):
+        '''Test a simple jar.mn'''
+        self._create_simple_setup()
         # call JarMaker
         rv = self._jar_and_compare((os.path.join(self.srcdir,'jar.mn'),),
                                    tuple(),
                                    sourcedirs = [self.srcdir])
         self.assertTrue(not rv, rv)
 
+    def test_a_simple_symlink(self):
+        '''Test a simple jar.mn with a symlink'''
+        if not symlinks_supported(self.srcdir):
+            return
+
+        self._create_simple_setup()
+        jm = JarMaker(outputFormat='symlink')
+        kwargs = {
+            'sourcedirs': [self.srcdir],
+            'topsourcedir': self.srcdir,
+            'jardir': os.path.join(self.builddir, 'chrome'),
+        }
+        jm.makeJars((os.path.join(self.srcdir,'jar.mn'),), tuple(), **kwargs)
+        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
+        srcbar = os.path.join(self.srcdir, 'bar')
+        destfoo = os.path.join(self.builddir, 'chrome', 'test', 'dir', 'foo')
+        self.assertTrue(is_symlink_to(destfoo, srcbar),
+                        "%s is not a symlink to %s" % (destfoo, srcbar))
+
     def test_k_multi_relative_jar(self):
         '''Test the API for multiple l10n jars, with different relative paths'''
         # create app src content
         def _mangle(relpath):
             'method we use to map relpath to srcpaths'
             return os.path.join(self.srcdir, 'other-' + relpath)
         jars = []
         for relpath in ('foo', 'bar'):
new file mode 100644
--- /dev/null
+++ b/config/tests/unit-expandlibs.py
@@ -0,0 +1,247 @@
+from __future__ import with_statement
+import subprocess
+import unittest
+import sys
+import os
+import imp
+from tempfile import mkdtemp
+from shutil import rmtree
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from UserString import UserString
+# Create a controlled configuration for use by expandlibs
+config_win = {
+    'AR_EXTRACT': '',
+    'DLL_PREFIX': '',
+    'LIB_PREFIX': '',
+    'OBJ_SUFFIX': '.obj',
+    'LIB_SUFFIX': '.lib',
+    'DLL_SUFFIX': '.dll',
+    'IMPORT_LIB_SUFFIX': '.lib',
+    'LIBS_DESC_SUFFIX': '.desc',
+    'EXPAND_LIBS_LIST_STYLE': 'list',
+}
+config_unix = {
+    'AR_EXTRACT': 'ar -x',
+    'DLL_PREFIX': 'lib',
+    'LIB_PREFIX': 'lib',
+    'OBJ_SUFFIX': '.o',
+    'LIB_SUFFIX': '.a',
+    'DLL_SUFFIX': '.so',
+    'IMPORT_LIB_SUFFIX': '',
+    'LIBS_DESC_SUFFIX': '.desc',
+    'EXPAND_LIBS_LIST_STYLE': 'linkerscript',
+}
+
+config = sys.modules['expandlibs_config'] = imp.new_module('expandlibs_config')
+
+from expandlibs import LibDescriptor, ExpandArgs
+from expandlibs_gen import generate
+from expandlibs_exec import ExpandArgsMore
+
+def Lib(name):
+    return config.LIB_PREFIX + name + config.LIB_SUFFIX
+
+def Obj(name):
+    return name + config.OBJ_SUFFIX
+
+def Dll(name):
+    return config.DLL_PREFIX + name + config.DLL_SUFFIX
+
+def ImportLib(name):
+    if not len(config.IMPORT_LIB_SUFFIX): return Dll(name)
+    return config.LIB_PREFIX + name + config.IMPORT_LIB_SUFFIX
+
+class TestLibDescriptor(unittest.TestCase):
+    def test_serialize(self):
+        '''Test LibDescriptor's serialization'''
+        desc = LibDescriptor()
+        desc[LibDescriptor.KEYS[0]] = ['a', 'b']
+        self.assertEqual(str(desc), "%s = a b" % LibDescriptor.KEYS[0])
+        desc['unsupported-key'] = ['a']
+        self.assertEqual(str(desc), "%s = a b" % LibDescriptor.KEYS[0])
+        desc[LibDescriptor.KEYS[1]] = ['c', 'd', 'e']
+        self.assertEqual(str(desc), "%s = a b\n%s = c d e" % (LibDescriptor.KEYS[0], LibDescriptor.KEYS[1]))
+        desc[LibDescriptor.KEYS[0]] = []
+        self.assertEqual(str(desc), "%s = c d e" % (LibDescriptor.KEYS[1]))
+
+    def test_read(self):
+        '''Test LibDescriptor's initialization'''
+        desc_list = ["# Comment",
+                     "%s = a b" % LibDescriptor.KEYS[1],
+                     "", # Empty line
+                     "foo = bar", # Should be discarded
+                     "%s = c d e" % LibDescriptor.KEYS[0]]
+        desc = LibDescriptor(desc_list)
+        self.assertEqual(desc[LibDescriptor.KEYS[1]], ['a', 'b'])
+        self.assertEqual(desc[LibDescriptor.KEYS[0]], ['c', 'd', 'e'])
+        self.assertEqual(False, 'foo' in desc)
+
+def wrap_method(conf, wrapped_method):
+    '''Wrapper used to call a test with a specific configuration'''
+    def _method(self):
+        for key in conf:
+            setattr(config, key, conf[key])
+        self.init()
+        wrapped_method(self)
+        self.cleanup()
+    return _method
+
+class ReplicateTests(type):
+    '''Replicates tests for unix and windows variants'''
+    def __new__(cls, clsName, bases, dict):
+        for name in [key for key in dict if key.startswith('test_')]:
+            dict[name + '_unix'] = wrap_method(config_unix, dict[name])
+            dict[name + '_unix'].__doc__ = dict[name].__doc__ + ' (unix)'
+            dict[name + '_win'] = wrap_method(config_win, dict[name])
+            dict[name + '_win'].__doc__ = dict[name].__doc__ + ' (win)'
+            del dict[name]
+        return type.__new__(cls, clsName, bases, dict)
+
+class TestCaseWithTmpDir(unittest.TestCase):
+    __metaclass__ = ReplicateTests
+    def init(self):
+        self.tmpdir = mkdtemp()
+
+    def cleanup(self):
+        rmtree(self.tmpdir)
+
+    def touch(self, files):
+        for f in files:
+            open(f, 'w').close()
+
+    def tmpfile(self, *args):
+        return os.path.join(self.tmpdir, *args)
+
+class TestExpandLibsGen(TestCaseWithTmpDir):
+    def test_generate(self):
+        '''Test library descriptor generation'''
+        files = [self.tmpfile(f) for f in
+                 [Lib('a'), Obj('b'), Lib('c'), Obj('d'), Obj('e'), Lib('f')]]
+        self.touch(files[:-1])
+        self.touch([files[-1] + config.LIBS_DESC_SUFFIX])
+
+        desc = generate(files)
+        self.assertEqual(desc['OBJS'], [self.tmpfile(Obj(s)) for s in ['b', 'd', 'e']])
+        self.assertEqual(desc['LIBS'], [self.tmpfile(Lib(s)) for s in ['a', 'c', 'f']])
+
+class TestExpandInit(TestCaseWithTmpDir):
+    def init(self):
+        ''' Initializes test environment for library expansion tests'''
+        super(TestExpandInit, self).init()
+        # Create 2 fake libraries, each containing 3 objects, and the second
+        # including the first one and another library.
+        os.mkdir(self.tmpfile('libx'))
+        os.mkdir(self.tmpfile('liby'))
+        self.libx_files = [self.tmpfile('libx', Obj(f)) for f in ['g', 'h', 'i']]
+        self.liby_files = [self.tmpfile('liby', Obj(f)) for f in ['j', 'k', 'l']] + [self.tmpfile('liby', Lib('z'))]
+        self.touch(self.libx_files + self.liby_files)
+        with open(self.tmpfile('libx', Lib('x') + config.LIBS_DESC_SUFFIX), 'w') as f:
+            f.write(str(generate(self.libx_files)))
+        with open(self.tmpfile('liby', Lib('y') + config.LIBS_DESC_SUFFIX), 'w') as f:
+            f.write(str(generate(self.liby_files + [self.tmpfile('libx', Lib('x'))])))
+
+        # Create various objects and libraries 
+        self.arg_files = [self.tmpfile(f) for f in [Lib('a'), Obj('b'), Obj('c'), Lib('d'), Obj('e')]]
+        # We always give library names (LIB_PREFIX/SUFFIX), even for
+        # dynamic/import libraries
+        self.files = self.arg_files + [self.tmpfile(ImportLib('f'))]
+        self.arg_files += [self.tmpfile(Lib('f'))]
+        self.touch(self.files)
+
+class TestExpandArgs(TestExpandInit):
+    def test_expand(self):
+        '''Test library expansion'''
+        # Expanding arguments means libraries with a descriptor are expanded
+        # with the descriptor content, and import libraries are used when
+        # a library doesn't exist
+        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
+        self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files) 
+
+        # When a library exists at the same time as a descriptor, we just use
+        # the library
+        self.touch([self.tmpfile('libx', Lib('x'))])
+        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
+        self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))]) 
+
+        self.touch([self.tmpfile('liby', Lib('y'))])
+        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
+        self.assertEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
+
+class TestExpandArgsMore(TestExpandInit):
+    def test_makelist(self):
+        '''Test grouping object files in lists'''
+        # ExpandArgsMore does the same as ExpandArgs
+        with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
+            self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files) 
+
+            # But also has an extra method replacing object files with a list
+            args.makelist()
+            # self.files has objects at #1, #2, #4
+            self.assertEqual(args[:3], ['foo', '-bar'] + self.files[:1])
+            self.assertEqual(args[4:], [self.files[3]] + self.files[5:] + [self.tmpfile('liby', Lib('z'))])
+
+            # Check the list file content
+            objs = [f for f in self.files + self.liby_files + self.libx_files if f.endswith(config.OBJ_SUFFIX)]
+            if config.EXPAND_LIBS_LIST_STYLE == "linkerscript":
+                self.assertNotEqual(args[3][0], '@')
+                filename = args[3]
+                content = ["INPUT(%s)" % f for f in objs]
+            elif config.EXPAND_LIBS_LIST_STYLE == "list":
+                self.assertEqual(args[3][0], '@')
+                filename = args[3][1:]
+                content = objs
+
+            with open(filename, 'r') as f:
+                self.assertEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
+
+            tmp = args.tmp
+        # Check that all temporary files are properly removed
+        self.assertEqual(True, all([not os.path.exists(f) for f in tmp]))
+
+    def test_extract(self):
+        '''Test library extraction'''
+        # Divert subprocess.call
+        subprocess_call = subprocess.call
+        extracted = {}
+        def call(args, **kargs):
+            # The command called is always AR_EXTRACT
+            ar_extract = config.AR_EXTRACT.split()
+            self.assertEqual(args[:len(ar_extract)], ar_extract)
+            # Remaining argument is always one library
+            self.assertEqual([os.path.splitext(arg)[1] for arg in args[len(ar_extract):]], [config.LIB_SUFFIX])
+            # Simulate AR_EXTRACT extracting one object file for the library
+            lib = os.path.splitext(os.path.basename(args[len(ar_extract)]))[0]
+            extracted[lib] = os.path.join(kargs['cwd'], "%s" % Obj(lib))
+            self.touch([extracted[lib]])
+        subprocess.call = call
+
+        # ExpandArgsMore does the same as ExpandArgs
+        self.touch([self.tmpfile('liby', Lib('y'))])
+        with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
+            self.assertEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
+
+            # ExpandArgsMore also has an extra method extracting static libraries
+            # when possible
+            args.extract()
+
+            files = self.files + self.liby_files + self.libx_files
+            if not len(config.AR_EXTRACT):
+                # If we don't have an AR_EXTRACT, extract() expands libraries with a
+                # descriptor when the corresponding library exists (which ExpandArgs
+                # alone doesn't)
+                self.assertEqual(args, ['foo', '-bar'] + files)
+            else:
+                # With AR_EXTRACT, it uses the descriptors when there are, and actually
+                # extracts the remaining libraries
+                self.assertEqual(args, ['foo', '-bar'] + [extracted[os.path.splitext(os.path.basename(f))[0]] if f.endswith(config.LIB_SUFFIX) else f for f in files])
+
+            tmp = args.tmp
+        # Check that all temporary files are properly removed
+        self.assertEqual(True, all([not os.path.exists(f) for f in tmp]))
+
+        # Restore subprocess.call
+        subprocess.call = subprocess_call
+
+if __name__ == '__main__':
+    unittest.main()
--- a/configure.in
+++ b/configure.in
@@ -180,17 +180,17 @@ then
   fi
 fi
 MOZ_BUILD_ROOT=`pwd`
 
 dnl Default to MSVC for win32 and gcc-4.2 for darwin
 dnl ==============================================================
 if test -z "$CROSS_COMPILE"; then
 case "$target" in
-*-cygwin*|*-mingw*|*-msvc*|*-mks*)
+*-mingw*)
     if test -z "$CC"; then CC=cl; fi
     if test -z "$CXX"; then CXX=cl; fi
     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
     if test -z "$LD"; then LD=link; fi
     if test -z "$AS"; then
         case "${target_cpu}" in
         i*86)
@@ -608,17 +608,17 @@ esac
 if test -n "$COMPILE_ENVIRONMENT"; then
 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
     # We can't build parental controls either
     MOZ_DISABLE_PARENTAL_CONTROLS=1
 fi
 fi
 
 case "$target" in
-*-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
+*-mingw*|*-wince|*-winmo)
     if test "$GCC" != "yes"; then
         # Check to see if we are really running in a msvc environemnt
         _WIN32_MSVC=1
         AC_CHECK_PROGS(MIDL, midl)
 
         # Make sure compilers are valid
         CFLAGS="$CFLAGS -TC -nologo"
         CXXFLAGS="$CXXFLAGS -TP -nologo"
@@ -740,17 +740,17 @@ case "$target" in
         *)
             AC_MSG_RESULT([none needed])
             ;;
         esac
 
         # Identify which version of the SDK we're building with
         # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
         # from there
-        AC_CHECK_HEADERS([winsdkver.h])
+        MOZ_CHECK_HEADERS([winsdkver.h])
         if test "$ac_cv_header_winsdkver_h" = "yes"; then
             # Get the highest _WIN32_WINNT and NTDDI versions supported
             # Take the higher of the two
             # This is done because the Windows 7 beta SDK reports its
             # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
             AC_CACHE_CHECK(for highest Windows version supported by this SDK,
                            ac_cv_winsdk_maxver,
                            [cat > conftest.h <<EOF
@@ -767,17 +767,17 @@ WINSDK_MAXVER
 EOF
                             ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
                             rm -f conftest.h
                            ])
             MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
         else
             # The Vista SDK is the only one to have sdkddkver.h but not
             # WinSDKVer.h
-            AC_CHECK_HEADERS([sdkddkver.h])
+            MOZ_CHECK_HEADERS([sdkddkver.h])
             if test "$ac_cv_header_sdkddkver_h" = "yes"; then
                 MOZ_WINSDK_MAXVER=0x06000000
             else
                 # Assume the Server 2003 Platform SDK
                 MOZ_WINSDK_MAXVER=0x05020000
             fi
         fi
 
@@ -1132,35 +1132,34 @@ tools are selected during the Xcode/Deve
 
   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
     AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
   else
     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
 
-    dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
+    dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
 
     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
       dnl be ignored and cause warnings when -syslibroot is specified.
       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
       dnl the -isysroot it receives, so this is only needed with 4.0.0.
       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
     fi
   fi
 
   AC_LANG_SAVE
   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
   AC_LANG_CPLUSPLUS
-  AC_TRY_COMPILE([#include <new>
-                 int main() { return 0; }],
+  AC_TRY_COMPILE([#include <new>],[],
    result=yes,
    result=no)
   AC_LANG_RESTORE
   AC_MSG_RESULT($result)
 
   if test "$result" = "no" ; then
     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
   fi
@@ -1170,17 +1169,17 @@ fi # COMPILE_ENVIRONMENT
 
 if test -n "$MAKE"; then
   if test `echo $MAKE | grep -c make.py` != 1; then
      NOT_PYMAKE=$MAKE
   fi
 fi
 
 case "$host_os" in
-cygwin*|mingw*|mks*|msvc*)
+mingw*)
     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
     ;;
 *)
     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
     ;;
 esac
 if test "$GMAKE" = ":"; then
    AC_MSG_ERROR([GNU make not found])
@@ -1208,31 +1207,30 @@ DLL_PREFIX=lib
 LIB_PREFIX=lib
 DLL_SUFFIX=.so
 OBJ_SUFFIX=o
 LIB_SUFFIX=a
 ASM_SUFFIX=s
 IMPORT_LIB_SUFFIX=
 TARGET_MD_ARCH=unix
 DIRENT_INO=d_ino
-CYGWIN_WRAPPER=
 WIN_TOP_SRC=
 MOZ_USER_DIR=".mozilla"
 
 MOZ_JPEG_CFLAGS=
 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
 MOZ_ZLIB_CFLAGS=
 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
 MOZ_BZ2_CFLAGS=
 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
 MOZ_PNG_CFLAGS=
 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
 
-MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
-MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
+MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
+MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
 
 MOZ_FS_LAYOUT=unix
@@ -1289,17 +1287,17 @@ HOST_OS_ARCH=`echo $host_os | sed -e 's|
 # OS_ARCH
 # OS_TEST
 # OS_TARGET
 # OS_RELEASE
 # OS_MINOR_RELEASE
 #
 
 case "$HOST_OS_ARCH" in
-cygwin*|mingw*|mks*|msvc*)
+mingw*)
     HOST_OS_ARCH=WINNT
     ;;
 darwin*)
     HOST_OS_ARCH=Darwin
     ;;
 linux*)
     HOST_OS_ARCH=Linux
     ;;
@@ -1382,23 +1380,18 @@ Windows_NT)
     OS_ARCH=WINNT
     OS_TARGET=WINNT
     OS_MINOR_RELEASE=`uname -v`
     if test "$OS_MINOR_RELEASE" = "00"; then
         OS_MINOR_RELEASE=0
     fi
     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
     ;;
-CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
+MINGW*_NT*)
 #
-# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
-# the uname.exe in the Cygwin tools.
-# Prior to the Beta 20 release, Cygwin was called GNU-Win32.
-# If uname -s returns "CYGWIN32/NT", we assume that we are using
-# the uname.exe in the GNU-Win32 tools.
 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
 # the uname.exe in the MSYS tools.
 #
     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
     OS_ARCH=WINNT
     OS_TARGET=WINNT
     ;;
 AIX)
@@ -1846,17 +1839,17 @@ MOZ_ARG_ENABLE_BOOL(profiling,
 dnl ========================================================
 dnl = Use Valgrind
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(valgrind,
 [  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
     MOZ_VALGRIND=1,
     MOZ_VALGRIND= )
 if test -n "$MOZ_VALGRIND"; then
-    AC_CHECK_HEADER([valgrind/valgrind.h], [],
+    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
         AC_MSG_ERROR(
             [--enable-valgrind specified but Valgrind is not installed]))
     AC_DEFINE(MOZ_VALGRIND)
 fi
 
 dnl ========================================================
 dnl jprof
 dnl ========================================================
@@ -1910,55 +1903,33 @@ dnl ====================================
 if test -n "$MOZ_PROFILING"; then
     AC_DEFINE(MOZ_PROFILING)
 fi
 
 dnl ========================================================
 dnl System overrides of the defaults for host
 dnl ========================================================
 case "$host" in
-*-beos*)
-    HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
-    HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
-    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
-    ;;
-
-*cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
+*mingw*|*wince|*winmo)
     if test -n "$_WIN32_MSVC"; then
         HOST_AR=lib
         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
         HOST_RANLIB='echo ranlib'
     else
         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
     fi
-    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
+    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     HOST_BIN_SUFFIX=.exe
     case "$host" in
     *mingw*)
-    dnl MinGW/MSYS does not need CYGWIN_WRAPPER
         PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
         ;;
-    *)
-        CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
-        if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
-            _pwd=`pwd`
-            CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
-        fi
-        if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
-            AS_PERL=1
-            PERL="${CYGWIN_WRAPPER} $PERL"
-        fi
-
-        if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
-            PYTHON="${CYGWIN_WRAPPER} $PYTHON"
-        fi
-        ;;
     esac
 
     case "${host_cpu}" in
     x86_64)
         HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
         ;;
     esac
     ;;
@@ -2069,39 +2040,21 @@ case "$target" in
         fi
     fi
     case "${target_os}" in
     aix4.1*)
         DLL_SUFFIX='_shr.a'
         ;;
     esac
     if test "$COMPILE_ENVIRONMENT"; then
-        AC_CHECK_HEADERS(sys/inttypes.h)
+        MOZ_CHECK_HEADERS(sys/inttypes.h)
     fi
     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
     ;;
 
-*-beos*)
-    no_x=yes
-    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
-    _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
-    DSO_LDOPTS='-nostart'
-    TK_LIBS='-lbe -lroot'
-    LIBS="$LIBS -lbe"
-    if test "$COMPILE_ENVIRONMENT"; then
-        AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
-        AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
-    fi
-    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
-    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
-    _MOZ_USE_RTTI=1
-    USE_DEPENDENT_LIBS=
-    MOZ_USER_DIR="Mozilla"
-    ;;
-
 *-bsdi*)
     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
     _PEDANTIC=
     case $OS_RELEASE in
 	4.*|5.*)
             STRIP="$STRIP -d"
             ;;
 	*)
@@ -2311,17 +2264,17 @@ ia64*-hpux*)
     ;;
 
 *-wince*|*-winmo*)
     TARGET_COMPILER_ABI=msvc
     _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
     MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
     AR_LIST="$AR -list"
-    AR_EXTRACT="$AR -extract"
+    AR_EXTRACT=
     AR_DELETE="$AR d"
     AR_FLAGS='-OUT:"$@"'
     MOZ_MEMORY=1
     NSS_DISABLE_DBM=1
     MOZ_OGG=
     ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
 
     if test "$AS_BIN"; then
@@ -2336,17 +2289,18 @@ ia64*-hpux*)
     fi
     # certain versions of cygwin's makedepend barf on the 
     # #include <string> vs -I./dist/include/string issue so don't use it
     SYSTEM_MAKEDEPEND=
 
     HOST_CC=cl
     HOST_CXX=cl
     HOST_LD=link
-    HOST_AR='lib -OUT:$@'
+    HOST_AR='lib'
+    HOST_AR_FLAGS='-OUT:$@'
     HOST_RANLIB='echo ranlib'
     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
         
         
     WARNINGS_AS_ERRORS='-WX'
     MOZ_OPTIMIZE_FLAGS='-Ox'
     AR_FLAGS='-NOLOGO -OUT:"$@"'
     ASM_SUFFIX=asm
@@ -2367,18 +2321,16 @@ ia64*-hpux*)
     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
     MKSHLIB_FORCE_ALL=
     MKSHLIB_UNFORCE_ALL=
     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
     MOZ_DEBUG_FLAGS='-Zi'
     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
     MOZ_FIX_LINK_PATHS=
-    MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
-    MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
     OBJ_SUFFIX=obj
     RANLIB='echo not_ranlib'
     STRIP='echo not_strip'
     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
     UNZIP=unzip
     XARGS=xargs
     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
     ZIP=zip
@@ -2400,23 +2352,22 @@ ia64*-hpux*)
     BIN_SUFFIX='.exe'
     MOZ_USER_DIR="Mozilla"
 
     MOZ_GFX_OPTIMIZE_MOBILE=1
 
     # Sanity check for WINCE_WINDOWS_MOBILE
     # XXX disabled until we can fix the mobile tinderbox
     ##if test "$WINCE_WINDOWS_MOBILE"; then
-    ##   AC_CHECK_HEADER(tpcshell.h, [],
+    ##   MOZ_CHECK_HEADER(tpcshell.h, [],
     ##        AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
     ##fi
 ;;
 
-
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*)
     DSO_CFLAGS=
     DSO_PIC_CFLAGS=
     DLL_SUFFIX=.dll
     RC=rc.exe
     # certain versions of cygwin's makedepend barf on the 
     # #include <string> vs -I./dist/include/string issue so don't use it
     SYSTEM_MAKEDEPEND=
     if test -n "$GNU_CC"; then
@@ -2428,34 +2379,33 @@ ia64*-hpux*)
         DSO_LDOPTS='-shared'
         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
         RC='$(WINDRES)'
         # Use temp file for windres (bug 213281)
         RCFLAGS='-O coff --use-temp-file'
         # mingw doesn't require kernel32, user32, and advapi32 explicitly
         LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
-        MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
-        MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
         MOZ_FIX_LINK_PATHS=
         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
         DLL_PREFIX=
         IMPORT_LIB_SUFFIX=dll.a
         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
     else
         TARGET_COMPILER_ABI=msvc
         HOST_CC='$(CC)'
         HOST_CXX='$(CXX)'
         HOST_LD='$(LD)'
         if test "$AS_BIN"; then
             AS="$(basename "$AS_BIN")"
         fi
-        AR='lib -NOLOGO -OUT:"$@"'
-        AR_FLAGS=
+        AR='lib'
+        AR_FLAGS='-NOLOGO -OUT:"$@"'
+        AR_EXTRACT=
         RANLIB='echo not_ranlib'
         STRIP='echo not_strip'
         PKG_SKIP_STRIP=1
         XARGS=xargs
         ZIP=zip
         UNZIP=unzip
         DOXYGEN=:
         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
@@ -2481,18 +2431,16 @@ ia64*-hpux*)
         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
         WARNINGS_AS_ERRORS='-WX'
         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
         if test -z "$MOZ_PROFILING"; then
             MOZ_OPTIMIZE_FLAGS='-O1'
         else
             MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
         fi
-        MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
-        MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
         MOZ_FIX_LINK_PATHS=
         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
         if test $_MSC_VER -ge 1400; then
             LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
             dnl For profile-guided optimization
@@ -2530,60 +2478,47 @@ ia64*-hpux*)
 
     dnl Hardcode to win95 for now - cls
     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
 
     dnl set NO_X11 defines here as the general check is skipped on win32
     no_x=yes
     AC_DEFINE(NO_X11)
 
-    dnl MinGW/MSYS doesn't provide or need cygpath
+    case "$host" in
+    *-mingw*)
+        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
+        ;;
+    esac
+
     case "$host" in
     *-mingw*)
-	CYGPATH_W=echo
-	CYGPATH_S=cat
-	MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
-	;;
-    *-cygwin*|*-msvc*|*-mks*)
-	CYGPATH_W="cygpath -a -w"
-	CYGPATH_S="sed -e s|\\\\|/|g"
-	MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
-	;;
-    esac
-    case "$host" in
-    *-mingw*|*-cygwin*|*-msvc*|*-mks*)
-
-    if test -z "$MOZ_TOOLS"; then
-        AC_MSG_ERROR([MOZ_TOOLS is not set])
-    fi
-
-    MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
-    if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
-        AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
-    fi
-    MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
-    if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
-        AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
-    fi
-    MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
-    ;;
+        if test -z "$MOZ_TOOLS"; then
+            AC_MSG_ERROR([MOZ_TOOLS is not set])
+        fi
+        MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
+        if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
+            AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
+        fi
+        MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
+        if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
+            AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
+        fi
+        ;;
     esac 
 
-
     case "$host_os" in
     cygwin*|msvc*|mks*)
-        AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
+        AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
         ;;
-
     *)
         AC_CHECK_HEADERS(oleacc.idl)
-
         AC_LANG_SAVE
         AC_LANG_CPLUSPLUS
-        AC_CHECK_HEADERS(atlbase.h)
+        MOZ_CHECK_HEADERS(atlbase.h)
         AC_LANG_RESTORE
         ;;
     esac
 
     case "$target" in
     i*86-*)
         if test "$HAVE_64BIT_OS"; then
             AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
@@ -2593,25 +2528,19 @@ ia64*-hpux*)
             LDFLAGS="$LDFLAGS -SAFESEH"
         fi
 
         if test -n "$GNU_CC"; then
             CFLAGS="$CFLAGS -mstackrealign"
             CXXFLAGS="$CXXFLAGS -mstackrealign"
         fi
 
-        AC_CHECK_HEADERS(mmintrin.h)
+        MOZ_CHECK_HEADERS(mmintrin.h)
     	AC_DEFINE(_X86_)
 	;;
-    alpha-*)
-    	AC_DEFINE(_ALPHA_)
-	;;
-    mips-*)
-    	AC_DEFINE(_MIPS_)
-	;;
     x86_64-*)
         AC_DEFINE(_AMD64_)
         ;;
     *)
     	AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
 	;;
     esac
 
@@ -2964,17 +2893,17 @@ case "$target" in
     NO_LD_ARCHIVE_FLAGS=
     ;;
 *-aix4.3*|*-aix5*)
     NO_LD_ARCHIVE_FLAGS=
     ;;
 *-openvms*)
     NO_LD_ARCHIVE_FLAGS=
     ;;
-*-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
+*-mingw*|*-wince|*-winmo)
     if test -z "$GNU_CC"; then
         NO_LD_ARCHIVE_FLAGS=
     fi
     ;;
 esac
 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
 
 dnl ========================================================
@@ -2998,17 +2927,17 @@ case "$target" in
         fi
         ;;
     *-nto*) 
         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
         ;;
     *-darwin*)
         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
         ;;
-    *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
+    *-mingw*|*-wince|*-winmo)
         if test -n "$GNU_CC"; then
            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
         fi
         ;;
 esac
 
 if test -z "$COMPILE_ENVIRONMENT"; then
     SKIP_COMPILER_CHECKS=1
@@ -3414,90 +3343,88 @@ dnl Checks for header files.
 dnl ========================================================
 AC_HEADER_DIRENT
 case "$target_os" in
 freebsd*)
 # for stuff like -lXshm
     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
     ;;
 esac
-AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
-AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
-AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(X11/XKBlib.h)
-AC_CHECK_HEADERS(io.h)
+MOZ_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
+MOZ_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
+MOZ_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
+MOZ_CHECK_HEADERS(malloc.h)
+MOZ_CHECK_HEADERS(X11/XKBlib.h)
+MOZ_CHECK_HEADERS(io.h)
 
 dnl These are all the places some variant of statfs can be hiding.
-AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
+MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
 
 dnl Quota support
-AC_CHECK_HEADERS(sys/quota.h)
-AC_CHECK_HEADERS(linux/quota.h)
+MOZ_CHECK_HEADERS(sys/quota.h)
+MOZ_CHECK_HEADERS(linux/quota.h)
 
 dnl Try for MMX support
 dnl NB - later gcc versions require -mmmx for this header to be successfully
 dnl included (or another option which implies it, such as -march=pentium-mmx)
-AC_CHECK_HEADERS(mmintrin.h)
+MOZ_CHECK_HEADERS(mmintrin.h)
 
 dnl Check whether the compiler supports the new-style C++ standard
 dnl library headers (i.e. <new>) or needs the old "new.h"
 AC_LANG_CPLUSPLUS
 NEW_H=new.h
-AC_CHECK_HEADER(new, [NEW_H=new])
+MOZ_CHECK_HEADER(new, [NEW_H=new])
 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
 AC_LANG_C
 
 AC_ARG_ENABLE(dtrace,
               [  --enable-dtrace         build with dtrace support if available (default=no)],
               [enable_dtrace="yes"],)
 if test "x$enable_dtrace" = "xyes"; then
-  AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
+  MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
   if test -n "$HAVE_DTRACE"; then
       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
   else
       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
   fi
 fi
 AC_SUBST(HAVE_DTRACE)
 
 case $target in
 *-aix4.3*|*-aix5*)
 	;;
 *)
-	AC_CHECK_HEADERS(sys/cdefs.h)
+	MOZ_CHECK_HEADERS(sys/cdefs.h)
 	;;
 esac
 
 dnl Checks for libraries.
 dnl ========================================================
 case $target in
 *-hpux11.*)
 	;;
 *)
 	AC_CHECK_LIB(c_r, gethostbyname_r)
 	;;
 esac
 
 dnl We don't want to link with libdl even if it's present on OS X, since
-dnl it's not used and not part of the default installation.
-dnl The same goes for BeOS. OS/2 has dlfcn in libc.
+dnl it's not used and not part of the default installation. OS/2 has dlfcn
+dnl in libc.
 dnl We don't want to link against libm or libpthread on Darwin since
 dnl they both are just symlinks to libSystem and explicitly linking
 dnl against libSystem causes issues when debugging (see bug 299601).
 case $target in
 *-darwin*)
     ;;
-*-beos*)
-    ;;
 *-os2*)
     ;;
 *)
     AC_SEARCH_LIBS(dlopen, dl, 
-        AC_CHECK_HEADER(dlfcn.h, 
+        MOZ_CHECK_HEADER(dlfcn.h, 
         AC_DEFINE(HAVE_DLOPEN)))
     ;;
 esac
 
 _SAVE_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -D_GNU_SOURCE"
 AC_CHECK_FUNCS(dladdr)
 CFLAGS="$_SAVE_CFLAGS"
@@ -3577,36 +3504,36 @@ else
         ;;
     esac
 
     dnl ========================================================
     dnl = Check for XShm
     dnl ========================================================
     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
         $XLIBS $XEXT_LIBS)
-    AC_CHECK_HEADER(X11/extensions/XShm.h)
+    MOZ_CHECK_HEADER(X11/extensions/XShm.h)
     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
         test -n "$_HAVE_XSHM_XEXT"; then
         AC_DEFINE(HAVE_XSHM)
     fi
 
     dnl ========================================================
     dnl = Check for Xss
     dnl ========================================================
-    AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
+    MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
         AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
             [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
              AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
 
     dnl ========================================================
     dnl = Check for XIE
     dnl ========================================================
     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
         $XLIBS $XEXT_LIBS)
-    AC_CHECK_HEADER(X11/extensions/XIElib.h)
+    MOZ_CHECK_HEADER(X11/extensions/XIElib.h)
 
     if test "$MOZ_XIE_LIBS"; then
 	dnl ====================================================
 	dnl = If XIE is present and is desired, turn it on
 	dnl ====================================================
 	case $target in
 	    *-hpux*)
 		;;
@@ -3969,17 +3896,17 @@ AC_CACHE_CHECK(
         )]
     )
 
 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
 fi
 
 case $target_os in
-    os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
+    darwin*|mingw*|os2*|wince*|winmo*)
         ;;
     *)
     
 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
 _SAVE_LIBS=$LIBS
 LIBS="$LIBS $_ICONV_LIBS"
@@ -4527,21 +4454,21 @@ if test "$ac_cv_thread_keyword" = yes; t
       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
       ;;
   esac
 fi
 
 dnl Check for the existence of various allocation headers/functions
 
 MALLOC_H=
-AC_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
+MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
 if test "$MALLOC_H" = ""; then
-  AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
+  MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
   if test "$MALLOC_H" = ""; then
-    AC_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
+    MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
   fi
 fi
 if test "$MALLOC_H" != ""; then
    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
 fi
 
 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
@@ -4743,21 +4670,21 @@ MOZ_ARG_WITH_STRING(system-libevent,
 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
     MOZ_NATIVE_LIBEVENT=
 else
     if test "${LIBEVENT_DIR}" = "yes"; then
         LIBEVENT_DIR=/usr
     fi
     CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
     LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
-    AC_CHECK_HEADER(event.h,
-                    [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
-                         AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
-                     fi],
-                    AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
+    MOZ_CHECK_HEADER(event.h,
+        [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
+             AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
+         fi],
+        AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
     AC_CHECK_LIB(event, event_init,
                  [MOZ_NATIVE_LIBEVENT=1
                   MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
                   MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
                  [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
 fi
 CFLAGS=$_SAVE_CFLAGS
 LDFLAGS=$_SAVE_LDFLAGS
@@ -5026,17 +4953,16 @@ ENABLE_TESTS=1
 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_FEEDS=1
 MOZ_INSTALLER=1
 MOZ_IPC=1
 MOZ_JAVAXPCOM=
 MOZ_JSDEBUGGER=1
-MOZ_JSLOADER=1
 MOZ_MATHML=1
 MOZ_MORK=
 MOZ_MORKREADER=1
 MOZ_AUTH_EXTENSION=1
 MOZ_NO_ACTIVEX_SUPPORT=1
 MOZ_NO_FAST_LOAD=
 MOZ_OGG=1
 MOZ_RAW=
@@ -5072,17 +4998,16 @@ MOZ_STORAGE=1
 MOZ_SVG=1
 MOZ_THUMB2=
 MOZ_TIMELINE=
 MOZ_TOOLKIT_SEARCH=1
 MOZ_UI_LOCALE=en-US
 MOZ_UNIVERSALCHARDET=1
 MOZ_URL_CLASSIFIER=
 MOZ_USE_NATIVE_UCONV=
-MOZ_VIEW_SOURCE=1
 MOZ_XSLT_STANDALONE=
 MOZ_XTF=1
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 NS_PRINTING=1
 MOZ_PDF_PRINTING=
 MOZ_DISABLE_DOMCRYPTO=
 NSS_DISABLE_DBM=
@@ -5100,17 +5025,17 @@ case "${target}" in
     ACCESSIBILITY=
     ;;
 *)
     ACCESSIBILITY=1
     ;;
 esac
 
 case "$target_os" in
-    msvc*|mks*|cygwin*|mingw*)
+    mingw*)
         NS_ENABLE_TSF=1
         if test -z "$GNU_CC"; then 
             if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
                 NS_ENABLE_TSF=
             fi
         fi
         if test -n "$NS_ENABLE_TSF"; then
             AC_DEFINE(NS_ENABLE_TSF)
@@ -5226,34 +5151,32 @@ MOZ_ARG_HEADER(Toolkit Options)
 
     dnl ========================================================
     dnl = Select the default toolkit
     dnl ========================================================
 	MOZ_ARG_ENABLE_STRING(default-toolkit,
 	[  --enable-default-toolkit=TK
                           Select default toolkit
                           Platform specific defaults:
-                            BeOS - cairo-beos
                             Mac OS X - cairo-cocoa
                             Neutrino/QNX - photon
                             OS/2 - cairo-os2
                             Win32/WinCE - cairo-windows
                             Gtk2 with DirectFB - cairo-gtk2-dfb
                             * - cairo-gtk2
                             * - cairo-qt],
     [ _DEFAULT_TOOLKIT=$enableval ],
     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
 
     if test "$_DEFAULT_TOOLKIT" = "photon" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
-        -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-android"
     then
         dnl nglayout only supports building with one toolkit,
         dnl so ignore everything after the first comma (",").
         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
     else
@@ -5329,23 +5252,16 @@ cairo-qt)
     USE_FC_FREETYPE=1
 
     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
     TK_LIBS='$(MOZ_QT_LIBS)'
     AC_DEFINE(MOZ_WIDGET_QT)
     MOZ_PDF_PRINTING=1
     ;;
 
-cairo-beos)
-    MOZ_WIDGET_TOOLKIT=beos
-    USE_FC_FREETYPE=1
-    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
-    TK_LIBS='$(MOZ_CAIRO_LIBS)'
-    ;;
-
 cairo-os2)
     MOZ_WIDGET_TOOLKIT=os2
     USE_FC_FREETYPE=1
     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
     TK_LIBS='$(MOZ_CAIRO_LIBS)'
     MOZ_PDF_PRINTING=1
     ;;
 
@@ -5901,40 +5817,37 @@ MOZ_ARG_DISABLE_BOOL(jsd,
     MOZ_JSDEBUGGER=,
     MOZ_JSDEBUGGER=1)
 
 
 dnl ========================================================
 dnl = Disable IPC support for tabs and plugins
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(ipc,
-[  --disable-ipc           Disable IPC supports for tabs and plugins],
+[  --disable-ipc           Disable IPC for tabs and plugins (not supported)],
     MOZ_IPC=,
     MOZ_IPC=1)
 
-if test -n "$MOZ_IPC"; then
-    AC_DEFINE(MOZ_IPC)
-fi
-
+if test -z "$MOZ_IPC"; then
+  AC_MSG_ERROR([--disable-ipc is no longer supported.])
+fi
+
+AC_DEFINE(MOZ_IPC)
 AC_SUBST(MOZ_IPC)
 
 dnl ========================================================
 dnl = Enable IPDL's "expensive" unit tests
 dnl ========================================================
 MOZ_IPDL_TESTS=
 
 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
 [  --enable-ipdl-tests     Enable expensive IPDL tests],
     MOZ_IPDL_TESTS=1,
     MOZ_IPDL_TESTS=)
 
-if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
-    AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
-fi
-
 if test -n "$MOZ_IPDL_TESTS"; then
     AC_DEFINE(MOZ_IPDL_TESTS)
 fi
 
 AC_SUBST(MOZ_IPDL_TESTS)
 
 dnl ========================================================
 dnl = Disable plugin support
@@ -5952,55 +5865,41 @@ MOZ_ARG_DISABLE_BOOL(dbm,
     NSS_DISABLE_DBM=1,
     NSS_DISABLE_DBM=)
 
 dnl bi-directional support always on
 IBMBIDI=1
 AC_DEFINE(IBMBIDI)
 
 dnl ========================================================
-dnl view source support on by default
-dnl ========================================================
-if test "$MOZ_VIEW_SOURCE"; then
-    AC_DEFINE(MOZ_VIEW_SOURCE)
-fi
-
-dnl ========================================================
 dnl accessibility support on by default on all platforms 
 dnl except OS X.
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(accessibility,
 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
     ACCESSIBILITY=,
     ACCESSIBILITY=1 )
 if test "$ACCESSIBILITY"; then
     AC_DEFINE(ACCESSIBILITY)
 fi
 
 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
 case "$target" in
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*)
     if test "$ac_cv_header_atlbase_h" = "no"; then
         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
     fi
     if test "$ac_cv_header_oleacc_idl" = "no"; then
         AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
     fi
     ;;
 esac
 fi
 
 dnl ========================================================
-dnl xpcom js loader support on by default
-dnl ========================================================
-if test "$MOZ_JSLOADER"; then
-    AC_DEFINE(MOZ_JSLOADER)
-fi
-
-dnl ========================================================
 dnl Disable printing
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(printing,
 [  --disable-printing      Disable printing support],
     NS_PRINTING=,
     NS_PRINTING=1)
 
 if test "$NS_PRINTING"; then
@@ -6134,21 +6033,21 @@ if test -n "$MOZ_WEBM"; then
         _SAVE_CFLAGS=$CFLAGS
         _SAVE_LDFLAGS=$LDFLAGS
         _SAVE_LIBS=$LIBS
         if test "${LIBVPX_DIR}" = "yes"; then
             LIBVPX_DIR=/usr
         fi
         CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
         LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
-        AC_CHECK_HEADER(vpx/vpx_decoder.h,
-                        [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
-                             AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
-                         fi],
-                        AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
+        MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
+            [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
+             AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
+            fi],
+            AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
                      [MOZ_NATIVE_LIBVPX=1
                       MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
                       MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
                      ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
         CFLAGS=$_SAVE_CFLAGS
         LDFLAGS=$_SAVE_LDFLAGS
         LIBS=$_SAVE_LIBS
@@ -6372,21 +6271,16 @@ esac
 
 MOZ_ARG_ENABLE_BOOL(javaxpcom,
 [  --enable-javaxpcom
                           Enable Java-XPCOM bridge],
     MOZ_JAVAXPCOM=1,
     MOZ_JAVAXPCOM=)
 
 case "$host_os" in
-  cygwin*|msvc*|mks*)
-    if test -n "$JAVA_HOME"; then
-      JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
-    fi
-    ;;
   *mingw*)
     if test -n "$JAVA_HOME"; then
       JAVA_HOME=`cd "$JAVA_HOME" && pwd`
     fi
     ;;
 esac
 
 if test -n "${JAVA_BIN_PATH}"; then
@@ -6439,19 +6333,19 @@ MOZ_ANGLE=
 MOZ_DIRECTX_SDK_PATH=
 MOZ_DIRECTX_SDK_CPU_SUFFIX=
 MOZ_D3DX9_VERSION=
 MOZ_D3DX9_CAB=
 MOZ_D3DCOMPILER_CAB=
 MOZ_D3DX9_DLL=
 MOZ_D3DCOMPILER_DLL=
 case "$target_os" in
-    *msvc*|*mks*|*cygwin*|*mingw*)
-        MOZ_ANGLE=1
-        ;;
+*mingw*)
+    MOZ_ANGLE=1
+    ;;
 esac
 
 # The DirectX SDK libraries are split into x86 and x64 sub-directories
 case "${target_cpu}" in
 i*86)
   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
   ;;
 x86_64)
@@ -6544,17 +6438,17 @@ if test -n "$MOZ_CRASHREPORTER"; then
    AC_DEFINE(MOZ_CRASHREPORTER)
 
   if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
     test -z "$SKIP_LIBRARY_CHECKS"; then
     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
     AC_SUBST(MOZ_GTHREAD_CFLAGS)
     AC_SUBST(MOZ_GTHREAD_LIBS)
 
-    AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
+    MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
   fi
 fi
 
 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
 [  --with-crashreporter-enable-percent=NN
                           Enable sending crash reports by default on NN% of users. (default=100)],
 [ val=`echo $withval | sed 's/[^0-9]//g'`
     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
@@ -6724,22 +6618,21 @@ if test -n "$MOZ_TREE_FREETYPE"; then
    FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
    CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
    AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
    AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
    AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
    AC_SUBST(CAIRO_FT_CFLAGS)
 fi
 
-
 dnl ========================================================
 dnl Installer
 dnl ========================================================
 case "$target_os" in
-    aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
+    aix*|solaris*|linux*|mingw*|os2*|wince*|winmo*)
         MOZ_INSTALLER=1
         ;;
 esac
 
 MOZ_ARG_DISABLE_BOOL(installer,
 [  --disable-installer     Disable building of installer],
     MOZ_INSTALLER=,
     MOZ_INSTALLER=1)
@@ -6763,17 +6656,16 @@ if test -n "$MOZ_INSTALLER" -a "$OS_ARCH
     AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
     if test "$MAKENSISU_VER" = "" ||
        test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
             ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
         AC_MSG_RESULT([no])
         AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
     fi
     AC_MSG_RESULT([yes])
-    MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
 fi
 
 AC_SUBST(MOZ_INSTALLER)
 
 AC_MSG_CHECKING([for tar archiver])
 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
 if test -z "$TAR"; then
     AC_MSG_ERROR([no tar archiver found in \$PATH])
@@ -6847,17 +6739,17 @@ AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
 then
     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
 fi
 
 if test "$COMPILE_ENVIRONMENT" = "1"; then
 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
 case "$target" in
-*-mingw*|*-cygwin*|*-msvc*|*-mks*)
+*-mingw*)
     if test "$ac_cv_header_atlbase_h" = "no"; then
         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
     fi
     ;;
 esac
 fi
 fi
 
@@ -7196,18 +7088,18 @@ if test $MOZ_PLATFORM_MAEMO; then
    fi
 
    MOZ_GFX_OPTIMIZE_MOBILE=1
    MOZ_WEBGL_GLX=
    MOZ_MAEMO_LIBLOCATION=
 
    if test $MOZ_PLATFORM_MAEMO = 5; then
       dnl if we have Xcomposite we should also have Xdamage and Xfixes
-      AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
-                       [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
+      MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
+          [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
       AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
                    [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
 
       AC_SUBST(XCOMPOSITE_LIBS)
 
       PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
       MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
       MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
@@ -7479,42 +7371,34 @@ fi
 fi # COMPILE_ENVIRONMENT
 
 AC_SUBST(MOZ_OPTIMIZE)
 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
 
 dnl ========================================================
-dnl = (Deprecated) generation of debugger info for specific modules
-dnl ========================================================
-MOZ_ARG_ENABLE_STRING(debugger-info-modules,
-[  --enable-debugger-info-modules
-                          Enable/disable debugger info for specific modules],
-[ if test "$enableval" != "no"; then
-    AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
-    MOZ_DEBUG_SYMBOLS=1
-  fi ])
-
-dnl ========================================================
 dnl = Enable generation of debug symbols
 dnl ========================================================
 MOZ_ARG_ENABLE_STRING(debug-symbols,
 [  --enable-debug-symbols[=DBG]
                           Enable debugging symbols (using compiler flags DBG)],
 [ if test "$enableval" != "no"; then
       MOZ_DEBUG_SYMBOLS=1
       if test -n "$enableval" -a "$enableval" != "yes"; then
           if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
               MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
           else
               AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
           fi
       fi
-  fi ])
+  else
+      MOZ_DEBUG_SYMBOLS=
+  fi ],
+  MOZ_DEBUG_SYMBOLS=1)
 
 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
     AC_DEFINE(MOZ_DEBUG_SYMBOLS)
     export MOZ_DEBUG_SYMBOLS
 fi
 
 dnl ========================================================
 dnl = Disable any treating of compile warnings as errors
@@ -7625,17 +7509,17 @@ if test "$MOZ_MEMORY"; then
     AC_DEFINE(MOZ_MEMORY_LINUX)
     ;;
   *-netbsd*)
     AC_DEFINE(MOZ_MEMORY_BSD)
     ;;
   *-solaris*)
     AC_DEFINE(MOZ_MEMORY_SOLARIS)
     ;;
-  *-msvc*|*-mks*|*-cygwin*|*-mingw*)
+  *-mingw*)
     AC_DEFINE(MOZ_MEMORY_WINDOWS)
     dnl This is sort of awful. Will revisit if we add support for more versions
     if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
         AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
     fi
     if test -z "$WIN32_CRT_SRC_DIR"; then
       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
         AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
@@ -7840,22 +7724,41 @@ MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
     USE_ELF_DYNSTR_GC=1,
     USE_ELF_DYNSTR_GC= )
 
 dnl ========================================================
 dnl = --disable-elf-hack
 dnl ========================================================
 
-USE_ELF_HACK=
+USE_ELF_HACK=1
 MOZ_ARG_DISABLE_BOOL(elf-hack,
 [  --disable-elf-hack      Disable elf hacks],
     USE_ELF_HACK=,
     USE_ELF_HACK=1)
 
+# Only enable elfhack where supported
+if test "$USE_ELF_HACK" = 1; then
+    case "${HOST_OS_ARCH},${OS_ARCH}" in
+    Linux,Linux)
+        case "${CPU_ARCH}" in
+        arm | x86 | x86_64)
+            USE_ELF_HACK=1
+            ;;
+        *)
+            USE_ELF_HACK=
+            ;;
+        esac
+        ;;
+    *)
+        USE_ELF_HACK=
+        ;;
+    esac
+fi
+
 dnl ========================================================
 dnl = 
 dnl = Profiling and Instrumenting
 dnl = 
 dnl ========================================================
 MOZ_ARG_HEADER(Profiling and Instrumenting)
 
 dnl ========================================================
@@ -7935,17 +7838,17 @@ if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_
     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
 fi
 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
 
 dnl ========================================================
 dnl = Support for gcc stack unwinding (from gcc 3.3)
 dnl ========================================================
 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
-    AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
+    MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
 fi
 
 dnl ========================================================
 dnl =
 dnl = Misc. Options
 dnl = 
 dnl ========================================================
 MOZ_ARG_HEADER(Misc. Options)
@@ -8286,16 +8189,48 @@ if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ
     AC_DEFINE(CPP_THROW_NEW, [])
 else
     AC_DEFINE(CPP_THROW_NEW, [throw()])
 fi
 AC_LANG_C
 
 dnl ========================================================
 dnl =
+dnl = Check what kind of list files are supported by the
+dnl = linker
+dnl =
+dnl ========================================================
+
+AC_CACHE_CHECK(what kind of list files are supported by the linker,
+    EXPAND_LIBS_LIST_STYLE,
+    [echo "int main() {return 0;}" > conftest.${ac_ext}
+     if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&2) && test -s conftest.${OBJ_SUFFIX}; then
+         echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
+         if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
+             EXPAND_LIBS_LIST_STYLE=linkerscript
+         else
+             echo "conftest.${OBJ_SUFFIX}" > conftest.list
+             if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
+                 EXPAND_LIBS_LIST_STYLE=list
+             else
+                 EXPAND_LIBS_LIST_STYLE=none
+             fi
+         fi
+     else
+         dnl We really don't expect to get here, but just in case
+         AC_ERROR([couldn't compile a simple C file])
+     fi
+     rm -rf conftest*])
+
+LIBS_DESC_SUFFIX=desc
+AC_SUBST(LIBS_DESC_SUFFIX)
+AC_SUBST(EXPAND_LIBS_LIST_STYLE)
+
+dnl ========================================================
+dnl =
 dnl = Build depencency options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Build dependencies)
 
 dnl ========================================================
 dnl = Do not auto generate dependency info
 dnl ========================================================
@@ -8310,17 +8245,17 @@ dnl ====================================
 dnl = Use mkdepend instead of $CC -MD for dependency generation
 dnl ========================================================
 _cpp_md_flag=
 MOZ_ARG_DISABLE_BOOL(md,
 [  --disable-md            Do not use compiler-based dependencies ],
   [_cpp_md_flag=],
   [_cpp_md_flag=1],
   [dnl Default is to turn on -MD if using GNU-compatible compilers
-   if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
+   if test "$GNU_CC" -a "$GNU_CXX"; then
      _cpp_md_flag=1
    fi
   dnl Default is to use -xM if using Sun Studio on Solaris
    if test "$SOLARIS_SUNPRO_CC"; then
      _cpp_md_flag=1
    fi])
 if test "$_cpp_md_flag"; then
   COMPILER_DEPEND=1
@@ -8369,77 +8304,62 @@ AC_SUBST(CXX_WRAPPER)
 dnl ========================================================
 dnl =
 dnl = Static Build Options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Static build options)
 
 MOZ_ARG_ENABLE_BOOL(static,
-[  --enable-static         Enable building of internal static libs],
+[  --enable-static         Enable building internal static libs],
     BUILD_STATIC_LIBS=1,
     BUILD_STATIC_LIBS=)
 
-MOZ_ARG_ENABLE_BOOL(libxul,
-[  --enable-libxul         Enable building of libxul],
-    MOZ_ENABLE_LIBXUL=1,
-    MOZ_ENABLE_LIBXUL=)
+MOZ_ENABLE_LIBXUL=1
+
+MOZ_ARG_DISABLE_BOOL(libxul,
+[  --disable-libxul        Disable building libxul (not supported)],
+    MOZ_ENABLE_LIBXUL=,
+    MOZ_ENABLE_LIBXUL=1)
+
+if test -z "$MOZ_ENABLE_LIBXUL"; then
+  AC_MSG_ERROR([--disable-libxul is no longer supported.])
+fi
 
 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
   ENABLE_SHARED_JS=1
 fi
 
 MOZ_ARG_ENABLE_BOOL(shared-js,
 [  --enable-shared-js
                           Create a shared JavaScript library.],
     ENABLE_SHARED_JS=1,
     ENABLE_SHARED_JS=)
 
-if test -z "$MOZ_ENABLE_LIBXUL"; then
-  dnl --disable-libxul implies shared js
-  ENABLE_SHARED_JS=1
-fi
-
 if test -n "$ENABLE_SHARED_JS"; then
   JS_SHARED_LIBRARY=1
   MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
 else
   MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
   AC_DEFINE(MOZ_STATIC_JS)
 fi
 AC_SUBST(JS_SHARED_LIBRARY)
 
 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
-	AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
+  AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME.])
 fi
 
 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
-	AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
-fi
-
-if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
-    AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
-fi
-
-if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
-    AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
+  AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
 fi
 
 AC_SUBST(LIBXUL_LIBS)
-
-if test -n "$MOZ_ENABLE_LIBXUL"; then
-    XPCOM_LIBS="$LIBXUL_LIBS"
-    AC_DEFINE(MOZ_ENABLE_LIBXUL)
-else
-    if test -n "$BUILD_STATIC_LIBS"; then
-        AC_DEFINE(MOZ_STATIC_BUILD)
-    fi
-    XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
-fi
+XPCOM_LIBS="$LIBXUL_LIBS"
+AC_DEFINE(MOZ_ENABLE_LIBXUL)
 
 dnl ========================================================
 dnl =
 dnl = Standalone module options
 dnl = 
 dnl ========================================================
 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
 
@@ -8464,24 +8384,23 @@ if test -z "$CROSS_COMPILE"; then
         HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
     fi
 fi
 
 if test "$SKIP_IDL_CHECK" = "no"
 then
     _LIBIDL_FOUND=
     case "$host" in
-    *-mingw*|*-cygwin*|*-msvc*|*-mks*)
+    *-mingw*)
         if test -n "$GLIB_PREFIX"; then
             _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
             if test "$?" = "0"; then
                 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
                     AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
                 fi
-                _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
             else
                  AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
             fi
         else
             _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
         fi
         if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
             AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
@@ -8496,17 +8415,16 @@ then
         fi
 
         if test -n "$HOST_LIBIDL_PREFIX"; then
             _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
             if test "$?" = "0"; then
                 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
                     AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
                 fi
-                _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
             else
                 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
             fi
         else
             _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
         fi        
         if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
             AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
@@ -8605,17 +8523,17 @@ int main() {
       if test -n "$_MACSAVE_NEXT_ROOT" ; then
         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
       fi
     fi
 fi
 
 if test -n "$CROSS_COMPILE"; then
     case "$target" in
-    *-mingw*|*-cygwin*|*-msvc*|*-mks*)
+    *-mingw*)
         if test -n "$GLIB_PREFIX"; then
             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
             else
                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
@@ -8684,17 +8602,17 @@ MOZ_TREE_CAIRO=1 )
 
 MOZ_TREE_PIXMAN=1
 MOZ_ARG_ENABLE_BOOL(system-pixman,
 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
 MOZ_TREE_PIXMAN=,
 MOZ_TREE_PIXMAN=1 )
 
 # Check for headers defining standard int types.
-AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
+MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
 
 if test "$MOZ_TREE_CAIRO"; then
     AC_DEFINE(MOZ_TREE_CAIRO)
 
     # For now we assume that we will have a uint64_t available through
     # one of the above headers or mozstdint.h.
     AC_DEFINE(HAVE_UINT64_T)
 
@@ -8729,37 +8647,31 @@ if test "$MOZ_TREE_CAIRO"; then
                 WIN32_D2D_SURFACE_FEATURE=
             fi
         else
             WIN32_FONT_FEATURE=
             WIN32_DWRITE_FONT_FEATURE=
             WIN32_D2D_SURFACE_FEATURE=
         fi
 
-        AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
+        MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
 
         dnl D3D10 Layers depend on D2D Surfaces.
         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
-          AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
+          MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
         fi
 
     fi
     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
         MOZ_ENABLE_CAIRO_FT=1
         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
     fi
-    if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
-        PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
-        BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
-        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
-        MOZ_ENABLE_CAIRO_FT=1
-    fi
     if test "$USE_FC_FREETYPE"; then
         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
     fi
     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
     AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
@@ -8779,17 +8691,16 @@ if test "$MOZ_TREE_CAIRO"; then
     AC_SUBST(SVG_SURFACE_FEATURE)
     AC_SUBST(XLIB_SURFACE_FEATURE)
     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
     AC_SUBST(QUARTZ_SURFACE_FEATURE)
     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
     AC_SUBST(XCB_SURFACE_FEATURE)
     AC_SUBST(WIN32_SURFACE_FEATURE)
     AC_SUBST(OS2_SURFACE_FEATURE)
-    AC_SUBST(BEOS_SURFACE_FEATURE)
     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
     AC_SUBST(FT_FONT_FEATURE)
     AC_SUBST(FC_FONT_FEATURE)
     AC_SUBST(WIN32_FONT_FEATURE)
     AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
     AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
     AC_SUBST(QUARTZ_FONT_FEATURE)
     AC_SUBST(PNG_FUNCTIONS_FEATURE)
@@ -8953,17 +8864,17 @@ if test "$NECKO_WIFI" -a \
         "$OS_ARCH" != "SunOS" -a \
         "$OS_ARCH" != "WINNT" -a \
         "$OS_ARCH" != "WINCE"; then
   AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
 fi
 
 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
 then
-  AC_CHECK_HEADER([iwlib.h])
+  MOZ_CHECK_HEADER([iwlib.h])
   if test "$ac_cv_header_iwlib_h" != "yes"; then
     AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable])
   fi
 fi
 
 if test "$NECKO_WIFI"; then
   AC_DEFINE(NECKO_WIFI)
 fi
@@ -9081,17 +8992,16 @@ AC_SUBST(MOZ_JSDEBUGGER)
 AC_SUBST(MOZ_PLUGINS)
 AC_SUBST(MOZ_LOG_REFCNT)
 AC_SUBST(MOZ_LEAKY)
 AC_SUBST(MOZ_JPROF)
 AC_SUBST(MOZ_SHARK)
 AC_SUBST(MOZ_CALLGRIND)
 AC_SUBST(MOZ_VTUNE)
 AC_SUBST(MOZ_PROFILING)
-AC_SUBST(MOZ_JSLOADER)
 AC_SUBST(MOZ_USE_NATIVE_UCONV)
 AC_SUBST(MOZ_QUANTIFY)
 AC_SUBST(LIBICONV)
 AC_SUBST(MOZ_PLACES)
 AC_SUBST(MOZ_PLACES_BOOKMARKS)
 AC_SUBST(MOZ_STORAGE)
 AC_SUBST(MOZ_TOOLKIT_SEARCH)
 AC_SUBST(MOZ_FEEDS)
@@ -9111,17 +9021,16 @@ AC_SUBST(HAVE_XIE)
 AC_SUBST(MOZ_XIE_LIBS)
 
 AC_SUBST(BUILD_STATIC_LIBS)
 AC_SUBST(MOZ_ENABLE_LIBXUL)
 AC_SUBST(ENABLE_TESTS)
 AC_SUBST(IBMBIDI)
 AC_SUBST(MOZ_UNIVERSALCHARDET)
 AC_SUBST(ACCESSIBILITY)
-AC_SUBST(MOZ_VIEW_SOURCE)
 AC_SUBST(MOZ_SPELLCHECK)
 AC_SUBST(MOZ_USER_DIR)
 AC_SUBST(MOZ_CRASHREPORTER)
 AC_SUBST(MOZ_UPDATER)
 AC_SUBST(MOZ_ANGLE)
 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
 AC_SUBST(MOZ_D3DX9_VERSION)
@@ -9170,18 +9079,16 @@ AC_SUBST(MOZ_UA_BUILDID)
 AC_SUBST(MOZ_PKG_SPECIAL)
 
 AC_SUBST(MOZILLA_OFFICIAL)
 
 dnl win32 options
 AC_SUBST(MOZ_MAPINFO)
 AC_SUBST(MOZ_BROWSE_INFO)
 AC_SUBST(MOZ_TOOLS_DIR)
-AC_SUBST(CYGWIN_WRAPPER)
-AC_SUBST(AS_PERL)
 AC_SUBST(WIN32_REDIST_DIR)
 AC_SUBST(PYTHON)
 AC_SUBST(MAKENSISU)
 
 AC_SUBST(WINCE)
 AC_SUBST(WINCE_SDK_DIR)
 AC_SUBST(WINCE_WINDOWS_MOBILE)
 
@@ -9374,17 +9281,17 @@ if test "$MOZ_X11"; then
     if test ! -z "$MISSING_X"; then
         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
     fi
 
 fi # MOZ_X11
 
 dnl Check for headers, etc. needed by WebGL.
 if test -n "$MOZ_WEBGL_GLX"; then
-    AC_CHECK_HEADER(GL/glx.h)
+    MOZ_CHECK_HEADER(GL/glx.h)
     if test "$ac_cv_header_GL_glx_h" != "yes"; then
         AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
     fi
 fi # MOZ_WEBGL_GLX
 fi # COMPILE_ENVIRONMENT
 
 if test "$USE_FC_FREETYPE"; then
     if test "$COMPILE_ENVIRONMENT"; then
@@ -9396,19 +9303,17 @@ if test "$USE_FC_FREETYPE"; then
     else
         AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
     fi
 fi
 
 dnl Set various defines and substitutions
 dnl ========================================================
 
-if test "$OS_ARCH" = "BeOS"; then
-  AC_DEFINE(XP_BEOS)
-elif test "$OS_ARCH" = "Darwin"; then
+if test "$OS_ARCH" = "Darwin"; then
   AC_DEFINE(XP_UNIX)
   AC_DEFINE(UNIX_ASYNC_DNS)
 elif test "$OS_ARCH" = "OpenVMS"; then
   AC_DEFINE(XP_UNIX)
 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
   AC_DEFINE(XP_UNIX)
   AC_DEFINE(UNIX_ASYNC_DNS)
 fi
@@ -9424,39 +9329,22 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE
     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
 fi
 
-dnl ========================================================
-dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
-dnl ========================================================
 case "$host_os" in
 mingw*)
     WIN_TOP_SRC=`cd $srcdir; pwd -W`
     ;;
-cygwin*|msvc*|mks*)
-    HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
-    HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-    CC="\$(CYGWIN_WRAPPER) $CC"
-    CXX="\$(CYGWIN_WRAPPER) $CXX"
-    CPP="\$(CYGWIN_WRAPPER) $CPP"
-    LD="\$(CYGWIN_WRAPPER) $LD"
-    AS="\$(CYGWIN_WRAPPER) $AS"
-    RC="\$(CYGWIN_WRAPPER) $RC"
-    MIDL="\$(CYGWIN_WRAPPER) $MIDL"
-    CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
-    WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
-    ;;
 esac
 
-AC_SUBST(CYGDRIVE_MOUNT)
 AC_SUBST(WIN_TOP_SRC)
 
 AC_SUBST(MOZILLA_VERSION)
 
 AC_SUBST(ac_configure_args)
 
 dnl Spit out some output
 dnl ========================================================
@@ -9558,21 +9446,17 @@ dnl If it succeeds, it outputs a shell c
 dnl   for the files it cannot handle correctly. This way, config.status
 dnl   will handle these files.
 dnl If it fails, nothing is set and config.status will run as usual.
 dnl
 dnl This does not change the $MAKEFILES variable.
 dnl
 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
 dnl
-if test -z "${AS_PERL}"; then
 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
-else
-echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
-fi
 . ./conftest.sh
 rm conftest.sh
 
 echo $MAKEFILES > unallmakefiles
 
 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
 
 AC_OUTPUT($MAKEFILES)
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -5499,17 +5499,17 @@ nsContentUtils::WrapNative(JSContext *cx
   if (!native) {
     NS_ASSERTION(!aHolder || !*aHolder, "*aHolder should be null!");
 
     *vp = JSVAL_NULL;
 
     return NS_OK;
   }
 
-  JSObject *wrapper = xpc_GetCachedSlimWrapper(cache, scope, vp);
+  JSObject *wrapper = xpc_FastGetCachedWrapper(cache, scope, vp);
   if (wrapper) {
     return NS_OK;
   }
 
   NS_ENSURE_TRUE(sXPConnect && sThreadJSContextStack, NS_ERROR_UNEXPECTED);
 
   // Keep sXPConnect and sThreadJSContextStack alive. If we're on the main
   // thread then this can be done simply and cheaply by adding a reference to
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -103,17 +103,16 @@
 #include "nsContentCID.h"
 #include "nsDOMError.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsIJSON.h"
 #include "nsThreadUtils.h"
 #include "nsNodeInfoManager.h"
 #include "nsIXBLService.h"
-#include "nsIXPointer.h"
 #include "nsIFileChannel.h"
 #include "nsIMultiPartChannel.h"
 #include "nsIRefreshURI.h"
 #include "nsIWebNavigation.h"
 #include "nsIScriptError.h"
 
 #include "nsNetUtil.h"     // for NS_MakeAbsoluteURI
 
@@ -4643,33 +4642,16 @@ NS_IMETHODIMP
 nsDocument::Load(const nsAString& aUrl, PRBool *aReturn)
 {
   NS_ERROR("nsDocument::Load() should be overriden by subclass!");
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsDocument::EvaluateFIXptr(const nsAString& aExpression, nsIDOMRange **aRange)
-{
-  NS_ERROR("nsDocument::EvaluateFIXptr() should be overriden by subclass!");
-
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsDocument::EvaluateXPointer(const nsAString& aExpression,
-                             nsIXPointerResult **aResult)
-{
-  NS_ERROR("nsDocument::EvaluateXPointer() should be overriden by subclass!");
-
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
 {
   if (!mDOMStyleSheets) {
     mDOMStyleSheets = new nsDOMStyleSheetList(this);
     if (!mDOMStyleSheets) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -628,29 +628,21 @@ nsTextStateManager::ContentRemoved(nsIDo
     nsContentUtils::AddScriptRunner(
         new TextChangeEvent(mWidget, offset, offset + childOffset, offset));
 }
 
 static nsINode* GetRootEditableNode(nsPresContext* aPresContext,
                                     nsIContent* aContent)
 {
   if (aContent) {
-    nsIContent* root = nsnull;
-    nsIContent* content = aContent;
-    while (content && content->IntrinsicState().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
-      root = content;
-      content = content->GetParent();
-    }
-    if (!root) {
-      NS_ASSERTION(content, "We should have a content node here");
-      // See if the document is editable
-      nsIDocument* doc = content->GetCurrentDoc();
-      if (doc && doc->IsEditable()) {
-        return doc;
-      }
+    nsINode* root = nsnull;
+    nsINode* node = aContent;
+    while (node && node->IsEditable()) {
+      root = node;
+      node = node->GetNodeParent();
     }
     return root;
   }
   if (aPresContext) {
     nsIDocument* document = aPresContext->Document();
     if (document && document->IsEditable())
       return document;
   }
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -364,21 +364,16 @@ nsHTMLImageElement::ParseAttribute(PRInt
                                    nsIAtom* aAttribute,
                                    const nsAString& aValue,
                                    nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::align) {
       return ParseAlignValue(aValue, aResult);
     }
-    if (aAttribute == nsGkAtoms::src) {
-      static const char* kWhitespace = " \n\r\t\b";
-      aResult.SetTo(nsContentUtils::TrimCharsInSet(kWhitespace, aValue));
-      return PR_TRUE;
-    }
     if (ParseImageAttribute(aAttribute, aValue, aResult)) {
       return PR_TRUE;
     }
   }
 
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                               aResult);
 }
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -1414,25 +1414,20 @@ PRBool nsHTMLMediaElement::ParseAttribut
     { "",         nsHTMLMediaElement::PRELOAD_ATTR_EMPTY },
     { "none",     nsHTMLMediaElement::PRELOAD_ATTR_NONE },
     { "metadata", nsHTMLMediaElement::PRELOAD_ATTR_METADATA },
     { "auto",     nsHTMLMediaElement::PRELOAD_ATTR_AUTO },
     { 0 }
   };
 
   if (aNamespaceID == kNameSpaceID_None) {
-    if (aAttribute == nsGkAtoms::src) {
-      static const char* kWhitespace = " \n\r\t\b";
-      aResult.SetTo(nsContentUtils::TrimCharsInSet(kWhitespace, aValue));
-      return PR_TRUE;
-    }
-    else if (aAttribute == nsGkAtoms::loopstart
-            || aAttribute == nsGkAtoms::loopend
-            || aAttribute == nsGkAtoms::start
-            || aAttribute == nsGkAtoms::end) {
+    if (aAttribute == nsGkAtoms::loopstart
+       || aAttribute == nsGkAtoms::loopend
+       || aAttribute == nsGkAtoms::start
+       || aAttribute == nsGkAtoms::end) {
       return aResult.ParseFloatValue(aValue);
     }
     else if (ParseImageAttribute(aAttribute, aValue, aResult)) {
       return PR_TRUE;
     }
     else if (aAttribute == nsGkAtoms::preload) {
       return aResult.ParseEnumValue(aValue, kPreloadTable, PR_FALSE);
     }
--- a/content/html/content/src/nsHTMLSourceElement.cpp
+++ b/content/html/content/src/nsHTMLSourceElement.cpp
@@ -63,20 +63,16 @@ public:
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLElement
   NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
 
   // nsIDOMHTMLSourceElement
   NS_DECL_NSIDOMHTMLSOURCEELEMENT
 
-  virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult);
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   // Override BindToTree() so that we can trigger a load when we add a
   // child source element.
   virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
                               nsIContent *aBindingParent,
                               PRBool aCompileEventHandlers);
 
@@ -112,35 +108,16 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLA
 
 
 NS_IMPL_ELEMENT_CLONE(nsHTMLSourceElement)
 
 
 NS_IMPL_URI_ATTR(nsHTMLSourceElement, Src, src)
 NS_IMPL_STRING_ATTR(nsHTMLSourceElement, Type, type)
 
-
-PRBool
-nsHTMLSourceElement::ParseAttribute(PRInt32 aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult)
-{
-  if (aNamespaceID == kNameSpaceID_None) {
-    if (aAttribute == nsGkAtoms::src) {
-      static const char* kWhitespace = " \n\r\t\b";
-      aResult.SetTo(nsContentUtils::TrimCharsInSet(kWhitespace, aValue));
-      return PR_TRUE;
-    }
-  }
-
-  return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
-                                              aResult);
-}
-
 nsresult
 nsHTMLSourceElement::BindToTree(nsIDocument *aDocument,
                                 nsIContent *aParent,
                                 nsIContent *aBindingParent,
                                 PRBool aCompileEventHandlers)
 {
   nsresult rv = nsGenericHTMLElement::BindToTree(aDocument,
                                                  aParent,
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -249,12 +249,13 @@ include $(topsrcdir)/config/rules.mk
 		test_bug615833.html \
 		test_bug601030.html \
 		test_bug610687.html \
 		test_bug618948.html \
 		test_bug623291.html \
 		test_bug619278.html \
 		test_bug622558.html \
 		test_bug622597.html \
+		test_bug636336.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/test_bug636336.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=636336
+-->
+<head>
+  <title>Test for Bug 636336</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=636336">Mozilla Bug 636336</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 636336 **/
+function testIt(tag) {
+  var elem = document.createElement(tag);
+  elem.setAttribute("src", " ");
+  is(elem.getAttribute("src"), " ",
+     tag + " src attribute setter should not strip whitespace");
+  elem.setAttribute("src", " test ");
+  is(elem.getAttribute("src"), " test ",
+     tag + " src attribute setter should not strip whitespace around non-whitespace");
+  is(elem.src, window.location.href.replace(/test_bug636336\.html$/, "test"),
+     tag + ".src should strip whitespace as needed");
+}
+
+testIt("img");
+testIt("source");
+testIt("audio");
+testIt("video");
+</script>
+</pre>
+</body>
+</html>
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -1868,37 +1868,24 @@ nsHTMLDocument::OpenCommon(const nsACStr
 
       if (NS_SUCCEEDED(rv) && !okToUnload) {
         // We don't want to unload, so stop here, but don't throw an
         // exception.
         return NS_OK;
       }
     }
 
-    // Flag us as not being able to start layout until we hit <body>
-    // or scripts that require layout, so that we won't run into FOUC
-    // issues.  We need to do that before making the Stop() call,
-    // since if we have no frame yet the flush Stop() triggers might
-    // try to create one for us, and we don't want our presshell
-    // starting layout if that happens.  But we don't want to do this
-    // before the PermitUnload call above.
-    mMayStartLayout = PR_FALSE;
-
     nsCOMPtr<nsIWebNavigation> webnav(do_QueryInterface(shell));
     webnav->Stop(nsIWebNavigation::STOP_NETWORK);
 
     // The Stop call may have cancelled the onload blocker request or prevented
     // it from getting added, so we need to make sure it gets added to the
     // document again otherwise the document could have a non-zero onload block
     // count without the onload blocker request being in the loadgroup.
     EnsureOnloadBlocker();
-  } else {
-    // See comment before the mMayStartLayout set in the other branch
-    // of this if.
-    mMayStartLayout = PR_FALSE;
   }
 
   // The open occurred after the document finished loading.
   // So we reset the document and create a new one.
   nsCOMPtr<nsIChannel> channel;
   nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
 
   rv = NS_NewChannel(getter_AddRefs(channel), uri, nsnull, group);
--- a/content/xbl/src/nsXBLContentSink.cpp
+++ b/content/xbl/src/nsXBLContentSink.cpp
@@ -286,17 +286,17 @@ nsXBLContentSink::HandleStartElement(con
                                      PRInt32 aIndex, 
                                      PRUint32 aLineNumber)
 {
   nsresult rv = nsXMLContentSink::HandleStartElement(aName,aAtts,aAttsCount,aIndex,aLineNumber);
   if (NS_FAILED(rv))
     return rv;
 
   if (mState == eXBL_InBinding && !mBinding) {
-    rv = ConstructBinding();
+    rv = ConstructBinding(aLineNumber);
     if (NS_FAILED(rv))
       return rv;
     
     // mBinding may still be null, if the binding had no id.  If so,
     // we'll deal with that later in the sink.
   }
 
   return rv;
@@ -550,17 +550,17 @@ nsXBLContentSink::OnOpenContainer(const 
   }
 
   return ret && mState != eXBL_InResources && mState != eXBL_InImplementation;
 }
 
 #undef ENSURE_XBL_STATE
 
 nsresult
-nsXBLContentSink::ConstructBinding()
+nsXBLContentSink::ConstructBinding(PRUint32 aLineNumber)
 {
   nsCOMPtr<nsIContent> binding = GetCurrentContent();
   nsAutoString id;
   binding->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id);
   NS_ConvertUTF16toUTF8 cid(id);
 
   nsresult rv = NS_OK;
   
@@ -576,16 +576,24 @@ nsXBLContentSink::ConstructBinding()
         mFoundFirstBinding = PR_TRUE;
         mDocInfo->SetFirstPrototypeBinding(mBinding);
       }
       binding->UnsetAttr(kNameSpaceID_None, nsGkAtoms::id, PR_FALSE);
     } else {
       delete mBinding;
       mBinding = nsnull;
     }
+  } else {
+    nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
+                                    "MissingIdAttr", nsnull, 0,
+                                    mDocumentURI,
+                                    EmptyString(),
+                                    aLineNumber, 0,
+                                    nsIScriptError::errorFlag,
+                                    "XBL Content Sink");
   }
 
   return rv;
 }
 
 static PRBool
 FindValue(const PRUnichar **aAtts, nsIAtom *aAtom, const PRUnichar **aResult)
 {
--- a/content/xbl/src/nsXBLContentSink.h
+++ b/content/xbl/src/nsXBLContentSink.h
@@ -131,17 +131,17 @@ protected:
 
 #ifdef MOZ_XUL    
     nsresult AddAttributesToXULPrototype(const PRUnichar **aAtts, 
                                          PRUint32 aAttsCount, 
                                          nsXULPrototypeElement* aElement);
 #endif
 
     // Our own helpers for constructing XBL prototype objects.
-    nsresult ConstructBinding();
+    nsresult ConstructBinding(PRUint32 aLineNumber);
     void ConstructHandler(const PRUnichar **aAtts, PRUint32 aLineNumber);
     void ConstructResource(const PRUnichar **aAtts, nsIAtom* aResourceType);
     void ConstructImplementation(const PRUnichar **aAtts);
     void ConstructProperty(const PRUnichar **aAtts);
     void ConstructMethod(const PRUnichar **aAtts);
     void ConstructParameter(const PRUnichar **aAtts);
     void ConstructField(const PRUnichar **aAtts, PRUint32 aLineNumber);
   
--- a/content/xml/document/public/Makefile.in
+++ b/content/xml/document/public/Makefile.in
@@ -40,20 +40,14 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= content
 XPIDL_MODULE	= content_xmldoc
 
-XPIDLSRCS = \
-	nsIFIXptr.idl \
-	nsIXPointer.idl \
-	nsIModifyableXPointer.idl \
-	$(NULL)
-
 EXPORTS		= \
 		nsIXMLContentSink.h \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
deleted file mode 100644
--- a/content/xml/document/public/nsIFIXptr.idl
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Heikki Toivonen <heikki@netscape.com> (original author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-
-interface nsIDOMDocument;
-interface nsIDOMRange;
-
-/**
- * nsIFIXptrEvaluator resolves a FIXptr expression
- */
-[uuid(50D28211-8FB8-4323-B93D-08A6E80E559E)]
-interface nsIFIXptrEvaluator : nsISupports
-{
-  /**
-   * Evaluate a FIXptr expression.
-   *
-   * @param aDocument   The document in which to evaluate.
-   * @param aExpression The FIXptr expression string to evaluate.
-   * @return            The result.
-   */
-  nsIDOMRange evaluate(in nsIDOMDocument aDocument,
-                       in DOMString aExpression);
-};
deleted file mode 100644
--- a/content/xml/document/public/nsIModifyableXPointer.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Heikki Toivonen <heikki@netscape.com> (original author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/**
- * Modifyable interfaces for XPointer.
- *
- */
-
-#include "nsIXPointer.idl"
-
-interface nsIDOMRange;
-
-/**
- * Helper interface that can assist in creating an nsIXPointerResult.
- */
-[uuid(2DC3BE2E-642D-4d7e-B3C5-F3DAC51AFBEE)]
-interface nsIModifyableXPointerResult : nsIXPointerResult
-{
-  void appendRange(in nsIDOMRange aRange);
-};
deleted file mode 100644
--- a/content/xml/document/public/nsIXPointer.idl
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Heikki Toivonen <heikki@netscape.com> (original author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-
-interface nsIDOMRange;
-interface nsIDOMDocument;
-
-/**
- * XXX A good XPointerResult would probably mimic XPathresult,
- *     this range list is just the minimum that will be able to represent
- *     all return values, although it would be more user friendly to return
- *     nodes and node lists when they are possible.
- */
-[scriptable, uuid(D3992637-F474-4b65-83ED-323FE69C60D2)]
-interface nsIXPointerResult : nsISupports
-{
-  nsIDOMRange                             item(in unsigned long index);
-  readonly attribute unsigned long        length;
-};
-
-
-/**
- * Scheme context for nsIXPointerSchemeProcessor. The context consists of
- * all the scheme/data pairs that precede the scheme/data that the
- * nsIXPointerSchemeProcessor is currently evaluating.
- */
-[uuid(781F4AA1-EBB3-4667-B1C2-2B35E94C4281)]
-interface nsIXPointerSchemeContext : nsISupports
-{
-  readonly attribute unsigned long count;
-  void getSchemeData(in unsigned long index,
-                     out DOMString scheme,
-                     out DOMString data);
-};
-
-%{C++
-/**
- * nsIXPointerSchemeProcessor implementations must be registered with the below
- * progid, appended with the scheme name that the processor implements.
- */
-#define NS_XPOINTER_SCHEME_PROCESSOR_BASE "@mozilla.org/xml/xpointer;1?scheme="
-%}
-
-/**
- * nsIXPointerSchemeProcessors will be called by the XPointer Processor that
- * implements the XPointer Framework. This is done for each scheme the
- * XPointer Processor finds, in left-to-right order.
- */
-[uuid(093D3559-B56B-44d0-8764-C25815715080)]
-interface nsIXPointerSchemeProcessor : nsISupports
-{
-  /**
-   * Evaluate.
-   *
-   * @param aDocument The document in which to resolve the XPointer.
-   * @param aContext  The XPointer context in which to process aData.
-   * @param aData     The data in the scheme that needs to be resolved.
-   * @return          The result of the evaluation.
-   */
-  nsIXPointerResult evaluate(in nsIDOMDocument aDocument,
-                             in nsIXPointerSchemeContext aContext,
-                             in DOMString aData);
-};
-
-/**
- * nsIXPointerEvaluator resolves an XPointer expression
- */
-[uuid(ADDD0FE5-8555-45b7-B763-97D5898CE268)]
-interface nsIXPointerEvaluator : nsISupports
-{
-  /**
-   * Evaluate an XPointer expression.
-   *
-   * @param aDocument   The document in which to evaluate.
-   * @param aExpression The XPointer expression string to evaluate.
-   * @return            The result.
-   */
-  nsIXPointerResult evaluate(in nsIDOMDocument aDocument,
-                             in DOMString aExpression);
-
-};
--- a/content/xml/document/src/nsXMLDocument.cpp
+++ b/content/xml/document/src/nsXMLDocument.cpp
@@ -65,18 +65,16 @@
 #include "nsICharsetAlias.h"
 #include "nsNetUtil.h"
 #include "nsDOMError.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrincipal.h"
 #include "nsLayoutCID.h"
 #include "nsDOMAttribute.h"
 #include "nsGUIEvent.h"
-#include "nsIFIXptr.h"
-#include "nsIXPointer.h"
 #include "nsCExternalHandlerService.h"
 #include "nsNetUtil.h"
 #include "nsMimeTypes.h"
 #include "nsIEventListenerManager.h"
 #include "nsContentUtils.h"
 #include "nsThreadUtils.h"
 #include "nsJSUtils.h"
 #include "nsCRT.h"
@@ -277,39 +275,16 @@ nsXMLDocument::ResetToURI(nsIURI *aURI, 
     mChannel->Cancel(NS_BINDING_ABORTED);
     mChannelIsPending = nsnull;
   }
 
   nsDocument::ResetToURI(aURI, aLoadGroup, aPrincipal);
 }
 
 NS_IMETHODIMP
-nsXMLDocument::EvaluateFIXptr(const nsAString& aExpression, nsIDOMRange **aRange)
-{
-  nsresult rv;
-  nsCOMPtr<nsIFIXptrEvaluator> e =
-    do_CreateInstance("@mozilla.org/xmlextras/fixptrevaluator;1", &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  return e->Evaluate(this, aExpression, aRange);
-}
-
-NS_IMETHODIMP
-nsXMLDocument::EvaluateXPointer(const nsAString& aExpression,
-                                nsIXPointerResult **aResult)
-{
-  nsresult rv;
-  nsCOMPtr<nsIXPointerEvaluator> e =
-    do_CreateInstance("@mozilla.org/xmlextras/xpointerevaluator;1", &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-  
-  return e->Evaluate(this, aExpression, aResult);
-}
-
-NS_IMETHODIMP
 nsXMLDocument::GetAsync(PRBool *aAsync)
 {
   NS_ENSURE_ARG_POINTER(aAsync);
   *aAsync = mAsync;
   return NS_OK;
 }
 
 NS_IMETHODIMP
deleted file mode 100644
--- a/content/xml/tests/xpointer/xpointer.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE doc [
-<!ATTLIST mylink1
-          xlink:type CDATA "simple"
->
-<!ATTLIST p id ID #IMPLIED>
-<!ATTLIST div id ID #IMPLIED>
-]>
-<doc xmlns:xlink="http://www.w3.org/1999/xlink"
-    xmlns:html="http://www.w3.org/1999/xhtml">
-  <html:style type="text/css">
-    div {display: block; padding-left: +1em;}
-    p {display: block; padding-left: +1em;}
-    mylink1 {display: inline; color:blue; padding-left: +1em;}
-  </html:style>
-<!--  <html:h1>XPointer testcase</html:h1>-->
-  <div id="id1">
-    <p>First para in div="id1"</p>
-    <div>
-      <p>First para in div with no id</p>
-      <p id="id2">Second para in div with id=id2</p>
-    </div>
-    <p>Second para in div="id1"</p>
-    <p id="id3">Third para in div="id1", the ID of this element is id3.</p>
-    <html:h2><html:span>XHTML</html:span> h2 element</html:h2>
-    <html:h3>XHTML h3 element</html:h3>
-    <p>Foobar</p>
-    <html:h3>XHTML h3 element too</html:h3>
-  </div>
-  <mylink1 xlink:href="#id1">id1 - div=id1</mylink1><html:button onclick="xp('id1', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href="#element(id2)">element(id2) - Second para</mylink1><html:button onclick="xp('element(id2)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href="#element(id1/2/1)">element(id1/2/1) - First para in second div</mylink1><html:button onclick="xp('element(id1/2/1)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href="#element(/1/2)">element(/1/2) - div=id1</mylink1><html:button onclick="xp('element(/1/2)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#xpath1(id("id3"))'>xpath1(id("id3")) - p=id3</mylink1><html:button onclick='xp("xpath1(id(\"id3\"))", event)'>JS</html:button><html:br/>
-  <mylink1 xlink:href='#foobar(id("id3"))'>foobar(id("id3")) - ???</mylink1><html:button onclick='xp("foobar(id(\"id3\"))", event)'>JS</html:button><html:br/>
-  <mylink1 xlink:href='#element(nothere)'>element(nothere) - ???</mylink1><html:button onclick="xp('element(nothere)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#xmlns(foo=http://www.w3.org/1999/xhtml) xpath1(//foo:h2//foo:span)'>xmlns(foo=http://www.w3.org/1999/xhtml) xpath1(//foo:h2//foo:span) - span inside h2</mylink1><html:button onclick="xp('xmlns(foo=http://www.w3.org/1999/xhtml) xpath1(//foo:h2//foo:span)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#xmlns(foo=http://www.w3.org/1999/xhtml) xpath1(//foo:h3)'>xmlns(foo=http://www.w3.org/1999/xhtml) xpath1(//foo:h3) - h3 elements</mylink1><html:button onclick="xp('xmlns(foo=http://www.w3.org/1999/xhtml) xpath1(//foo:h3)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#xpath1(//html:h2)'>xpath1(//html:h2) - ???</mylink1><html:button onclick='xp("xpath1(//html:h2)", event)'>JS</html:button><html:br/>
-  <mylink1 xlink:href='#foobar(^^foo^))'>foobar(^^foo^)) - ???</mylink1><html:button onclick="xp('foobar(^^foo^))', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#foobar(^foo)'>foobar(^foo) - ??? [error]</mylink1><html:button onclick="xp('foobar(^foo)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#foobar()'>foobar() - ???</mylink1><html:button onclick="xp('foobar()', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#foo bar(foo)'>foo bar(foo) - ??? [error]</mylink1><html:button onclick="xp('foo bar(foo)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#foobar((foo)'>foobar((foo) - ??? [error]</mylink1><html:button onclick="xp('foobar((foo)', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#foobar)(foo'>foobar)(foo - ??? [error]</mylink1><html:button onclick="xp('foobar)(foo', event)">JS</html:button><html:br/>
-  <mylink1 xlink:href='#xpath1(//foo:h3)'>xpath1(//foo:h3) - ???</mylink1><html:button onclick="xp('xpath1(//foo:h3)', event)">JS</html:button><html:br/>
-
-<html:script type="text/javascript">
-<![CDATA[
-function xp(str, event)
-{
-  var elem = document.createElementNS("http://www.w3.org/1999/xhtml", "html:span");
-  elem.setAttribute("style", "color: red;");
-
-  try {
-    var result = document.evaluateXPointer(str);
-    if (result) {
-      var count = result.length;
-      var i;
-      for (i = 0; i < count; i++) {
-        var range = result.item(i);
-        var text = document.createTextNode(range.toString());
-        elem.appendChild(text);
-      }
-    } else {
-      var text = document.createTextNode("@@no result@@");
-      elem.appendChild(text);
-    }
-
-    event.target.parentNode.insertBefore(elem, event.target.nextSibling);
-  } catch (e) {
-    var text = document.createTextNode(e.toString());
-    elem.appendChild(text);
-    event.target.parentNode.insertBefore(elem, event.target.nextSibling);
-  }
-}
-]]>
-</html:script>
-</doc>
--- a/content/xslt/src/xpath/Makefile.in
+++ b/content/xslt/src/xpath/Makefile.in
@@ -80,17 +80,16 @@ CPPSRCS = \
         txUnaryExpr.cpp \
         txVariableRefExpr.cpp \
         txXPathOptimizer.cpp
 ifndef MOZ_XSLT_STANDALONE
 CPPSRCS += nsXPathEvaluator.cpp \
            nsXPathExpression.cpp \
            nsXPathNSResolver.cpp \
            nsXPathResult.cpp \
-           nsXPath1Scheme.cpp \
            txMozillaXPathTreeWalker.cpp \
            txNodeSetAdaptor.cpp \
            txXPCOMExtensionFunction.cpp
 else
 CPPSRCS += txStandaloneXPathTreeWalker.cpp
 endif
 
 # we don't want the shared lib, but we want to force the creation of a
deleted file mode 100644
--- a/content/xslt/src/xpath/nsXPath1Scheme.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is TransforMiiX XSLT processor code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Heikki Toivonen <heikki@netscape.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/**
- * This file implements the xpath1 XPointer scheme, and the xmlns scheme
- * as well but only for xpath1.
- *
- * http://www.simonstl.com/ietf/draft-stlaurent-xpath-frag-00.html
- */
-
-#include "nsXPath1Scheme.h"
-#include "nsXPathEvaluator.h"
-#include "nsDOMError.h"
-#include "nsXPathResult.h"
-#include "nsIDOMNode.h"
-#include "nsIDOMDocument.h"
-#include "nsIDOMXPathNSResolver.h"
-#include "nsIDOMRange.h"
-#include "nsDOMString.h"
-#include "nsIModifyableXPointer.h"
-#include "nsAutoPtr.h"
-#include "nsString.h"
-#include "nsIComponentManager.h"
-
-#include "nsContentCID.h"
-static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
-
-/**
- * nsXPath1SchemeNSResolver
- *
- * This will effectively give us xmlns scheme support.
- */
-class nsXPath1SchemeNSResolver : public nsIDOMXPathNSResolver
-{
-public:
-  nsXPath1SchemeNSResolver(nsIXPointerSchemeContext *aContext)
-    : mContext(aContext)
-  {
-  }
-  
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMXPATHNSRESOLVER
-
-private:
-  nsCOMPtr<nsIXPointerSchemeContext> mContext;
-};
-
-NS_IMPL_ISUPPORTS1(nsXPath1SchemeNSResolver, nsIDOMXPathNSResolver)
-
-//DOMString          lookupNamespaceURI(in DOMString prefix);
-NS_IMETHODIMP
-nsXPath1SchemeNSResolver::LookupNamespaceURI(const nsAString &aPrefix,
-                                             nsAString &aURI)
-{
-  aURI.Truncate();
-
-  // This method will be called each time the XPath engine encounters
-  // a prefix.
-  
-  // We could cache the extracted prefix + URI pairs in a hash table,
-  // and do a lookup from that first. But typical XPointers only have
-  // a few scheme + data pairs (and only some of those will be xmlns
-  // schemes), and typical XPath expressions only have a few prefixes
-  // as well, so we'll see if we can manage without...
-
-  if (!mContext) {
-    return NS_OK;
-  }
-
-  NS_NAMED_LITERAL_STRING(xmlns, "xmlns");
-
-  PRUint32 count;
-  mContext->GetCount(&count);
-  PRUint32 i;
-  for (i = 0; i < count; ++i) {
-    nsAutoString scheme, data;
-    mContext->GetSchemeData(i, scheme, data);
-    if (scheme.Equals(xmlns)) {
-      PRInt32 sep = data.FindChar('=');
-      if (sep > 0 && aPrefix.Equals(StringHead(data, sep))) {
-        aURI.Assign(Substring(data, sep + 1, data.Length() - sep - 1));
-        return NS_OK;
-      }
-    }
-  }
-
-  SetDOMStringToNull(aURI);
-
-  return NS_OK;
-}
-
-// nsXPath1SchemeProcessor
-NS_IMPL_ISUPPORTS1(nsXPath1SchemeProcessor, nsIXPointerSchemeProcessor)
-
-/**
- * Evaluate.
- *
- * @param aDocument The document in which to resolve the XPointer.
- * @param aContext  The XPointer context in which to process aData.
- * @param aData     The data in the scheme that needs to be resolved.
- * @return          The result of the evaluation.
- */
-NS_IMETHODIMP
-nsXPath1SchemeProcessor::Evaluate(nsIDOMDocument *aDocument,
-                         nsIXPointerSchemeContext *aContext,
-                         const nsAString &aData,
-                         nsIXPointerResult **aResult)
-{
-  NS_ENSURE_ARG_POINTER(aDocument);
-  NS_ENSURE_ARG_POINTER(aContext);
-  NS_ENSURE_ARG_POINTER(aResult);
-  *aResult = nsnull;
- 
-  // Resolve expression
-  nsCOMPtr<nsIDOMXPathNSResolver> nsresolver(new nsXPath1SchemeNSResolver(aContext));
-  if (!nsresolver) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-  nsRefPtr<nsXPathEvaluator> e(new nsXPathEvaluator(nsnull));
-  if (!e) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  nsresult rv = e->Init();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMXPathResult> result;
-  rv = e->Evaluate(aData,
-                   aDocument,
-                   nsresolver,
-                   nsIDOMXPathResult::ORDERED_NODE_ITERATOR_TYPE,
-                   nsnull,
-                   getter_AddRefs(result));
-  if (NS_FAILED(rv)) {
-    if ((rv == NS_ERROR_DOM_INVALID_EXPRESSION_ERR) ||
-        (rv == NS_ERROR_DOM_NAMESPACE_ERR) ||
-        (rv == NS_ERROR_DOM_TYPE_ERR)) {
-      // These errors are benign, change them to NS_OK so that
-      // we will not terminate the processor.
-      rv = NS_OK;
-    }
-    return rv;
-  }
-
-  // Create return result
-  // XXX perf: just store the XPathResult and resolve as XPointerResult on demand
-  nsCOMPtr<nsIXPointerResult> xpointerResult(
-    do_CreateInstance("@mozilla.org/xmlextras/xpointerresult;1", &rv));
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  nsCOMPtr<nsIModifyableXPointerResult> privatePointerResult(do_QueryInterface(xpointerResult));
-  if (!privatePointerResult) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsIDOMNode> node;
-  rv = result->IterateNext(getter_AddRefs(node));
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
-  // Fill in return result
-  while (node) {
-    nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID, &rv));
-    if (NS_FAILED(rv))
-      break;
-
-    rv = range->SelectNode(node);
-    if (NS_FAILED(rv))
-      break;
-
-    rv = privatePointerResult->AppendRange(range);
-    if (NS_FAILED(rv))
-      break;
-
-    rv = result->IterateNext(getter_AddRefs(node));
-    if (NS_FAILED(rv))
-      break;
-  }
-
-  PRUint32 count;
-  xpointerResult->GetLength(&count);
-  if (NS_SUCCEEDED(rv) && (count > 0)) {
-    *aResult = xpointerResult;
-    NS_ADDREF(*aResult);
-  }
-
-  return rv;
-}
deleted file mode 100644
--- a/content/xslt/src/xpath/nsXPath1Scheme.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is TransforMiiX XSLT processor code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Heikki Toivonen <heikki@netscape.com> (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/**
- * This file implements the xpath1 XPointer scheme.
- */
-
-#ifndef __nsXPath1Scheme_h__
-#define __nsXPath1Scheme_h__
-
-#include "nsIXPointer.h"
-
-class nsXPath1SchemeProcessor : public nsIXPointerSchemeProcessor
-{
-public:
-  NS_DECL_ISUPPORTS
-
-  NS_DECL_NSIXPOINTERSCHEMEPROCESSOR
-};
-
-#endif
--- a/db/mork/src/morkConfig.h
+++ b/db/mork/src/morkConfig.h
@@ -63,23 +63,19 @@
 #ifdef XP_WIN
 #define MORK_WIN 1
 #endif
 
 #ifdef XP_UNIX
 #define MORK_UNIX 1
 #endif
 
-#ifdef XP_BEOS
-#define MORK_BEOS 1
-#endif
-
 // } %%%%% end platform defs peculiar to Mork %%%%%
 
-#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_BEOS) || defined(MORK_OS2)
+#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_OS2)
 #include <stdio.h> 
 #include <ctype.h> 
 #include <errno.h> 
 #include <string.h> 
 #ifdef HAVE_MEMORY_H
 #include <memory.h> 
 #endif
 #ifdef HAVE_UNISTD_H
@@ -138,35 +134,35 @@ FILE* mork_fileopen(const char* name, co
 #if defined(MORK_MAC)
 #  define mork_kNewline             "\015"
 #  define mork_kNewlineSize 1
 #else
 #  if defined(MORK_WIN) || defined(MORK_OS2)
 #    define mork_kNewline           "\015\012"
 #    define mork_kNewlineSize       2
 #  else
-#    if defined(MORK_UNIX) || defined(MORK_BEOS)
+#    if defined(MORK_UNIX)
 #      define mork_kNewline         "\012"
 #      define mork_kNewlineSize     1
-#    endif /* MORK_UNIX || MORK_BEOS */
+#    endif /* MORK_UNIX */
 #  endif /* MORK_WIN */
 #endif /* MORK_MAC */
 
 // { %%%%% begin assertion macro %%%%%
 extern void mork_assertion_signal(const char* inMessage);
 #define MORK_ASSERTION_SIGNAL(Y) mork_assertion_signal(Y)
 #define MORK_ASSERT(X) if (!(X)) MORK_ASSERTION_SIGNAL(#X)
 // } %%%%% end assertion macro %%%%%
 
 #define MORK_LIB(return) return /*API return declaration*/
 #define MORK_LIB_IMPL(return) return /*implementation return declaration*/
 
 // { %%%%% begin standard c utility methods %%%%%
 
-#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_BEOS) || defined(MORK_OS2)
+#if defined(MORK_WIN) || defined(MORK_UNIX) || defined(MORK_MAC) || defined(MORK_OS2)
 #define MORK_USE_C_STDLIB 1
 #endif /*MORK_WIN*/
 
 #ifdef MORK_USE_C_STDLIB
 #define MORK_MEMCMP(src1,src2,size)  memcmp(src1,src2,size)
 #define MORK_MEMCPY(dest,src,size)   memcpy(dest,src,size)
 #define MORK_MEMMOVE(dest,src,size)  memmove(dest,src,size)
 #define MORK_MEMSET(dest,byte,size)  memset(dest,byte,size)
--- a/db/mork/src/morkFile.cpp
+++ b/db/mork/src/morkFile.cpp
@@ -256,21 +256,21 @@ morkFile::NewFileErrnoError(morkEnv* ev)
        "\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015";
 #      define morkFile_kNewlinesCount 16
 #else
 #  if defined(MORK_WIN) || defined(MORK_OS2)
        static const char morkFile_kNewlines[] = 
        "\015\012\015\012\015\012\015\012\015\012\015\012\015\012\015\012";
 #    define morkFile_kNewlinesCount 8
 #  else
-#    if defined(MORK_UNIX) || defined(MORK_BEOS)
+#    ifdef MORK_UNIX
        static const char morkFile_kNewlines[] = 
        "\012\012\012\012\012\012\012\012\012\012\012\012\012\012\012\012";
 #      define morkFile_kNewlinesCount 16
-#    endif /* MORK_UNIX || MORK_BEOS */
+#    endif /* MORK_UNIX */
 #  endif /* MORK_WIN */
 #endif /* MORK_MAC */
 
 mork_size
 morkFile::WriteNewlines(morkEnv* ev, mork_count inNewlines)
   // WriteNewlines() returns the number of bytes written.
 {
   mork_size outSize = 0;
--- a/db/mork/src/morkStream.cpp
+++ b/db/mork/src/morkStream.cpp
@@ -322,22 +322,22 @@ morkStream::PutLineBreak(morkEnv* ev)
 #else
 #  if defined(MORK_WIN) || defined(MORK_OS2)
   
   this->Putc(ev, mork_kCR);
   this->Putc(ev, mork_kLF);
   return 2;
   
 #  else
-#    if defined(MORK_UNIX) || defined(MORK_BEOS)
+#    ifdef MORK_UNIX
   
   this->Putc(ev, mork_kLF);
   return 1;
   
-#    endif /* MORK_UNIX || MORK_BEOS */
+#    endif /* MORK_UNIX */
 #  endif /* MORK_WIN */
 #endif /* MORK_MAC */
 }
 // ````` ````` ````` `````   ````` ````` ````` `````  
 // public: // virtual morkFile methods
 
 
 NS_IMETHODIMP
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -602,17 +602,17 @@ nsresult nsDefaultURIFixup::ConvertFileT
 
 #if defined(XP_WIN) || defined(XP_OS2)
     // Check for \ in the url-string or just a drive (PC)
     if(kNotFound != aIn.FindChar('\\') ||
        (aIn.Length() == 2 && (aIn.Last() == ':' || aIn.Last() == '|')))
     {
         attemptFixup = PR_TRUE;
     }
-#elif defined(XP_UNIX) || defined(XP_BEOS)
+#elif defined(XP_UNIX)
     // Check if it starts with / (UNIX)
     if(aIn.First() == '/')
     {
         attemptFixup = PR_TRUE;
     }
 #else
     // Do nothing (All others for now) 
 #endif
--- a/docshell/test/Makefile.in
+++ b/docshell/test/Makefile.in
@@ -88,18 +88,20 @@ include $(topsrcdir)/config/rules.mk
 		test_bug540462.html \
 		file_bug540462.html \
 		test_bug580069.html \
 		file_bug580069_1.html \
 		file_bug580069_2.sjs \
 		test_bug590573.html \
 		file_bug590573_1.html \
 		file_bug590573_2.html \
+		test_bug598895.html \
 		test_bug634834.html \
 		file_bug634834.html \
+		test_bug637644.html \
 		$(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 _TEST_FILES += \
 		test_bug511449.html \
 		file_bug511449.html \
 		$(NULL)
 endif
new file mode 100644
--- /dev/null
+++ b/docshell/test/test_bug598895.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=598895
+-->
+<head>
+  <title>Test for Bug 598895</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=598895">Mozilla Bug 598895</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 598895 **/
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(function() {
+var win1 = window.open();
+win1.document.body.textContent = "Should show";
+
+var windowsLoaded = 0;
+
+window.onmessage = function (ev) {
+  is(ev.data, "loaded", "Message should be 'loaded'");
+  if (++windowsLoaded == 2) {
+    var one = snapshotWindow(win1);
+    var two = snapshotWindow(win2);
+    var three = snapshotWindow(win3);
+    win1.close();
+    win2.close();
+    win3.close();
+    ok(compareSnapshots(one, two, true)[0], "Popups should look identical");
+    ok(compareSnapshots(one, three, false)[0], "Popups should not look identical");
+
+    SimpleTest.finish();
+  }
+}
+
+var win2 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body>Should show</body>");
+
+var win3 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body></body>");
+});
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/docshell/test/test_bug637644.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=637644
+-->
+<head>
+  <title>Test for Bug 637644</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=637644">Mozilla Bug 637644</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 637644 **/
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(function() {
+var win1 = window.open("", "", "height=500,width=500");
+win1.document.body.textContent = "Should show";
+
+var windowsLoaded = 0;
+
+window.onmessage = function (ev) {
+  is(ev.data, "loaded", "Message should be 'loaded'");
+  if (++windowsLoaded == 2) {
+    var one = snapshotWindow(win1);
+    var two = snapshotWindow(win2);
+    var three = snapshotWindow(win3);
+    win1.close();
+    win2.close();
+    win3.close();
+    ok(compareSnapshots(one, two, true)[0], "Popups should look identical");
+    ok(compareSnapshots(one, three, false)[0], "Popups should not look identical");
+
+    SimpleTest.finish();
+  }
+}
+
+var win2 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body>Should show</body>", "", "height=500,width=500");
+
+var win3 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body></body>", "", "height=500,width=500");
+});
+</script>
+</pre>
+</body>
+</html>
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -4260,17 +4260,17 @@ nsDOMClassInfo::WrapNative(JSContext *cx
   if (!native) {
     NS_ASSERTION(!aHolder || !*aHolder, "*aHolder should be null!");
 
     *vp = JSVAL_NULL;
 
     return NS_OK;
   }
 
-  JSObject *wrapper = xpc_GetCachedSlimWrapper(cache, scope, vp);
+  JSObject *wrapper = xpc_FastGetCachedWrapper(cache, scope, vp);
   if (wrapper) {
     return NS_OK;
   }
 
   return sXPConnect->WrapNativeToJSVal(cx, scope, native, cache, aIID,
                                        aAllowWrapping, vp, aHolder);
 }
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1607,16 +1607,26 @@ nsGlobalWindow::SetOpenerScriptPrincipal
     NS_ASSERTION(uri && IsAboutBlank(uri) &&
                  IsAboutBlank(mDoc->GetDocumentURI()),
                  "Unexpected original document");
 #endif
 
     nsCOMPtr<nsIDocShell_MOZILLA_2_0_BRANCH> ds(do_QueryInterface(GetDocShell()));
     ds->CreateAboutBlankContentViewer(aPrincipal);
     mDoc->SetIsInitialDocument(PR_TRUE);
+
+    nsCOMPtr<nsIPresShell> shell;
+    GetDocShell()->GetPresShell(getter_AddRefs(shell));
+
+    if (shell && !shell->DidInitialReflow()) {
+      // Ensure that if someone plays with this document they will get
+      // layout happening.
+      nsRect r = shell->GetPresContext()->GetVisibleArea();
+      shell->InitialReflow(r.width, r.height);
+    }
   }
 }
 
 nsIPrincipal*
 nsGlobalWindow::GetOpenerScriptPrincipal()
 {
   FORWARD_TO_OUTER(GetOpenerScriptPrincipal, (), nsnull);
 
--- a/dom/interfaces/core/nsIDOMXMLDocument.idl
+++ b/dom/interfaces/core/nsIDOMXMLDocument.idl
@@ -33,19 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMDocument.idl"
 
-interface nsIXPointerResult;
-
-[scriptable, uuid(8816d003-e7c8-4065-8827-829b8d07b6e0)]
+[scriptable, uuid(0aa12c21-4710-4214-b21e-372c48332927)]
 interface nsIDOMXMLDocument : nsIDOMDocument
 {
   // DOM Level 3 Load & Save, DocumentLS
   // http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS
   /**
    * Whether to load synchronously or asynchronously.
    * The default is async==true.
    */
@@ -53,24 +51,9 @@ interface nsIDOMXMLDocument : nsIDOMDocu
  
   /**
    * Load an XML document.
    *
    * @param  url URL to an XML document.
    * @return     True if load successfull.
    */
   boolean                      load(in DOMString url);
-
- /**
-  * Evaluate FIXptr expression. FIXptr is a W3C NOTE, see
-  *
-  * http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm
-  *
-  * @param  expression FIXptr string.
-  * @return            The range object that results from evaluation
-  */
-  nsIDOMRange               evaluateFIXptr(in DOMString expression);
-
- /**
-  * Evaluate XPointer expression.
-  */
-  nsIXPointerResult evaluateXPointer(in DOMString expression);
 };
--- a/dom/ipc/Makefile.in
+++ b/dom/ipc/Makefile.in
@@ -79,27 +79,27 @@ CPPSRCS = \
   TabMessageUtils.cpp \
   $(NULL)
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
-		-I$(srcdir)/../../content/base/src \
-		-I$(srcdir)/../../content/events/src \
-		-I$(srcdir)/../../toolkit/components/places/src \
-		-I$(topsrcdir)/chrome/src \
-		-I$(topsrcdir)/uriloader/exthandler \
-		-I$(srcdir)/../../netwerk/base/src \
-		-I$(srcdir)/../src/base \
-		-I$(srcdir)/../src/storage \
-		-I$(srcdir)/../../xpcom/base \
-		-I$(topsrcdir)/extensions/cookie \
-		$(NULL)
+	-I$(srcdir)/../../content/base/src \
+	-I$(srcdir)/../../content/events/src \
+	-I$(srcdir)/../../toolkit/components/places \
+	-I$(topsrcdir)/chrome/src \
+	-I$(topsrcdir)/uriloader/exthandler \
+	-I$(srcdir)/../../netwerk/base/src \
+	-I$(srcdir)/../src/base \
+	-I$(srcdir)/../src/storage \
+	-I$(srcdir)/../../xpcom/base \
+	-I$(topsrcdir)/extensions/cookie \
+	$(NULL)
 
 DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'
 
 ifdef MOZ_PERMISSIONS
 DEFINES += -DMOZ_PERMISSIONS
 endif
 
 CXXFLAGS += $(TK_CFLAGS)
--- a/dom/locales/en-US/chrome/layout/xbl.properties
+++ b/dom/locales/en-US/chrome/layout/xbl.properties
@@ -38,8 +38,9 @@ UnexpectedElement=Unexpected <%1$S> elem
 GTK2Conflict=Key event not available on GTK2: key="%S" modifiers="%S"
 WinConflict=Key event not available on some keyboard layouts: key="%S" modifiers="%S"
 TooDeepBindingRecursion=The XBL binding "%S" is already used by too many ancestor elements; not applying it to prevent infinite recursion.
 CircularExtendsBinding=Extending the XBL binding "%S" with "%S" would lead to it extending itself
 # LOCALIZATION NOTE: do not localize <handler command="…">
 CommandNotInChrome=Use of <handler command="…"> not allowed outside chrome.
 MalformedXBL = An XBL file is malformed. Did you forget the XBL namespace on the bindings tag?
 InvalidExtendsBinding=Extending "%S" is invalid. In general, do not extend tag names.
+MissingIdAttr = An "id" attribute missing on the binding tag.
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -3983,17 +3983,17 @@ nsCOMPtr<nsIDOMNode> nsHTMLEditor::FindU
   return resultNode;
 }
 
 NS_IMETHODIMP_(PRBool)
 nsHTMLEditor::IsModifiableNode(nsIDOMNode *aNode)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
 
-  return !content || !content->IntrinsicState().HasState(NS_EVENT_STATE_MOZ_READONLY);
+  return !content || content->IsEditable();
 }
 
 static nsresult SetSelectionAroundHeadChildren(nsCOMPtr<nsISelection> aSelection, nsWeakPtr aDocWeak)
 {
   nsresult res = NS_OK;
   // Set selection around <head> node
   nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(aDocWeak);
   NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
--- a/embedding/components/printingui/src/Makefile.in
+++ b/embedding/components/printingui/src/Makefile.in
@@ -56,11 +56,8 @@ endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 PLATFORM_DIR = mac
 endif
 
 DIRS = $(PLATFORM_DIR)
 
 include $(topsrcdir)/config/rules.mk
-
-libs::
-	$(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)printingui_s.$(LIB_SUFFIX) $(wildcard $(PLATFORM_DIR)/$(LIB_PREFIX)printingui_s.$(LIB_SUFFIX).fake) .
--- a/embedding/components/printingui/src/mac/Makefile.in
+++ b/embedding/components/printingui/src/mac/Makefile.in
@@ -39,16 +39,17 @@ DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= embedcomponents
 LIBRARY_NAME	= printingui_s
+EXPORT_LIBRARY	= ..
 LIBXUL_LIBRARY	= 1
 
 
 
 CMMSRCS = nsPrintingPromptServiceX.mm
 
 CPPSRCS		= \
       nsPrintProgressParams.cpp \
--- a/embedding/components/printingui/src/os2/Makefile.in
+++ b/embedding/components/printingui/src/os2/Makefile.in
@@ -39,16 +39,17 @@ DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= embedcomponents
 LIBRARY_NAME	= printingui_s
+EXPORT_LIBRARY	= ..
 LIBXUL_LIBRARY	= 1
 
 
 CPPSRCS		= \
       nsPrintingPromptService.cpp \
       nsPrintProgressParams.cpp \
       nsPrintProgress.cpp \
       $(NULL)
--- a/embedding/components/printingui/src/unixshared/Makefile.in
+++ b/embedding/components/printingui/src/unixshared/Makefile.in
@@ -39,16 +39,17 @@ DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= embedcomponents
 LIBRARY_NAME	= printingui_s
+EXPORT_LIBRARY	= ..
 LIBXUL_LIBRARY	= 1
 
 
 CPPSRCS		= \
       nsPrintingPromptService.cpp \
       nsPrintProgressParams.cpp \
       nsPrintProgress.cpp \
       $(NULL)
--- a/embedding/components/printingui/src/win/Makefile.in
+++ b/embedding/components/printingui/src/win/Makefile.in
@@ -39,16 +39,17 @@ DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= embedcomponents
 LIBRARY_NAME	= printingui_s
+EXPORT_LIBRARY	= ..
 LIBXUL_LIBRARY	= 1
 
 
 CPPSRCS		= \
       nsPrintingPromptService.cpp \
       nsPrintProgressParams.cpp \
       nsPrintProgress.cpp \
       nsPrintDialogUtil.cpp \
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -1153,19 +1153,19 @@ mozInlineSpellChecker::SkipSpellCheckFor
       }
 
       nsCOMPtr<nsIDOMNode> nextParent;
       parent->GetParentNode(getter_AddRefs(nextParent));
       parent = nextParent;
     }
   }
   else {
-    // XXX Do we really want this for all read-write content?
+    // XXX Do we really want this for all editable content?
     nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
-    *checkSpelling = content->IntrinsicState().HasState(NS_EVENT_STATE_MOZ_READWRITE);
+    *checkSpelling = content->IsEditable();
   }
 
   return NS_OK;
 }
 
 // mozInlineSpellChecker::ScheduleSpellCheck
 //
 //    This is called by code to do the actual spellchecking. We will set up
--- a/gfx/cairo/cairo/src/Makefile.in
+++ b/gfx/cairo/cairo/src/Makefile.in
@@ -44,17 +44,16 @@ VPATH           = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 ifndef MOZ_ENABLE_LIBXUL
 VISIBILITY_FLAGS =
 endif
 
 MODULE          = cairo
 LIBRARY_NAME    = mozcairo
-SUPPRESS_FAKELIB = 1 # cairo isn't awesome enough for fakelibs yet
 LIBXUL_LIBRARY = 1
 
 ifdef GNU_CC
 OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
 MODULE_OPTIMIZE_FLAGS = -O2
 else
 ifeq ($(OS_ARCH),SunOS)
 MODULE_OPTIMIZE_FLAGS = -xO5
--- a/gfx/cairo/cairo/src/cairo-features.h.in
+++ b/gfx/cairo/cairo/src/cairo-features.h.in
@@ -70,18 +70,16 @@
 @QUARTZ_IMAGE_SURFACE_FEATURE@
 
 @XCB_SURFACE_FEATURE@
 
 @WIN32_SURFACE_FEATURE@
 
 @OS2_SURFACE_FEATURE@
 
-@BEOS_SURFACE_FEATURE@
-
 @DIRECTFB_SURFACE_FEATURE@
 
 @QT_SURFACE_FEATURE@
 
 @FT_FONT_FEATURE@
 
 @WIN32_FONT_FEATURE@
 
--- a/gfx/src/nsIRenderingContext.h
+++ b/gfx/src/nsIRenderingContext.h
@@ -445,17 +445,17 @@ public:
    *        methods to speed measurements
    * @return aDimensions struct that contains the extent of the string (see below)
    */
   NS_IMETHOD GetTextDimensions(const char* aString, PRUint32 aLength,
                                nsTextDimensions& aDimensions) = 0;
   NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
                                nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull) = 0;
 
-#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
+#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11)
   /**
    * Given an available width and an array of break points,
    * returns the dimensions (in app units) of the text that fit and
    * the number of characters that fit. The number of characters
    * corresponds to an entry in the break array.
    * If no font has been set, the results are undefined.
    * @param aString, string to measure
    * @param aLength, number of characters in string
--- a/gfx/src/thebes/Makefile.in
+++ b/gfx/src/thebes/Makefile.in
@@ -84,20 +84,16 @@ OS_LIBS		+= $(call EXPAND_LIBNAME,$(_OS_
 
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
 CPPSRCS		+= nsSystemFontsOS2.cpp \
 		   $(NULL)
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
-CPPSRCS		+= nsSystemFontsBeOS.cpp
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CMMSRCS		= nsSystemFontsMac.mm
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),android)
 CPPSRCS		+= nsSystemFontsAndroid.cpp
 endif
 
deleted file mode 100644
--- a/gfx/src/thebes/nsSystemFontsBeOS.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* vim: set sw=2 sts=2 et cin: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is BeOS system font code in Thebes.
- *
- * The Initial Developer of the Original Code is
- * Christian Biesinger <cbiesinger@web.de>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Parts of this file used to live in nsDeviceContextBeos.cpp. The Original
- *   Author of that code is Netscape Communications Corporation.
- *
- *   Pierre Phaneuf <pp@ludusdesign.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <Font.h>
-#include <Menu.h>
-
-#include "nsIDeviceContext.h"
-#include "nsSystemFontsBeOS.h"
-
-nsSystemFontsBeOS::nsSystemFontsBeOS()
-  : mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
-  , mMenuFontName(NS_LITERAL_STRING("sans-serif"))
-  , mCaptionFontName(NS_LITERAL_STRING("sans-serif"))
-{
-  menu_info info;
-  get_menu_info(&info);
-  BFont menuFont;
-  menuFont.SetFamilyAndStyle(info.f_family, info.f_style);
-  menuFont.SetSize(info.font_size);
-
-  GetSystemFontInfo(be_plain_font, &mDefaultFontName, &mDefaultFontStyle);
-  GetSystemFontInfo(be_bold_font, &mCaptionFontName, &mCaptionFontStyle);
-  GetSystemFontInfo(&menuFont, &mMenuFontName, &mMenuFontStyle);
-}
-
-nsresult nsSystemFontsBeOS::GetSystemFont(nsSystemFontID aID,
-                                          nsString *aFontName,
-                                          gfxFontStyle *aFontStyle) const
-{
-  switch (aID) {
-    case eSystemFont_PullDownMenu: 
-    case eSystemFont_Menu:
-      *aFontName = mMenuFontName;
-      *aFontStyle = mMenuFontStyle;
-      return NS_OK;
-    case eSystemFont_Caption:             // css2 bold  
-      *aFontName = mCaptionFontName;
-      *aFontStyle = mCaptionFontStyle;
-      return NS_OK;
-    case eSystemFont_List:   
-    case eSystemFont_Field:
-    case eSystemFont_Icon : 
-    case eSystemFont_MessageBox : 
-    case eSystemFont_SmallCaption : 
-    case eSystemFont_StatusBar : 
-    case eSystemFont_Window:              // css3 
-    case eSystemFont_Document: 
-    case eSystemFont_Workspace: 
-    case eSystemFont_Desktop: 
-    case eSystemFont_Info: 
-    case eSystemFont_Dialog: 
-    case eSystemFont_Button: 
-    case eSystemFont_Tooltips:            // moz 
-    case eSystemFont_Widget: 
-    default:
-      *aFontName = mDefaultFontName;
-      *aFontStyle = mDefaultFontStyle;
-      return NS_OK;
-  }
-  NS_NOTREACHED("huh?");
-}
-
-nsresult 
-nsSystemFontsBeOS::GetSystemFontInfo(const BFont *theFont, nsString *aFontName,
-                                     gfxFontStyle *aFontStyle) const 
-{ 
- 
-  aFontStyle->style       = FONT_STYLE_NORMAL; 
-  aFontStyle->weight      = FONT_WEIGHT_NORMAL; 
-  aFontStyle->decorations = FONT_DECORATION_NONE; 
-  aFontStyle->stretch     = NS_FONT_STRETCH_NORMAL;
-  
-  font_family family; 
-  theFont->GetFamilyAndStyle(&family, NULL);
-
-  uint16 face = theFont->Face();
-  CopyUTF8toUTF16(family, *aFontName);
-  aFontStyle->size = theFont->Size();
-
-  if (face & B_ITALIC_FACE)
-    aFontStyle->style = FONT_STYLE_ITALIC;
-
-  if (face & B_BOLD_FACE)
-    aFontStyle->weight = FONT_WEIGHT_BOLD;
-
-  // FIXME: Set aFontStyle->stretch correctly!
-
-  if (face & B_UNDERSCORE_FACE)
-    aFontStyle->decorations |= FONT_DECORATION_UNDERLINE;
-
-  if (face & B_STRIKEOUT_FACE)
-    aFontStyle->decorations |= FONT_DECORATION_STRIKEOUT;
-
-  aFontStyle->systemFont = PR_TRUE;
-
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/gfx/src/thebes/nsSystemFontsBeOS.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is BeOS system font code in Thebes.
- *
- * The Initial Developer of the Original Code is
- * Christian Biesinger <cbiesinger@web.de>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _NS_SYSTEMFONTSBEOS_H_
-#define _NS_SYSTEMFONTSBEOS_H_
-
-#include <gfxFont.h>
-
-class BFont;
-
-class nsSystemFontsBeOS
-{
-public:
-    nsSystemFontsBeOS();
-
-    nsresult GetSystemFont(nsSystemFontID anID, nsString *aFontName,
-                           gfxFontStyle *aFontStyle) const;
-
-private:
-    nsresult GetSystemFontInfo(const BFont *theFont, nsString *aFontName,
-                               gfxFontStyle *aFontStyle) const;
-
-    /*
-     * The following system font constants exist:
-     *
-     * css2: http://www.w3.org/TR/REC-CSS2/fonts.html#x27
-     * eSystemFont_Caption, eSystemFont_Icon, eSystemFont_Menu,
-     * eSystemFont_MessageBox, eSystemFont_SmallCaption,
-     * eSystemFont_StatusBar,
-     * // css3
-     * eSystemFont_Window, eSystemFont_Document,
-     * eSystemFont_Workspace, eSystemFont_Desktop,
-     * eSystemFont_Info, eSystemFont_Dialog,
-     * eSystemFont_Button, eSystemFont_PullDownMenu,
-     * eSystemFont_List, eSystemFont_Field,
-     * // moz
-     * eSystemFont_Tooltips, eSystemFont_Widget
-     */
-    nsString mDefaultFontName, mMenuFontName, mCaptionFontName;
-    gfxFontStyle mDefaultFontStyle, mMenuFontStyle, mCaptionFontStyle;
-};
-
-#endif /* _NS_SYSTEMFONTSBEOS_H_ */
--- a/gfx/src/thebes/nsThebesDeviceContext.cpp
+++ b/gfx/src/thebes/nsThebesDeviceContext.cpp
@@ -72,19 +72,16 @@ static nsSystemFontsGTK2 *gSystemFonts =
 static nsSystemFontsWin *gSystemFonts = nsnull;
 #ifndef WINCE
 #include <usp10.h>
 #endif
 #elif defined(XP_OS2)
 #include "nsSystemFontsOS2.h"
 #include "gfxPDFSurface.h"
 static nsSystemFontsOS2 *gSystemFonts = nsnull;
-#elif defined(XP_BEOS)
-#include "nsSystemFontsBeOS.h"
-static nsSystemFontsBeOS *gSystemFonts = nsnull;
 #elif XP_MACOSX
 #include "nsSystemFontsMac.h"
 #include "gfxQuartzSurface.h"
 #include "gfxImageSurface.h"
 static nsSystemFontsMac *gSystemFonts = nsnull;
 #elif defined(MOZ_WIDGET_QT)
 #include "nsSystemFontsQt.h"
 #include "gfxPDFSurface.h"
@@ -804,18 +801,16 @@ nsThebesDeviceContext::GetSystemFont(nsS
 {
     if (!gSystemFonts) {
 #ifdef MOZ_ENABLE_GTK2
         gSystemFonts = new nsSystemFontsGTK2();
 #elif XP_WIN
         gSystemFonts = new nsSystemFontsWin();
 #elif XP_OS2
         gSystemFonts = new nsSystemFontsOS2();
-#elif defined(XP_BEOS)
-        gSystemFonts = new nsSystemFontsBeOS();
 #elif XP_MACOSX
         gSystemFonts = new nsSystemFontsMac();
 #elif defined(MOZ_WIDGET_QT)
         gSystemFonts = new nsSystemFontsQt();
 #elif defined(ANDROID)
         gSystemFonts = new nsSystemFontsAndroid();
 #else
 #error Need to know how to create gSystemFonts, fix me!
--- a/gfx/src/thebes/nsThebesRenderingContext.cpp
+++ b/gfx/src/thebes/nsThebesRenderingContext.cpp
@@ -985,17 +985,17 @@ nsThebesRenderingContext::GetTextDimensi
         }
         aLength -= len;
         aString += len;
         firstIteration = PR_FALSE;
     }
     return NS_OK;
 }
 
-#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
+#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11)
 NS_IMETHODIMP
 nsThebesRenderingContext::GetTextDimensions(const char*       aString,
                                             PRInt32           aLength,
                                             PRInt32           aAvailWidth,
                                             PRInt32*          aBreaks,
                                             PRInt32           aNumBreaks,
                                             nsTextDimensions& aDimensions,
                                             PRInt32&          aNumCharsFit,
@@ -1306,17 +1306,17 @@ nsThebesRenderingContext::GetTextDimensi
                                                     nsTextDimensions& aDimensions,
                                                     PRInt32* aFontID)
 {
     mFontMetrics->GetMaxAscent(aDimensions.ascent);
     mFontMetrics->GetMaxDescent(aDimensions.descent);
     return GetWidth(aString, aLength, aDimensions.width, aFontID);
 }
 
-#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS) || defined(XP_MACOSX) || defined (MOZ_DFB)
+#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_MACOSX) || defined (MOZ_DFB)
 nsresult
 nsThebesRenderingContext::GetTextDimensionsInternal(const char*       aString,
                                                     PRInt32           aLength,
                                                     PRInt32           aAvailWidth,
                                                     PRInt32*          aBreaks,
                                                     PRInt32           aNumBreaks,
                                                     nsTextDimensions& aDimensions,
                                                     PRInt32&          aNumCharsFit,
--- a/gfx/src/thebes/nsThebesRenderingContext.h
+++ b/gfx/src/thebes/nsThebesRenderingContext.h
@@ -87,17 +87,17 @@ public:
     NS_IMETHOD GetWidth(PRUnichar aC, nscoord &aWidth,
                         PRInt32 *aFontID);
 
     NS_IMETHOD GetTextDimensions(const char* aString, PRUint32 aLength,
                                  nsTextDimensions& aDimensions);
     NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
                                  nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull);
 
-#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
+#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11)
     NS_IMETHOD GetTextDimensions(const char*       aString,
                                  PRInt32           aLength,
                                  PRInt32           aAvailWidth,
                                  PRInt32*          aBreaks,
                                  PRInt32           aNumBreaks,
                                  nsTextDimensions& aDimensions,
                                  PRInt32&          aNumCharsFit,
                                  nsTextDimensions& aLastWordDimensions,
--- a/gfx/thebes/Makefile.in
+++ b/gfx/thebes/Makefile.in
@@ -58,26 +58,16 @@ endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),android)
 EXPORTS += \
 	gfxAndroidPlatform.h \
 	gfxFT2Fonts.h \
 	gfxFT2FontBase.h \
 	$(NULL)
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
-EXPORTS	+= \
-	gfxBeOSPlatform.h \
-	gfxBeOSSurface.h \
-	gfxFT2FontBase.h \
-	gfxPDFSurface.h \
-	gfxPangoFonts.h \
-	$(NULL)
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 EXPORTS += \
 	gfxPlatformMac.h \
 	gfxQuartzSurface.h \
 	gfxQuartzImageSurface.h \
 	gfxQuartzPDFSurface.h \
 	gfxQuartzNativeDrawing.h \
 	$(NULL)
@@ -363,27 +353,16 @@ endif
 CPPSRCS +=	gfxFT2FontBase.cpp
 CPPSRCS +=	gfxFT2Utils.cpp
 CPPSRCS +=	gfxFontconfigUtils.cpp
 CPPSRCS +=	nsUnicodeRange.cpp
 CPPSRCS +=	gfxPDFSurface.cpp
 EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(ZLIB_LIBS) $(XLDFLAGS) $(XLIBS) $(CAIRO_FT_LIBS) $(XEXT_LIBS)
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
-CPPSRCS	+= 	gfxBeOSSurface.cpp gfxBeOSPlatform.cpp
-CPPSRCS +=	gfxPangoFonts.cpp 
-CPPSRCS +=	gfxFT2FontBase.cpp
-CPPSRCS +=	gfxFT2Utils.cpp
-#CPPSRCS +=	gfxPDFSurface.cpp
-CPPSRCS +=	gfxFontconfigUtils.cpp
-CPPSRCS +=	nsUnicodeRange.cpp
-EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(CAIRO_FT_LIBS) -lfontconfig
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CPPSRCS	+= \
 	gfxQuartzSurface.cpp \
 	gfxQuartzImageSurface.cpp \
 	gfxQuartzPDFSurface.cpp \
 	gfxPlatformMac.cpp \
 	gfxMacFont.cpp \
 	gfxCoreTextShaper.cpp \
@@ -469,19 +448,15 @@ endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),android)
 CXXFLAGS += $(CAIRO_FT_CFLAGS)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 CXXFLAGS += $(MOZ_PANGO_CFLAGS)
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
-CXXFLAGS += $(CAIRO_FT_CFLAGS)
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
 CXXFLAGS += $(CAIRO_FT_CFLAGS)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
 CXXFLAGS += $(CAIRO_FT_CFLAGS) $(MOZ_PANGO_CFLAGS)
 endif
deleted file mode 100644
--- a/gfx/thebes/gfxBeOSPlatform.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is BeOS code in Thebes.
- *
- * The Initial Developer of the Original Code is
- * Christian Biesinger <cbiesinger@web.de>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Masayuki Nakano <masayuki@d-toybox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "gfxBeOSPlatform.h"
-#include "gfxFontconfigUtils.h"
-#include "gfxPangoFonts.h"
-
-#include "gfxImageSurface.h"
-#include "gfxBeOSSurface.h"
-
-#include "nsTArray.h"
-
-gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nsnull;
-
-gfxBeOSPlatform::gfxBeOSPlatform()
-{
-    if (!sFontconfigUtils)
-        sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
-}
-
-gfxBeOSPlatform::~gfxBeOSPlatform()
-{
-    gfxFontconfigUtils::Shutdown();
-    sFontconfigUtils = nsnull;
-
-    gfxPangoFontGroup::Shutdown();
-
-#if 0
-    // It would be nice to do this (although it might need to be after
-    // the cairo shutdown that happens in ~gfxPlatform).  It even looks
-    // idempotent.  But it has fatal assertions that fire if stuff is
-    // leaked, and we hit them.
-    FcFini();
-#endif
-}
-
-already_AddRefed<gfxASurface>
-gfxBeOSPlatform::CreateOffscreenSurface (PRUint32 width,
-                                         PRUint32 height,
-                                         gfxASurface::gfxContentType contentType)
-{
-    gfxASurface *newSurface = nsnull;
-
-    if (contentType == gfxASurface::CONTENT_ALPHA) {
-        newSurface = new gfxImageSurface(imageFormat, width, height);
-    } else {
-        newSurface = new gfxBeOSSurface(width, height,
-                                        contentType == gfxASurface::CONTENT_COLOR_ALPHA ? B_RGBA32 : B_RGB32);
-    }
-
-    NS_ADDREF(newSurface);
-    return newSurface;
-}
-
-nsresult
-gfxBeOSPlatform::GetFontList(nsIAtom *aLangGroup,
-                             const nsACString& aGenericFamily,
-                             nsTArray<nsString>& aListOfFonts)
-{
-    return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily,
-                                         aListOfFonts);
-}
-
-nsresult
-gfxBeOSPlatform::UpdateFontList()
-{
-    return sFontconfigUtils->UpdateFontList();
-}
-
-nsresult
-gfxBeOSPlatform::ResolveFontName(const nsAString& aFontName,
-                                FontResolverCallback aCallback,
-                                void *aClosure,
-                                PRBool& aAborted)
-{
-    return sFontconfigUtils->ResolveFontName(aFontName, aCallback,
-                                             aClosure, aAborted);
-}
-
-nsresult
-gfxBeOSPlatform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
-{
-    return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
-}
deleted file mode 100644
--- a/gfx/thebes/gfxBeOSPlatform.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* vim:set sw=4 sts=4 et cin: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is BeOS code in Thebes.
- *
- * The Initial Developer of the Original Code is
- * Christian Biesinger <cbiesinger@web.de>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-#ifndef GFX_PLATFORM_BEOS_H
-#define GFX_PLATFORM_BEOS_H
-
-#include "gfxPlatform.h"
-#include "gfxTArray.h"
-
-class gfxFontconfigUtils;
-
-class NS_EXPORT gfxBeOSPlatform : public gfxPlatform {
-public:
-    gfxBeOSPlatform();
-    virtual ~gfxBeOSPlatform();
-
-    static gfxBeOSPlatform *GetPlatform() {
-        return (gfxBeOSPlatform*) gfxPlatform::GetPlatform();
-    }
-
-    already_AddRefed<gfxASurface>
-        CreateOffscreenSurface(PRUint32 width,
-                               PRUint32 height,
-                               gfxASurface::gfxContentType contentType);
-
-    nsresult GetFontList(nsIAtom *aLangGroup,
-                         const nsACString& aGenericFamily,
-                         nsTArray<nsString>& aListOfFonts);
-
-    nsresult UpdateFontList();
-
-    nsresult ResolveFontName(const nsAString& aFontName,
-                             FontResolverCallback aCallback,
-                             void *aClosure, PRBool& aAborted);
-
-    nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
-protected:
-    static gfxFontconfigUtils *sFontconfigUtils;
-};
-
-#endif /* GFX_PLATFORM_BEOS_H */
deleted file mode 100644
--- a/gfx/thebes/gfxBeOSSurface.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/* vim:set sw=4 sts=4 et cin: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is BeOS code in Thebes.
- *
- * The Initial Developer of the Original Code is
- * Christian Biesinger <cbiesinger@web.de>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesse