Merge mozilla-central to mozilla-inbound.
authorSiddharth Agarwal <sid.bugzilla@gmail.com>
Wed, 29 Aug 2012 20:41:03 +0530
changeset 105817 370b39cc967b38557ce38c47ea1c8479e5c688b7
parent 105812 7566291ca483b3ef7434355e0fe03bb7a40d16f6 (current diff)
parent 105784 790fb17b1fe30c747fd9ca778d4c4a620cfeaae0 (diff)
child 105818 3f8f9d41a525c910741f28e9a20fa6e1e8ad76bd
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
milestone18.0a1
Merge mozilla-central to mozilla-inbound.
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -15,17 +15,17 @@ include $(DEPTH)/config/autoconf.mk
 # headers, so that we can use it to set up the wrapped system headers.
 VISIBILITY_FLAGS =
 
 # STDCXX_COMPAT is not needed here, and will actually fail because
 # libstdc++-compat is not built yet.
 STDCXX_COMPAT =
 
 ifneq (WINNT,$(HOST_OS_ARCH))
-HOST_PROGRAM	= nsinstall_real$(HOST_BIN_SUFFIX)
+HOST_PROGRAM	= nsinstall$(HOST_BIN_SUFFIX)
 HOST_CSRCS	= nsinstall.c pathsub.c
 endif
 
 TARGETS		= $(HOST_PROGRAM) $(SIMPLE_PROGRAMS)
 
 ifndef CROSS_COMPILE
 ifdef USE_ELF_DYNSTR_GC
 TARGETS		+= elf-dynstr-gc
@@ -44,40 +44,35 @@ ifdef GNU_CC
 MODULE_OPTIMIZE_FLAGS = -O3
 endif
 
 include $(topsrcdir)/config/config.mk
 
 # Do not install util programs
 NO_INSTALL=1
 
-ifneq (WINNT,$(HOST_OS_ARCH))
-export:: nsinstall$(HOST_BIN_SUFFIX)
-# Ensure nsinstall is atomically created
-nsinstall$(HOST_BIN_SUFFIX): $(HOST_PROGRAM)
-	cp $^ $@.tmp
-	mv $@.tmp $@
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 HOST_CFLAGS += -DUNICODE -D_UNICODE
 
 ifeq ($(OS_CONFIG),SunOS4.1)
 NSPR_CFLAGS	+= -I$(srcdir)/../nsprpub/pr/include/md
 endif
 
 HEADERS = \
 	$(DEPTH)/mozilla-config.h \
 	$(srcdir)/nsStaticComponents.h \
 	$(NULL)
 
 export:: $(TARGETS) $(HEADERS)
 	$(INSTALL) $(IFLAGS1) $(HEADERS) $(DIST)/include
 	-$(RM) $(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES)
+ifdef HOST_PROGRAM
+	$(INSTALL) $(HOST_PROGRAM) $(DIST)/bin
+endif
 
 # Generate a new buildid every time we "export" in config... that's only
 # supposed to be once per-build!
 export::
 ifdef MOZ_BUILD_DATE
 	printf "%s" $(MOZ_BUILD_DATE) > buildid
 else
 	$(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-buildid > buildid
--- a/config/makefiles/target_export.mk
+++ b/config/makefiles/target_export.mk
@@ -22,17 +22,17 @@ export_tier_%:
 #################
 ifdef PARALLEL_DIRS
 export:: $(PARALLEL_DIRS_export)
 
 $(PARALLEL_DIRS_export): %_export: %/Makefile
 	+@$(call SUBMAKE,export,$*)
 endif
 
-export:: $(SUBMAKEFILES) $(MAKE_DIRS)
+export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
 	$(LOOP_OVER_DIRS)
 	$(LOOP_OVER_TOOL_DIRS)
 
 
 #
 # Rule to create list of libraries for final link
 #
 # todo: use pre-req deps rather than conditionals
--- a/config/makefiles/test/Makefile.in
+++ b/config/makefiles/test/Makefile.in
@@ -15,31 +15,34 @@ USE_AUTOTARGETS_MK  = 1
 MAKEUTILS_UNIT_TEST = 1
 include $(topsrcdir)/config/makefiles/makeutils.mk
 
 dir-ts = .deps/test
 check-arglist        = $(dir-ts)/arglist.ts
 check-autotargets    = $(dir-ts)/autotargets_mk.ts
 check-export-targets = $(dir-ts)/export-targets-mk.ts
 check-XinY           = $(dir-ts)/check_XinY_mk.ts
+check-xpidl          = $(dir-ts)/xpidl-mk.ts
 check-tests =\
   $(check-arglist) \
   $(check-autotargets) \
   $(check-export-targets) \
   $(check-XinY) \
+  $(check-xpidl) \
   $(NULL)
 
 
 ##------------------_##
 ##---]  TARGETS  [---##
 ##------------------_##
 all::
 
 clean:
 	$(RM) $(check-tests)
+	@$(MAKE) --no-print-directory -f $(srcdir)/check-xpidl.mk clean-xpidl topsrcdir=$(topsrcdir)
 
 ###########################################################################
 ## Logic processed at compile time so be selective about when to test
 ## $(MAKE) check VERBOSE=1
 ifneq ($(NULL),$(findstring check,$(MAKECMDGOALS))) #
 
 check-preqs =\
   $(call mkdir_deps,$(dir-ts)) \
@@ -116,9 +119,28 @@ check-export-targets-preqs=\
 
 # include then test
 checkup: $(eval include $(srcdir)/check-export-targets.mk)
 
 $(check-export-targets): $(check-export-targets-preqs)
 	@$(TOUCH) $@
 # </CHECK: export-targets.mk>
 
+###########################################################################
+##{ <CHECK: xpidl.mk>
+check-xpidl-preqs=\
+  $(call mkdir_deps,$(dir-ts)) \
+  $(topsrcdir)/config/config.mk \
+  $(topsrcdir)/config/makefiles/makeutils.mk \
+  $(topsrcdir)/config/makefiles/xpidl.mk \
+  $(srcdir)/check-xpidl.mk \
+  $(NULL)
+
+check-xpidl-args =\
+  "topsrcdir=$(topsrcdir)" \
+  "srcdir=$(srcdir)" \
+  $(NULL)
+$(check-xpidl): $(check-xpidl-preqs)
+	$(MAKE) -f $(srcdir)/check-xpidl.mk check-xpidl $(check-xpidl-args)
+	@$(TOUCH) $@
+#} </check-xpidl.mk>
+
 endif #} findstring MAKECMDGOAL
new file mode 100644
--- /dev/null
+++ b/config/makefiles/test/check-xpidl.mk
@@ -0,0 +1,43 @@
+# -*- makefile -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ifdef VERBOSE
+  $(warning loading test)
+endif
+
+# Limit scope, we only need install_cmd= for testing
+INCLUDED_AUTOCONF_MK = 1
+include $(topsrcdir)/config/config.mk
+
+USE_AUTOTARGETS_MK = 1
+include $(topsrcdir)/config/makefiles/makeutils.mk
+
+basedir  = blah
+DIST     = $(basedir)/dist
+DI       = $(DIST)/include
+IDL_DIR  = $(basedir)/idl
+INSTALL := cp
+
+XPIDLSRCS = $(srcdir)/check-xpidl.mk
+
+include $(topsrcdir)/config/makefiles/xpidl.mk
+
+
+$(call requiredfunction,topsrcdir)
+$(call requiredfunction,XPIDL_GEN_DIR)
+
+HIDE=@
+check-xpidl: xpidl-install-src xpidl-install-headers
+	$(HIDE)test -d $(DIST)                   || exit 90
+	$(HIDE)test -f $(DI)/check-xpidl.mk      || exit 91
+	$(HIDE)test -f $(IDL_DIR)/check-xpidl.mk || exit 92
+
+# Declare targets to avoid including rules.mk
+$(DI) $(IDL_DIR):
+	mkdir -p $@
+
+clean-xpidl:
+	$(RM) -r $(basedir)
new file mode 100644
--- /dev/null
+++ b/config/makefiles/xpidl.mk
@@ -0,0 +1,60 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+# Always declared, general use by:
+# js/xpconnect/tests/idl/Makefile.in:libs
+# toolkit/crashreporter/test/Makefile.in
+XPIDL_GEN_DIR ?= _xpidlgen
+GARBAGE_DIRS  += $(XPIDL_GEN_DIR)
+
+
+###########################################################################
+## Conditional logic
+###########################################################################
+ifndef INCLUDED_XPIDL_MK #{
+  INCLUDED_XPIDL_MK = 1
+
+  ifneq (,$(XPIDLSRCS)) #{
+
+    ifndef NO_DIST_INSTALL #{
+      _xpidl-todo_ += xpidl-install-src
+      _xpidl-todo_ += xpidl-install-headers
+    endif #}
+
+  endif #} XPIDLSRCS
+
+  export:: $(_xpidl-todo_)
+
+  $(call requiredfunction,mkdir_deps)
+endif #} INCLUDED_XPIDL_MK
+
+
+###########################################################################
+## processing targets
+###########################################################################
+ifdef _xpidl-todo_ #{
+
+$(call requiredfunction,install_cmd)
+
+## Logic batch #1
+xpidl-install-src-preqs=\
+  $(XPIDLSRCS) \
+  $(call mkdir_deps,$(IDL_DIR)) \
+  $(NULL)
+
+xpidl-install-src: $(xpidl-install-src-preqs)
+	$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
+
+xpidl-install-headers-preqs =\
+  $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
+  $(call mkdir_deps,$(DIST)/include) \
+  $(NULL)
+xpidl-install-headers: $(xpidl-install-headers-preqs)
+	$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
+
+endif #} _xpidl-todo_
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1154,29 +1154,25 @@ ifneq ($(XPI_NAME),)
 $(FINAL_TARGET):
 	$(NSINSTALL) -D $@
 
 export:: $(FINAL_TARGET)
 endif
 
 ifndef NO_DIST_INSTALL
 ifneq (,$(EXPORTS))
-EXPORTS_FILES := $(EXPORTS)
-EXPORTS_DEST := $(DIST)/include
-EXPORTS_TARGET := export
-INSTALL_TARGETS += EXPORTS
+export:: $(EXPORTS)
+	$(call install_cmd,$(IFLAGS1) $^ $(DIST)/include)
 endif
 endif # NO_DIST_INSTALL
 
 define EXPORT_NAMESPACE_RULE
 ifndef NO_DIST_INSTALL
-EXPORTS_$(namespace)_FILES := $$(EXPORTS_$(namespace))
-EXPORTS_$(namespace)_DEST := $$(DIST)/include/$(namespace)
-EXPORTS_$(namespace)_TARGET := export
-INSTALL_TARGETS += EXPORTS_$(namespace)
+export:: $(EXPORTS_$(namespace))
+	$(call install_cmd,$(IFLAGS1) $$^ $(DIST)/include/$(namespace))
 endif # NO_DIST_INSTALL
 endef
 
 $(foreach namespace,$(EXPORTS_NAMESPACES),$(eval $(EXPORT_NAMESPACE_RULE)))
 
 ################################################################################
 # Copy each element of PREF_JS_EXPORTS
 
@@ -1202,22 +1198,24 @@ PREF_JS_EXPORTS_FLAGS := $(PREF_PPFLAGS)
 PP_TARGETS += PREF_JS_EXPORTS
 endif
 endif
 
 ################################################################################
 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
 
 ifneq ($(AUTOCFG_JS_EXPORTS),)
+$(FINAL_TARGET)/defaults/autoconfig::
+	$(NSINSTALL) -D $@
+
 ifndef NO_DIST_INSTALL
-AUTOCFG_JS_EXPORTS_FILES := $(AUTOCFG_JS_EXPORTS)
-AUTOCFG_JS_EXPORTS_DEST := $(FINAL_TARGET)/defaults/autoconfig
-AUTOCFG_JS_EXPORTS_TARGET := export
-INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
+export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
+	$(call install_cmd,$(IFLAGS1) $^)
 endif
+
 endif
 
 ################################################################################
 # Export the elements of $(XPIDLSRCS)
 # generating .h and .xpt files and moving them to the appropriate places.
 
 ifneq ($(XPIDLSRCS),) #{
 
@@ -1268,46 +1266,48 @@ xpidl-preqs = \
 	  $(LIBXUL_DIST)/sdk/bin/typelib.py $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
 
 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
+libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
 ifndef NO_DIST_INSTALL
-XPIDL_MODULE_FILES := $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
-XPIDL_MODULE_DEST := $(FINAL_TARGET)/components
-INSTALL_TARGETS += XPIDL_MODULE
-
+	$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
 ifndef NO_INTERFACES_MANIFEST
 libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
 endif
 endif
 
 GARBAGE_DIRS		+= $(XPIDL_GEN_DIR)
 
-ifndef NO_DIST_INSTALL
-XPIDL_HEADERS_FILES := $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
-XPIDL_HEADERS_DEST := $(DIST)/include
-XPIDL_HEADERS_TARGET := export
-INSTALL_TARGETS += XPIDL_HEADERS
-
-XPIDLSRCS_FILES := $(XPIDLSRCS)
-XPIDLSRCS_DEST := $(IDL_DIR)
-XPIDLSRCS_TARGET := export-idl
-INSTALL_TARGETS += XPIDLSRCS
-
-export:: export-idl
-endif
 endif #} XPIDLSRCS
 
+
+ifndef INCLUDED_XPIDL_MK
+  include $(topsrcdir)/config/makefiles/xpidl.mk
+endif
+
+
+# General rules for exporting idl files.
+$(IDL_DIR):
+	$(NSINSTALL) -D $@
+
 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
+
+ifneq ($(XPIDLSRCS),)
+ifndef NO_DIST_INSTALL
+export-idl:: $(XPIDLSRCS) $(IDL_DIR)
+	$(call install_cmd,$(IFLAGS1) $^)
+endif
+endif
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
 	$(LOOP_OVER_TOOL_DIRS)
 
 ################################################################################
 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
 ifneq (,$(filter %.js,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
 ifeq (,$(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
@@ -1315,19 +1315,17 @@ ifndef NO_JS_MANIFEST
 $(error .js component without matching .manifest. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0)
 endif
 endif
 endif
 
 ifdef EXTRA_COMPONENTS
 libs:: $(EXTRA_COMPONENTS)
 ifndef NO_DIST_INSTALL
-EXTRA_COMPONENTS_FILES := $(EXTRA_COMPONENTS)
-EXTRA_COMPONENTS_DEST := $(FINAL_TARGET)/components
-INSTALL_TARGETS += EXTRA_COMPONENTS
+	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
 endif
 
 endif
 
 ifdef EXTRA_PP_COMPONENTS
 ifndef NO_DIST_INSTALL
 EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
 PP_TARGETS += EXTRA_PP_COMPONENTS
@@ -1341,21 +1339,21 @@ libs:: $(call mkdir_deps,$(FINAL_TARGET)
 endif
 
 ################################################################################
 # Copy each element of EXTRA_JS_MODULES to JS_MODULES_PATH, or
 # $(FINAL_TARGET)/modules if that isn't defined.
 JS_MODULES_PATH ?= $(FINAL_TARGET)/modules
 
 ifdef EXTRA_JS_MODULES
+libs:: $(EXTRA_JS_MODULES)
 ifndef NO_DIST_INSTALL
-EXTRA_JS_MODULES_FILES := $(EXTRA_JS_MODULES)
-EXTRA_JS_MODULES_DEST := $(JS_MODULES_PATH)
-INSTALL_TARGETS += EXTRA_JS_MODULES
+	$(call install_cmd,$(IFLAGS1) $^ $(JS_MODULES_PATH))
 endif
+
 endif
 
 ifdef EXTRA_PP_JS_MODULES
 ifndef NO_DIST_INSTALL
 EXTRA_PP_JS_MODULES_PATH := $(JS_MODULES_PATH)
 PP_TARGETS += EXTRA_PP_JS_MODULES
 endif
 endif
@@ -1367,41 +1365,46 @@ endif
 # objdir/_tests/modules/. If TESTING_JS_MODULE_DIR is defined, that path
 # wlll be appended to the output directory.
 
 ifdef TESTING_JS_MODULES
 testmodulesdir = $(DEPTH)/_tests/modules/$(TESTING_JS_MODULE_DIR)
 
 GENERATED_DIRS += $(testmodulesdir)
 
+libs:: $(TESTING_JS_MODULES)
 ifndef NO_DIST_INSTALL
-TESTING_JS_MODULES_FILES := $(TESTING_JS_MODULES)
-TESTING_JS_MODULES_DEST := $(testmodulesdir)
-INSTALL_TARGETS += TESTING_JS_MODULES
+	$(call install_cmd,$(IFLAGS) $^ $(testmodulesdir))
 endif
 
 endif
 
 ################################################################################
 # SDK
 
 ifneq (,$(SDK_LIBRARY))
+$(SDK_LIB_DIR)::
+	$(NSINSTALL) -D $@
+
 ifndef NO_DIST_INSTALL
-SDK_LIBRARY_FILES := $(SDK_LIBRARY)
-SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
-INSTALL_TARGETS += SDK_LIBRARY
+libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
+	$(call install_cmd,$(IFLAGS2) $^)
 endif
+
 endif # SDK_LIBRARY
 
 ifneq (,$(strip $(SDK_BINARY)))
+$(SDK_BIN_DIR)::
+	$(NSINSTALL) -D $@
+
 ifndef NO_DIST_INSTALL
-SDK_BINARY_FILES := $(SDK_BINARY)
-SDK_BINARY_DEST := $(SDK_BIN_DIR)
-INSTALL_TARGETS += SDK_BINARY
+libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
+	$(call install_cmd,$(IFLAGS2) $^)
 endif
+
 endif # SDK_BINARY
 
 ################################################################################
 # CHROME PACKAGING
 
 JAR_MANIFEST := $(srcdir)/jar.mn
 
 chrome::
@@ -1527,78 +1530,61 @@ TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
 	$(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
 endif
 endif
 
 ################################################################################
 # Install/copy rules
 #
 # The INSTALL_TARGETS variable contains a list of all install target
-# categories. Each category defines a list of files and executables, and an
-# install destination,
+# categories. Each category defines a list of files, an install destination,
+# and whether the files are executables or not.
 #
 # FOO_FILES := foo bar
 # FOO_EXECUTABLES := baz
 # FOO_DEST := target_path
 # INSTALL_TARGETS += FOO
-#
-# Additionally, a FOO_TARGET variable may be added to indicate the target for
-# which the files and executables are installed. Default is "libs".
-
-# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
-ifneq (,$(filter $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
-nsinstall_is_usable = $(if $(wildcard $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)),$(eval nsinstall_is_usable := yes)yes)
-
-define install_cmd_override
-$(1): install_cmd = $$(if $$(nsinstall_is_usable),$$(INSTALL),$$(NSINSTALL_PY)) $$(1)
-endef
-endif
-
 define install_file_template
-$(or $(3),libs):: $(2)/$(notdir $(1))
-$(call install_cmd_override,$(2)/$(notdir $(1)))
+libs:: $(2)/$(notdir $(1))
 $(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2))
-	$$(call install_cmd,$(4) $$< $${@D})
+	$(INSTALL) $(3) $$< $${@D}
 endef
 $(foreach category,$(INSTALL_TARGETS),\
   $(if $($(category)_DEST),,$(error Missing $(category)_DEST))\
   $(foreach file,$($(category)_FILES),\
-    $(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS1)))\
+    $(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS1)))\
   )\
   $(foreach file,$($(category)_EXECUTABLES),\
-    $(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS2)))\
+    $(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS2)))\
   )\
 )
 
 ################################################################################
 # Preprocessing rules
 #
 # The PP_TARGETS variable contains a list of all preprocessing target
 # categories. Each category defines a target path, and optional extra flags
 # like the following:
 #
 # FOO_PATH := target_path
 # FOO_FLAGS := -Dsome_flag
 # PP_TARGETS += FOO
-#
-# Additionally, a FOO_TARGET variable may be added to indicate the target for
-# which the files and executables are installed. Default is "libs".
 
 # preprocess_file_template defines preprocessing rules.
 # $(call preprocess_file_template, source_file, target_path, extra_flags)
 define preprocess_file_template
 $(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2)) $$(GLOBAL_DEPS)
 	$$(RM) $$@
-	$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(4) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
-$(or $(3),libs):: $(2)/$(notdir $(1))
+	$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(3) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
+libs:: $(2)/$(notdir $(1))
 endef
 
 $(foreach category,$(PP_TARGETS),\
   $(foreach file,$($(category)),\
-    $(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_TARGET),$($(category)_FLAGS)))\
+    $(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_FLAGS)))\
    )\
  )
 
 ################################################################################
 # Special gmake rules.
 ################################################################################
 
 
--- a/content/events/public/nsEventNameList.h
+++ b/content/events/public/nsEventNameList.h
@@ -46,16 +46,40 @@
  * Event names that are not exposed as IDL attributes at all should be
  * enclosed in NON_IDL_EVENT.  If NON_IDL_EVENT is not defined, it
  * will be defined to the empty string.
  *
  * If you change which macros event names are enclosed in, please
  * update the tests for bug 689564 and bug 659350 as needed.
  */
 
+#ifdef ID_TO_EVENT
+#ifdef EVENT
+#error "Don't define EVENT"
+#endif /* EVENT */
+#ifdef WINDOW_ONLY_EVENT
+#error "Don't define WINDOW_ONLY_EVENT"
+#endif /* WINDOW_ONLY_EVENT */
+#ifdef TOUCH_EVENT
+#error "Don't define TOUCH_EVENT"
+#endif /* TOUCH_EVENT */
+#ifdef DOCUMENT_ONLY_EVENT
+#error "Don't define DOCUMENT_ONLY_EVENT"
+#endif /* DOCUMENT_ONLY_EVENT */
+#ifdef NON_IDL_EVENT
+#error "Don't define NON_IDL_EVENT"
+#endif /* NON_IDL_EVENT */
+
+#define EVENT ID_TO_EVENT
+#define WINDOW_ONLY_EVENT ID_TO_EVENT
+#define TOUCH_EVENT ID_TO_EVENT
+#define DOCUMENT_ONLY_EVENT ID_TO_EVENT
+#define NON_IDL_EVENT ID_TO_EVENT
+#endif
+
 #ifdef DEFINED_FORWARDED_EVENT
 #error "Don't define DEFINED_FORWARDED_EVENT"
 #endif /* DEFINED_FORWARDED_EVENT */
 
 #ifndef FORWARDED_EVENT
 #define FORWARDED_EVENT EVENT
 #define DEFINED_FORWARDED_EVENT
 #endif /* FORWARDED_EVENT */
@@ -630,41 +654,54 @@ NON_IDL_EVENT(SVGScroll,
               NS_SVG_SCROLL,
               EventNameType_None,
               NS_SVG_EVENT)
 
 NON_IDL_EVENT(SVGZoom,
               NS_SVG_ZOOM,
               EventNameType_None,
               NS_SVGZOOM_EVENT)
+
+// Only map the ID to the real event name when ID_TO_EVENT is defined.
+#ifndef ID_TO_EVENT
 // This is a bit hackish, but SVG's event names are weird.
 NON_IDL_EVENT(zoom,
               NS_SVG_ZOOM,
               EventNameType_SVGSVG,
               NS_EVENT_NULL)
+#endif
+// Only map the ID to the real event name when ID_TO_EVENT is defined.
+#ifndef ID_TO_EVENT
 NON_IDL_EVENT(begin,
               NS_SMIL_BEGIN,
               EventNameType_SMIL,
               NS_EVENT_NULL)
+#endif
 NON_IDL_EVENT(beginEvent,
               NS_SMIL_BEGIN,
               EventNameType_None,
               NS_SMIL_TIME_EVENT)
+// Only map the ID to the real event name when ID_TO_EVENT is defined.
+#ifndef ID_TO_EVENT
 NON_IDL_EVENT(end,
               NS_SMIL_END,
               EventNameType_SMIL,
               NS_EVENT_NULL)
+#endif
 NON_IDL_EVENT(endEvent,
               NS_SMIL_END,
               EventNameType_None,
               NS_SMIL_TIME_EVENT)
+// Only map the ID to the real event name when ID_TO_EVENT is defined.
+#ifndef ID_TO_EVENT
 NON_IDL_EVENT(repeat,
               NS_SMIL_REPEAT,
               EventNameType_SMIL,
               NS_EVENT_NULL)
+#endif
 NON_IDL_EVENT(repeatEvent,
               NS_SMIL_REPEAT,
               EventNameType_None,
               NS_SMIL_TIME_EVENT)
 
 NON_IDL_EVENT(MozAudioAvailable,
               NS_MOZAUDIOAVAILABLE,
               EventNameType_None,
@@ -776,8 +813,16 @@ NON_IDL_EVENT(animationiteration,
 #undef DOCUMENT_ONLY_EVENT
 #endif /* DEFINED_DOCUMENT_ONLY_EVENT */
 
 #ifdef DEFINED_NON_IDL_EVENT
 #undef DEFINED_NON_IDL_EVENT
 #undef NON_IDL_EVENT
 #endif /* DEFINED_NON_IDL_EVENT */
 
+#ifdef ID_TO_EVENT
+#undef EVENT
+#undef WINDOW_ONLY_EVENT
+#undef TOUCH_EVENT
+#undef DOCUMENT_ONLY_EVENT
+#undef NON_IDL_EVENT
+#endif /* ID_TO_EVENT */
+
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -30,81 +30,16 @@
 #include "nsJSUtils.h"
 #include "DictionaryHelpers.h"
 #include "nsLayoutUtils.h"
 #include "nsIScrollableFrame.h"
 #include "nsDOMClassInfoID.h"
 
 using namespace mozilla;
 
-static const char* const sEventNames[] = {
-  "mousedown", "mouseup", "click", "dblclick", "mouseenter", "mouseleave", "mouseover",
-  "mouseout", "MozMouseHittest", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
-  "focus", "blur", "load", "popstate", "beforescriptexecute",
-  "afterscriptexecute", "beforeunload", "unload",
-  "hashchange", "readystatechange", "abort", "error",
-  "submit", "reset", "change", "select", "input", "invalid", "text",
-  "compositionstart", "compositionend", "compositionupdate",
-  "popupshowing", "popupshown",
-  "popuphiding", "popuphidden", "close", "command", "broadcast", "commandupdate",
-  "dragenter", "dragover", "dragexit", "dragdrop", "draggesture",
-  "drag", "dragend", "dragstart", "dragleave", "drop", "resize",
-  "scroll", "overflow", "underflow", "overflowchanged",
-  "DOMSubtreeModified", "DOMNodeInserted", "DOMNodeRemoved", 
-  "DOMNodeRemovedFromDocument", "DOMNodeInsertedIntoDocument",
-  "DOMAttrModified", "DOMCharacterDataModified",
-  "DOMActivate", "DOMFocusIn", "DOMFocusOut",
-  "pageshow", "pagehide", "DOMMouseScroll", "MozMousePixelScroll", "wheel",
-  "offline", "online", "copy", "cut", "paste", "open", "message", "show",
-  "SVGLoad", "SVGUnload", "SVGAbort", "SVGError", "SVGResize", "SVGScroll",
-  "SVGZoom",
-  "beginEvent", "endEvent", "repeatEvent",
-#ifdef MOZ_MEDIA
-  "loadstart", "progress", "suspend", "emptied", "stalled", "play", "pause",
-  "loadedmetadata", "loadeddata", "waiting", "playing", "canplay",
-  "canplaythrough", "seeking", "seeked", "timeupdate", "ended", "ratechange",
-  "durationchange", "volumechange", "MozAudioAvailable",
-#endif // MOZ_MEDIA
-  "MozAfterPaint",
-  "MozBeforeResize",
-  "mozfullscreenchange",
-  "mozfullscreenerror",
-  "mozpointerlockchange",
-  "mozpointerlockerror",
-  "MozSwipeGesture",
-  "MozMagnifyGestureStart",
-  "MozMagnifyGestureUpdate",
-  "MozMagnifyGesture",
-  "MozRotateGestureStart",
-  "MozRotateGestureUpdate",
-  "MozRotateGesture",
-  "MozTapGesture",
-  "MozPressTapGesture",
-  "MozEdgeUIGesture",
-  "MozTouchDown",
-  "MozTouchMove",
-  "MozTouchUp",
-  "touchstart",
-  "touchend",
-  "touchmove",
-  "touchcancel",
-  "touchenter",
-  "touchleave",
-  "MozScrolledAreaChanged",
-  "transitionend",
-  "animationstart",
-  "animationend",
-  "animationiteration",
-  "devicemotion",
-  "deviceorientation",
-  "deviceproximity",
-  "userproximity",
-  "devicelight"
-};
-
 static char *sPopupAllowedEvents;
 
 
 nsDOMEvent::nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent)
 {
   mPrivateDataDuplicated = false;
 
   if (aEvent) {
@@ -1231,310 +1166,20 @@ nsDOMEvent::GetClientCoords(nsPresContex
 }
 
 // To be called ONLY by nsDOMEvent::GetType (which has the additional
 // logic for handling user-defined events).
 // static
 const char* nsDOMEvent::GetEventName(uint32_t aEventType)
 {
   switch(aEventType) {
-  case NS_MOUSE_BUTTON_DOWN:
-    return sEventNames[eDOMEvents_mousedown];
-  case NS_MOUSE_BUTTON_UP:
-    return sEventNames[eDOMEvents_mouseup];
-  case NS_MOUSE_CLICK:
-    return sEventNames[eDOMEvents_click];
-  case NS_MOUSE_DOUBLECLICK:
-    return sEventNames[eDOMEvents_dblclick];
-  case NS_MOUSEENTER:
-    return sEventNames[eDOMEvents_mouseenter];
-  case NS_MOUSELEAVE:
-    return sEventNames[eDOMEvents_mouseleave];
-  case NS_MOUSE_ENTER_SYNTH:
-    return sEventNames[eDOMEvents_mouseover];
-  case NS_MOUSE_EXIT_SYNTH:
-    return sEventNames[eDOMEvents_mouseout];
-  case NS_MOUSE_MOZHITTEST:
-    return sEventNames[eDOMEvents_MozMouseHittest];
-  case NS_MOUSE_MOVE:
-    return sEventNames[eDOMEvents_mousemove];
-  case NS_KEY_UP:
-    return sEventNames[eDOMEvents_keyup];
-  case NS_KEY_DOWN:
-    return sEventNames[eDOMEvents_keydown];
-  case NS_KEY_PRESS:
-    return sEventNames[eDOMEvents_keypress];
-  case NS_COMPOSITION_START:
-    return sEventNames[eDOMEvents_compositionstart];
-  case NS_COMPOSITION_UPDATE:
-    return sEventNames[eDOMEvents_compositionupdate];
-  case NS_COMPOSITION_END:
-    return sEventNames[eDOMEvents_compositionend];
-  case NS_FOCUS_CONTENT:
-    return sEventNames[eDOMEvents_focus];
-  case NS_BLUR_CONTENT:
-    return sEventNames[eDOMEvents_blur];
-  case NS_XUL_CLOSE:
-    return sEventNames[eDOMEvents_close];
-  case NS_LOAD:
-    return sEventNames[eDOMEvents_load];
-  case NS_POPSTATE:
-    return sEventNames[eDOMEvents_popstate];
-  case NS_BEFORE_SCRIPT_EXECUTE:
-    return sEventNames[eDOMEvents_beforescriptexecute];
-  case NS_AFTER_SCRIPT_EXECUTE:
-    return sEventNames[eDOMEvents_afterscriptexecute];
-  case NS_BEFORE_PAGE_UNLOAD:
-    return sEventNames[eDOMEvents_beforeunload];
-  case NS_PAGE_UNLOAD:
-    return sEventNames[eDOMEvents_unload];
-  case NS_HASHCHANGE:
-    return sEventNames[eDOMEvents_hashchange];
-  case NS_READYSTATECHANGE:
-    return sEventNames[eDOMEvents_readystatechange];
-  case NS_IMAGE_ABORT:
-    return sEventNames[eDOMEvents_abort];
-  case NS_LOAD_ERROR:
-    return sEventNames[eDOMEvents_error];
-  case NS_FORM_SUBMIT:
-    return sEventNames[eDOMEvents_submit];
-  case NS_FORM_RESET:
-    return sEventNames[eDOMEvents_reset];
-  case NS_FORM_CHANGE:
-    return sEventNames[eDOMEvents_change];
-  case NS_FORM_SELECTED:
-    return sEventNames[eDOMEvents_select];
-  case NS_FORM_INPUT:
-    return sEventNames[eDOMEvents_input];
-  case NS_FORM_INVALID:
-    return sEventNames[eDOMEvents_invalid];
-  case NS_RESIZE_EVENT:
-    return sEventNames[eDOMEvents_resize];
-  case NS_SCROLL_EVENT:
-    return sEventNames[eDOMEvents_scroll];
-  case NS_TEXT_TEXT:
-    return sEventNames[eDOMEvents_text];
-  case NS_XUL_POPUP_SHOWING:
-    return sEventNames[eDOMEvents_popupShowing];
-  case NS_XUL_POPUP_SHOWN:
-    return sEventNames[eDOMEvents_popupShown];
-  case NS_XUL_POPUP_HIDING:
-    return sEventNames[eDOMEvents_popupHiding];
-  case NS_XUL_POPUP_HIDDEN:
-    return sEventNames[eDOMEvents_popupHidden];
-  case NS_XUL_COMMAND:
-    return sEventNames[eDOMEvents_command];
-  case NS_XUL_BROADCAST:
-    return sEventNames[eDOMEvents_broadcast];
-  case NS_XUL_COMMAND_UPDATE:
-    return sEventNames[eDOMEvents_commandupdate];
-  case NS_DRAGDROP_ENTER:
-    return sEventNames[eDOMEvents_dragenter];
-  case NS_DRAGDROP_OVER_SYNTH:
-    return sEventNames[eDOMEvents_dragover];
-  case NS_DRAGDROP_EXIT_SYNTH:
-    return sEventNames[eDOMEvents_dragexit];
-  case NS_DRAGDROP_DRAGDROP:
-    return sEventNames[eDOMEvents_dragdrop];
-  case NS_DRAGDROP_GESTURE:
-    return sEventNames[eDOMEvents_draggesture];
-  case NS_DRAGDROP_DRAG:
-    return sEventNames[eDOMEvents_drag];
-  case NS_DRAGDROP_END:
-    return sEventNames[eDOMEvents_dragend];
-  case NS_DRAGDROP_START:
-    return sEventNames[eDOMEvents_dragstart];
-  case NS_DRAGDROP_LEAVE_SYNTH:
-    return sEventNames[eDOMEvents_dragleave];
-  case NS_DRAGDROP_DROP:
-    return sEventNames[eDOMEvents_drop];
-  case NS_SCROLLPORT_OVERFLOW:
-    return sEventNames[eDOMEvents_overflow];
-  case NS_SCROLLPORT_UNDERFLOW:
-    return sEventNames[eDOMEvents_underflow];
-  case NS_SCROLLPORT_OVERFLOWCHANGED:
-    return sEventNames[eDOMEvents_overflowchanged];
-  case NS_MUTATION_SUBTREEMODIFIED:
-    return sEventNames[eDOMEvents_subtreemodified];
-  case NS_MUTATION_NODEINSERTED:
-    return sEventNames[eDOMEvents_nodeinserted];
-  case NS_MUTATION_NODEREMOVED:
-    return sEventNames[eDOMEvents_noderemoved];
-  case NS_MUTATION_NODEREMOVEDFROMDOCUMENT:
-    return sEventNames[eDOMEvents_noderemovedfromdocument];
-  case NS_MUTATION_NODEINSERTEDINTODOCUMENT:
-    return sEventNames[eDOMEvents_nodeinsertedintodocument];
-  case NS_MUTATION_ATTRMODIFIED:
-    return sEventNames[eDOMEvents_attrmodified];
-  case NS_MUTATION_CHARACTERDATAMODIFIED:
-    return sEventNames[eDOMEvents_characterdatamodified];
-  case NS_CONTEXTMENU:
-    return sEventNames[eDOMEvents_contextmenu];
-  case NS_UI_ACTIVATE:
-    return sEventNames[eDOMEvents_DOMActivate];
-  case NS_UI_FOCUSIN:
-    return sEventNames[eDOMEvents_DOMFocusIn];
-  case NS_UI_FOCUSOUT:
-    return sEventNames[eDOMEvents_DOMFocusOut];
-  case NS_PAGE_SHOW:
-    return sEventNames[eDOMEvents_pageshow];
-  case NS_PAGE_HIDE:
-    return sEventNames[eDOMEvents_pagehide];
-  case NS_MOUSE_SCROLL:
-    return sEventNames[eDOMEvents_DOMMouseScroll];
-  case NS_MOUSE_PIXEL_SCROLL:
-    return sEventNames[eDOMEvents_MozMousePixelScroll];
-  case NS_WHEEL_WHEEL:
-    return sEventNames[eDOMEvents_wheel];
-  case NS_OFFLINE:
-    return sEventNames[eDOMEvents_offline];
-  case NS_ONLINE:
-    return sEventNames[eDOMEvents_online];
-  case NS_COPY:
-    return sEventNames[eDOMEvents_copy];
-  case NS_CUT:
-    return sEventNames[eDOMEvents_cut];
-  case NS_PASTE:
-    return sEventNames[eDOMEvents_paste];
-  case NS_OPEN:
-    return sEventNames[eDOMEvents_open];
-  case NS_MESSAGE:
-    return sEventNames[eDOMEvents_message];
-  case NS_SHOW_EVENT:
-    return sEventNames[eDOMEvents_show];
-  case NS_SVG_LOAD:
-    return sEventNames[eDOMEvents_SVGLoad];
-  case NS_SVG_UNLOAD:
-    return sEventNames[eDOMEvents_SVGUnload];
-  case NS_SVG_ABORT:
-    return sEventNames[eDOMEvents_SVGAbort];
-  case NS_SVG_ERROR:
-    return sEventNames[eDOMEvents_SVGError];
-  case NS_SVG_RESIZE:
-    return sEventNames[eDOMEvents_SVGResize];
-  case NS_SVG_SCROLL:
-    return sEventNames[eDOMEvents_SVGScroll];
-  case NS_SVG_ZOOM:
-    return sEventNames[eDOMEvents_SVGZoom];
-  case NS_TOUCH_START:
-    return sEventNames[eDOMEvents_touchstart];
-  case NS_TOUCH_MOVE:
-    return sEventNames[eDOMEvents_touchmove];
-  case NS_TOUCH_END:
-    return sEventNames[eDOMEvents_touchend];
-  case NS_TOUCH_ENTER:
-    return sEventNames[eDOMEvents_touchenter];
-  case NS_TOUCH_LEAVE:
-    return sEventNames[eDOMEvents_touchleave];
-  case NS_TOUCH_CANCEL:
-    return sEventNames[eDOMEvents_touchcancel];
-  case NS_SMIL_BEGIN:
-    return sEventNames[eDOMEvents_beginEvent];
-  case NS_SMIL_END:
-    return sEventNames[eDOMEvents_endEvent];
-  case NS_SMIL_REPEAT:
-    return sEventNames[eDOMEvents_repeatEvent];
-#ifdef MOZ_MEDIA
-  case NS_LOADSTART:
-    return sEventNames[eDOMEvents_loadstart];
-  case NS_PROGRESS:
-    return sEventNames[eDOMEvents_progress];
-  case NS_SUSPEND:
-    return sEventNames[eDOMEvents_suspend];
-  case NS_EMPTIED:
-    return sEventNames[eDOMEvents_emptied];
-  case NS_STALLED:
-    return sEventNames[eDOMEvents_stalled];
-  case NS_PLAY:
-    return sEventNames[eDOMEvents_play];
-  case NS_PAUSE:
-    return sEventNames[eDOMEvents_pause];
-  case NS_LOADEDMETADATA:
-    return sEventNames[eDOMEvents_loadedmetadata];
-  case NS_LOADEDDATA:
-    return sEventNames[eDOMEvents_loadeddata];
-  case NS_WAITING:
-    return sEventNames[eDOMEvents_waiting];
-  case NS_PLAYING:
-    return sEventNames[eDOMEvents_playing];
-  case NS_CANPLAY:
-    return sEventNames[eDOMEvents_canplay];
-  case NS_CANPLAYTHROUGH:
-    return sEventNames[eDOMEvents_canplaythrough];
-  case NS_SEEKING:
-    return sEventNames[eDOMEvents_seeking];
-  case NS_SEEKED:
-    return sEventNames[eDOMEvents_seeked];
-  case NS_TIMEUPDATE:
-    return sEventNames[eDOMEvents_timeupdate];
-  case NS_ENDED:
-    return sEventNames[eDOMEvents_ended];
-  case NS_RATECHANGE:
-    return sEventNames[eDOMEvents_ratechange];
-  case NS_DURATIONCHANGE:
-    return sEventNames[eDOMEvents_durationchange];
-  case NS_VOLUMECHANGE:
-    return sEventNames[eDOMEvents_volumechange];
-  case NS_MOZAUDIOAVAILABLE:
-    return sEventNames[eDOMEvents_mozaudioavailable];
-#endif
-  case NS_AFTERPAINT:
-    return sEventNames[eDOMEvents_afterpaint];
-  case NS_BEFORERESIZE_EVENT:
-    return sEventNames[eDOMEvents_beforeresize];
-  case NS_SIMPLE_GESTURE_SWIPE:
-    return sEventNames[eDOMEvents_MozSwipeGesture];
-  case NS_SIMPLE_GESTURE_MAGNIFY_START:
-    return sEventNames[eDOMEvents_MozMagnifyGestureStart];
-  case NS_SIMPLE_GESTURE_MAGNIFY_UPDATE:
-    return sEventNames[eDOMEvents_MozMagnifyGestureUpdate];
-  case NS_SIMPLE_GESTURE_MAGNIFY:
-    return sEventNames[eDOMEvents_MozMagnifyGesture];
-  case NS_SIMPLE_GESTURE_ROTATE_START:
-    return sEventNames[eDOMEvents_MozRotateGestureStart];
-  case NS_SIMPLE_GESTURE_ROTATE_UPDATE:
-    return sEventNames[eDOMEvents_MozRotateGestureUpdate];
-  case NS_SIMPLE_GESTURE_ROTATE:
-    return sEventNames[eDOMEvents_MozRotateGesture];
-  case NS_SIMPLE_GESTURE_TAP:
-    return sEventNames[eDOMEvents_MozTapGesture];
-  case NS_SIMPLE_GESTURE_PRESSTAP:
-    return sEventNames[eDOMEvents_MozPressTapGesture];
-  case NS_SIMPLE_GESTURE_EDGEUI:
-    return sEventNames[eDOMEvents_MozEdgeUIGesture];
-  case NS_MOZTOUCH_DOWN:
-    return sEventNames[eDOMEvents_MozTouchDown];
-  case NS_MOZTOUCH_MOVE:
-    return sEventNames[eDOMEvents_MozTouchMove];
-  case NS_MOZTOUCH_UP:
-    return sEventNames[eDOMEvents_MozTouchUp];
-  case NS_SCROLLEDAREACHANGED:
-    return sEventNames[eDOMEvents_MozScrolledAreaChanged];
-  case NS_TRANSITION_END:
-    return sEventNames[eDOMEvents_transitionend];
-  case NS_ANIMATION_START:
-    return sEventNames[eDOMEvents_animationstart];
-  case NS_ANIMATION_END:
-    return sEventNames[eDOMEvents_animationend];
-  case NS_ANIMATION_ITERATION:
-    return sEventNames[eDOMEvents_animationiteration];
-  case NS_DEVICE_MOTION:
-    return sEventNames[eDOMEvents_devicemotion];
-  case NS_DEVICE_ORIENTATION:
-    return sEventNames[eDOMEvents_deviceorientation];
-  case NS_DEVICE_PROXIMITY:
-    return sEventNames[eDOMEvents_deviceproximity];
-  case NS_USER_PROXIMITY:
-    return sEventNames[eDOMEvents_userproximity];
-  case NS_DEVICE_LIGHT:
-    return sEventNames[eDOMEvents_devicelight];
-  case NS_FULLSCREENCHANGE:
-    return sEventNames[eDOMEvents_mozfullscreenchange];
-  case NS_FULLSCREENERROR:
-    return sEventNames[eDOMEvents_mozfullscreenerror];
+#define ID_TO_EVENT(name_, _id, _type, _struct) \
+  case _id: return #name_;
+#include "nsEventNameList.h"
+#undef ID_TO_EVENT
   default:
     break;
   }
   // XXXldb We can hit this case for nsEvent objects that we didn't
   // create and that are not user defined events since this function and
   // SetEventType are incomplete.  (But fixing that requires fixing the
   // arrays in nsEventListenerManager too, since the events for which
   // this is a problem generally *are* created by nsDOMEvent.)
--- a/content/events/src/nsDOMEvent.h
+++ b/content/events/src/nsDOMEvent.h
@@ -22,170 +22,16 @@ class nsPresContext;
 struct JSContext;
 struct JSObject;
  
 class nsDOMEvent : public nsIDOMEvent,
                    public nsIJSNativeInitializer
 {
 public:
 
-  // Note: this enum must be kept in sync with sEventNames in nsDOMEvent.cpp
-  enum nsDOMEvents {
-    eDOMEvents_mousedown=0,
-    eDOMEvents_mouseup,
-    eDOMEvents_click,
-    eDOMEvents_dblclick,
-    eDOMEvents_mouseenter,
-    eDOMEvents_mouseleave,
-    eDOMEvents_mouseover,
-    eDOMEvents_mouseout,
-    eDOMEvents_MozMouseHittest,
-    eDOMEvents_mousemove,
-    eDOMEvents_contextmenu,
-    eDOMEvents_keydown,
-    eDOMEvents_keyup,
-    eDOMEvents_keypress,
-    eDOMEvents_focus,
-    eDOMEvents_blur,
-    eDOMEvents_load,
-    eDOMEvents_popstate,
-    eDOMEvents_beforescriptexecute,
-    eDOMEvents_afterscriptexecute,
-    eDOMEvents_beforeunload,
-    eDOMEvents_unload,
-    eDOMEvents_hashchange,
-    eDOMEvents_readystatechange,
-    eDOMEvents_abort,
-    eDOMEvents_error,
-    eDOMEvents_submit,
-    eDOMEvents_reset,
-    eDOMEvents_change,
-    eDOMEvents_select,
-    eDOMEvents_input,
-    eDOMEvents_invalid,
-    eDOMEvents_text,
-    eDOMEvents_compositionstart,
-    eDOMEvents_compositionend,
-    eDOMEvents_compositionupdate,
-    eDOMEvents_popupShowing,
-    eDOMEvents_popupShown,
-    eDOMEvents_popupHiding,
-    eDOMEvents_popupHidden,
-    eDOMEvents_close,
-    eDOMEvents_command,
-    eDOMEvents_broadcast,
-    eDOMEvents_commandupdate,
-    eDOMEvents_dragenter,
-    eDOMEvents_dragover,
-    eDOMEvents_dragexit,
-    eDOMEvents_dragdrop,
-    eDOMEvents_draggesture,
-    eDOMEvents_drag,
-    eDOMEvents_dragend,
-    eDOMEvents_dragstart,
-    eDOMEvents_dragleave,
-    eDOMEvents_drop,
-    eDOMEvents_resize,
-    eDOMEvents_scroll,
-    eDOMEvents_overflow,
-    eDOMEvents_underflow,
-    eDOMEvents_overflowchanged,
-    eDOMEvents_subtreemodified,
-    eDOMEvents_nodeinserted,
-    eDOMEvents_noderemoved,
-    eDOMEvents_noderemovedfromdocument,
-    eDOMEvents_nodeinsertedintodocument,
-    eDOMEvents_attrmodified,
-    eDOMEvents_characterdatamodified,
-    eDOMEvents_DOMActivate,
-    eDOMEvents_DOMFocusIn,
-    eDOMEvents_DOMFocusOut,
-    eDOMEvents_pageshow,
-    eDOMEvents_pagehide,
-    eDOMEvents_DOMMouseScroll,
-    eDOMEvents_MozMousePixelScroll,
-    eDOMEvents_wheel,
-    eDOMEvents_offline,
-    eDOMEvents_online,
-    eDOMEvents_copy,
-    eDOMEvents_cut,
-    eDOMEvents_paste,
-    eDOMEvents_open,
-    eDOMEvents_message,
-    eDOMEvents_show,
-    eDOMEvents_SVGLoad,
-    eDOMEvents_SVGUnload,
-    eDOMEvents_SVGAbort,
-    eDOMEvents_SVGError,
-    eDOMEvents_SVGResize,
-    eDOMEvents_SVGScroll,
-    eDOMEvents_SVGZoom,
-    eDOMEvents_beginEvent,
-    eDOMEvents_endEvent,
-    eDOMEvents_repeatEvent,
-#ifdef MOZ_MEDIA
-    eDOMEvents_loadstart,
-    eDOMEvents_progress,
-    eDOMEvents_suspend,
-    eDOMEvents_emptied,
-    eDOMEvents_stalled,
-    eDOMEvents_play,
-    eDOMEvents_pause,
-    eDOMEvents_loadedmetadata,
-    eDOMEvents_loadeddata,
-    eDOMEvents_waiting,
-    eDOMEvents_playing,
-    eDOMEvents_canplay,
-    eDOMEvents_canplaythrough,
-    eDOMEvents_seeking,
-    eDOMEvents_seeked,
-    eDOMEvents_timeupdate,
-    eDOMEvents_ended,
-    eDOMEvents_ratechange,
-    eDOMEvents_durationchange,
-    eDOMEvents_volumechange,
-    eDOMEvents_mozaudioavailable,
-#endif
-    eDOMEvents_afterpaint,
-    eDOMEvents_beforeresize,
-    eDOMEvents_mozfullscreenchange,
-    eDOMEvents_mozfullscreenerror,
-    eDOMEvents_mozpointerlockchange,
-    eDOMEvents_mozpointerlockerror,
-    eDOMEvents_MozSwipeGesture,
-    eDOMEvents_MozMagnifyGestureStart,
-    eDOMEvents_MozMagnifyGestureUpdate,
-    eDOMEvents_MozMagnifyGesture,
-    eDOMEvents_MozRotateGestureStart,
-    eDOMEvents_MozRotateGestureUpdate,
-    eDOMEvents_MozRotateGesture,
-    eDOMEvents_MozTapGesture,
-    eDOMEvents_MozPressTapGesture,
-    eDOMEvents_MozEdgeUIGesture,
-    eDOMEvents_MozTouchDown,
-    eDOMEvents_MozTouchMove,
-    eDOMEvents_MozTouchUp,
-    eDOMEvents_touchstart,
-    eDOMEvents_touchend,
-    eDOMEvents_touchmove,
-    eDOMEvents_touchcancel,
-    eDOMEvents_touchenter,
-    eDOMEvents_touchleave,
-    eDOMEvents_MozScrolledAreaChanged,
-    eDOMEvents_transitionend,
-    eDOMEvents_animationstart,
-    eDOMEvents_animationend,
-    eDOMEvents_animationiteration,
-    eDOMEvents_devicemotion,
-    eDOMEvents_deviceorientation,
-    eDOMEvents_deviceproximity,
-    eDOMEvents_userproximity,
-    eDOMEvents_devicelight
-  };
-
   nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent);
   virtual ~nsDOMEvent();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMEvent, nsIDOMEvent)
 
   // nsIDOMEvent Interface
   NS_DECL_NSIDOMEVENT
--- a/content/media/wave/nsWaveReader.cpp
+++ b/content/media/wave/nsWaveReader.cpp
@@ -431,20 +431,22 @@ nsWaveReader::LoadFormatChunk()
 
   // RIFF chunks are always word (two byte) aligned.
   NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0,
                     "LoadFormatChunk left resource unaligned");
 
   // Make sure metadata is fairly sane.  The rate check is fairly arbitrary,
   // but the channels check is intentionally limited to mono or stereo
   // because that's what the audio backend currently supports.
+  unsigned int actualFrameSize = sampleFormat == 8 ? 1 : 2 * channels;
   if (rate < 100 || rate > 96000 ||
       channels < 1 || channels > MAX_CHANNELS ||
       (frameSize != 1 && frameSize != 2 && frameSize != 4) ||
-      (sampleFormat != 8 && sampleFormat != 16)) {
+      (sampleFormat != 8 && sampleFormat != 16) ||
+      frameSize != actualFrameSize) {
     NS_WARNING("Invalid WAVE metadata");
     return false;
   }
 
   ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
   mSampleRate = rate;
   mChannels = channels;
   mFrameSize = frameSize;
--- a/js/src/config/Makefile.in
+++ b/js/src/config/Makefile.in
@@ -10,17 +10,17 @@ VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # For sanity's sake, we compile nsinstall without the wrapped system
 # headers, so that we can use it to set up the wrapped system headers.
 VISIBILITY_FLAGS =
 
 ifneq (WINNT,$(HOST_OS_ARCH))
-HOST_PROGRAM	= nsinstall_real$(HOST_BIN_SUFFIX)
+HOST_PROGRAM	= nsinstall$(HOST_BIN_SUFFIX)
 HOST_CSRCS	= nsinstall.c pathsub.c
 endif
 
 TARGETS		= $(HOST_PROGRAM) $(SIMPLE_PROGRAMS)
 
 # IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have
 # a recursive rule for finding nsinstall and the Perl scripts.
 ifdef NSBUILDROOT
@@ -36,29 +36,24 @@ include $(topsrcdir)/config/config.mk
 # Do not install util programs
 NO_INSTALL=1
 
 # Force wrap zlib system header if building js as a shared library.
 ifneq (,$(JS_SHARED_LIBRARY)$(MOZ_NATIVE_ZLIB))
 DEFINES += -DMOZ_NATIVE_ZLIB=1
 endif
 
-ifneq (WINNT,$(HOST_OS_ARCH))
-export:: nsinstall$(HOST_BIN_SUFFIX)
-# Ensure nsinstall is atomically created
-nsinstall$(HOST_BIN_SUFFIX): $(HOST_PROGRAM)
-	cp $^ $@.tmp
-	mv $@.tmp $@
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 HOST_CFLAGS += -DUNICODE -D_UNICODE
 
 export:: $(TARGETS)
+ifdef HOST_PROGRAM
+	$(INSTALL) $(HOST_PROGRAM) $(DIST)/bin
+endif
 
 ifdef WRAP_SYSTEM_INCLUDES
 export:: \
   $(call mkdir_deps,system_wrappers_js) \
   $(NULL)
 	$(PYTHON) $(srcdir)/Preprocessor.py $(DEFINES) $(ACDEFINES) \
 		$(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers_js
 	$(INSTALL) system_wrappers_js $(DIST)
--- a/js/src/config/makefiles/target_export.mk
+++ b/js/src/config/makefiles/target_export.mk
@@ -22,17 +22,17 @@ export_tier_%:
 #################
 ifdef PARALLEL_DIRS
 export:: $(PARALLEL_DIRS_export)
 
 $(PARALLEL_DIRS_export): %_export: %/Makefile
 	+@$(call SUBMAKE,export,$*)
 endif
 
-export:: $(SUBMAKEFILES) $(MAKE_DIRS)
+export:: $(SUBMAKEFILES) $(MAKE_DIRS) $(if $(XPIDLSRCS),$(IDL_DIR))
 	$(LOOP_OVER_DIRS)
 	$(LOOP_OVER_TOOL_DIRS)
 
 
 #
 # Rule to create list of libraries for final link
 #
 # todo: use pre-req deps rather than conditionals
new file mode 100644
--- /dev/null
+++ b/js/src/config/makefiles/xpidl.mk
@@ -0,0 +1,60 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+# Always declared, general use by:
+# js/xpconnect/tests/idl/Makefile.in:libs
+# toolkit/crashreporter/test/Makefile.in
+XPIDL_GEN_DIR ?= _xpidlgen
+GARBAGE_DIRS  += $(XPIDL_GEN_DIR)
+
+
+###########################################################################
+## Conditional logic
+###########################################################################
+ifndef INCLUDED_XPIDL_MK #{
+  INCLUDED_XPIDL_MK = 1
+
+  ifneq (,$(XPIDLSRCS)) #{
+
+    ifndef NO_DIST_INSTALL #{
+      _xpidl-todo_ += xpidl-install-src
+      _xpidl-todo_ += xpidl-install-headers
+    endif #}
+
+  endif #} XPIDLSRCS
+
+  export:: $(_xpidl-todo_)
+
+  $(call requiredfunction,mkdir_deps)
+endif #} INCLUDED_XPIDL_MK
+
+
+###########################################################################
+## processing targets
+###########################################################################
+ifdef _xpidl-todo_ #{
+
+$(call requiredfunction,install_cmd)
+
+## Logic batch #1
+xpidl-install-src-preqs=\
+  $(XPIDLSRCS) \
+  $(call mkdir_deps,$(IDL_DIR)) \
+  $(NULL)
+
+xpidl-install-src: $(xpidl-install-src-preqs)
+	$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
+
+xpidl-install-headers-preqs =\
+  $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
+  $(call mkdir_deps,$(DIST)/include) \
+  $(NULL)
+xpidl-install-headers: $(xpidl-install-headers-preqs)
+	$(call install_cmd,$(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val))))
+
+endif #} _xpidl-todo_
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -1154,29 +1154,25 @@ ifneq ($(XPI_NAME),)
 $(FINAL_TARGET):
 	$(NSINSTALL) -D $@
 
 export:: $(FINAL_TARGET)
 endif
 
 ifndef NO_DIST_INSTALL
 ifneq (,$(EXPORTS))
-EXPORTS_FILES := $(EXPORTS)
-EXPORTS_DEST := $(DIST)/include
-EXPORTS_TARGET := export
-INSTALL_TARGETS += EXPORTS
+export:: $(EXPORTS)
+	$(call install_cmd,$(IFLAGS1) $^ $(DIST)/include)
 endif
 endif # NO_DIST_INSTALL
 
 define EXPORT_NAMESPACE_RULE
 ifndef NO_DIST_INSTALL
-EXPORTS_$(namespace)_FILES := $$(EXPORTS_$(namespace))
-EXPORTS_$(namespace)_DEST := $$(DIST)/include/$(namespace)
-EXPORTS_$(namespace)_TARGET := export
-INSTALL_TARGETS += EXPORTS_$(namespace)
+export:: $(EXPORTS_$(namespace))
+	$(call install_cmd,$(IFLAGS1) $$^ $(DIST)/include/$(namespace))
 endif # NO_DIST_INSTALL
 endef
 
 $(foreach namespace,$(EXPORTS_NAMESPACES),$(eval $(EXPORT_NAMESPACE_RULE)))
 
 ################################################################################
 # Copy each element of PREF_JS_EXPORTS
 
@@ -1202,22 +1198,24 @@ PREF_JS_EXPORTS_FLAGS := $(PREF_PPFLAGS)
 PP_TARGETS += PREF_JS_EXPORTS
 endif
 endif
 
 ################################################################################
 # Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
 
 ifneq ($(AUTOCFG_JS_EXPORTS),)
+$(FINAL_TARGET)/defaults/autoconfig::
+	$(NSINSTALL) -D $@
+
 ifndef NO_DIST_INSTALL
-AUTOCFG_JS_EXPORTS_FILES := $(AUTOCFG_JS_EXPORTS)
-AUTOCFG_JS_EXPORTS_DEST := $(FINAL_TARGET)/defaults/autoconfig
-AUTOCFG_JS_EXPORTS_TARGET := export
-INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
+export:: $(AUTOCFG_JS_EXPORTS) $(FINAL_TARGET)/defaults/autoconfig
+	$(call install_cmd,$(IFLAGS1) $^)
 endif
+
 endif
 
 ################################################################################
 # Export the elements of $(XPIDLSRCS)
 # generating .h and .xpt files and moving them to the appropriate places.
 
 ifneq ($(XPIDLSRCS),) #{
 
@@ -1268,46 +1266,48 @@ xpidl-preqs = \
 	  $(LIBXUL_DIST)/sdk/bin/typelib.py $(XPIDL_FLAGS) $(_VPATH_SRCS) -d $(MDDEPDIR)/$(@F).pp -o $@
 
 # no need to link together if XPIDLSRCS contains only XPIDL_MODULE
 ifneq ($(XPIDL_MODULE).idl,$(strip $(XPIDLSRCS)))
 $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS)) $(GLOBAL_DEPS)
 	$(XPIDL_LINK) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.xpt,$(XPIDLSRCS))
 endif # XPIDL_MODULE.xpt != XPIDLSRCS
 
+libs:: $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
 ifndef NO_DIST_INSTALL
-XPIDL_MODULE_FILES := $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
-XPIDL_MODULE_DEST := $(FINAL_TARGET)/components
-INSTALL_TARGETS += XPIDL_MODULE
-
+	$(call install_cmd,$(IFLAGS1) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt $(FINAL_TARGET)/components)
 ifndef NO_INTERFACES_MANIFEST
 libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPIDL_MODULE).xpt"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
 endif
 endif
 
 GARBAGE_DIRS		+= $(XPIDL_GEN_DIR)
 
-ifndef NO_DIST_INSTALL
-XPIDL_HEADERS_FILES := $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))
-XPIDL_HEADERS_DEST := $(DIST)/include
-XPIDL_HEADERS_TARGET := export
-INSTALL_TARGETS += XPIDL_HEADERS
-
-XPIDLSRCS_FILES := $(XPIDLSRCS)
-XPIDLSRCS_DEST := $(IDL_DIR)
-XPIDLSRCS_TARGET := export-idl
-INSTALL_TARGETS += XPIDLSRCS
-
-export:: export-idl
-endif
 endif #} XPIDLSRCS
 
+
+ifndef INCLUDED_XPIDL_MK
+  include $(topsrcdir)/config/makefiles/xpidl.mk
+endif
+
+
+# General rules for exporting idl files.
+$(IDL_DIR):
+	$(NSINSTALL) -D $@
+
 export-idl:: $(SUBMAKEFILES) $(MAKE_DIRS)
+
+ifneq ($(XPIDLSRCS),)
+ifndef NO_DIST_INSTALL
+export-idl:: $(XPIDLSRCS) $(IDL_DIR)
+	$(call install_cmd,$(IFLAGS1) $^)
+endif
+endif
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
 	$(LOOP_OVER_TOOL_DIRS)
 
 ################################################################################
 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
 ifneq (,$(filter %.js,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
 ifeq (,$(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
@@ -1315,19 +1315,17 @@ ifndef NO_JS_MANIFEST
 $(error .js component without matching .manifest. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0)
 endif
 endif
 endif
 
 ifdef EXTRA_COMPONENTS
 libs:: $(EXTRA_COMPONENTS)
 ifndef NO_DIST_INSTALL
-EXTRA_COMPONENTS_FILES := $(EXTRA_COMPONENTS)
-EXTRA_COMPONENTS_DEST := $(FINAL_TARGET)/components
-INSTALL_TARGETS += EXTRA_COMPONENTS
+	$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/components)
 endif
 
 endif
 
 ifdef EXTRA_PP_COMPONENTS
 ifndef NO_DIST_INSTALL
 EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
 PP_TARGETS += EXTRA_PP_COMPONENTS
@@ -1341,21 +1339,21 @@ libs:: $(call mkdir_deps,$(FINAL_TARGET)
 endif
 
 ################################################################################
 # Copy each element of EXTRA_JS_MODULES to JS_MODULES_PATH, or
 # $(FINAL_TARGET)/modules if that isn't defined.
 JS_MODULES_PATH ?= $(FINAL_TARGET)/modules
 
 ifdef EXTRA_JS_MODULES
+libs:: $(EXTRA_JS_MODULES)
 ifndef NO_DIST_INSTALL
-EXTRA_JS_MODULES_FILES := $(EXTRA_JS_MODULES)
-EXTRA_JS_MODULES_DEST := $(JS_MODULES_PATH)
-INSTALL_TARGETS += EXTRA_JS_MODULES
+	$(call install_cmd,$(IFLAGS1) $^ $(JS_MODULES_PATH))
 endif
+
 endif
 
 ifdef EXTRA_PP_JS_MODULES
 ifndef NO_DIST_INSTALL
 EXTRA_PP_JS_MODULES_PATH := $(JS_MODULES_PATH)
 PP_TARGETS += EXTRA_PP_JS_MODULES
 endif
 endif
@@ -1367,41 +1365,46 @@ endif
 # objdir/_tests/modules/. If TESTING_JS_MODULE_DIR is defined, that path
 # wlll be appended to the output directory.
 
 ifdef TESTING_JS_MODULES
 testmodulesdir = $(DEPTH)/_tests/modules/$(TESTING_JS_MODULE_DIR)
 
 GENERATED_DIRS += $(testmodulesdir)
 
+libs:: $(TESTING_JS_MODULES)
 ifndef NO_DIST_INSTALL
-TESTING_JS_MODULES_FILES := $(TESTING_JS_MODULES)
-TESTING_JS_MODULES_DEST := $(testmodulesdir)
-INSTALL_TARGETS += TESTING_JS_MODULES
+	$(call install_cmd,$(IFLAGS) $^ $(testmodulesdir))
 endif
 
 endif
 
 ################################################################################
 # SDK
 
 ifneq (,$(SDK_LIBRARY))
+$(SDK_LIB_DIR)::
+	$(NSINSTALL) -D $@
+
 ifndef NO_DIST_INSTALL
-SDK_LIBRARY_FILES := $(SDK_LIBRARY)
-SDK_LIBRARY_DEST := $(SDK_LIB_DIR)
-INSTALL_TARGETS += SDK_LIBRARY
+libs:: $(SDK_LIBRARY) $(SDK_LIB_DIR)
+	$(call install_cmd,$(IFLAGS2) $^)
 endif
+
 endif # SDK_LIBRARY
 
 ifneq (,$(strip $(SDK_BINARY)))
+$(SDK_BIN_DIR)::
+	$(NSINSTALL) -D $@
+
 ifndef NO_DIST_INSTALL
-SDK_BINARY_FILES := $(SDK_BINARY)
-SDK_BINARY_DEST := $(SDK_BIN_DIR)
-INSTALL_TARGETS += SDK_BINARY
+libs:: $(SDK_BINARY) $(SDK_BIN_DIR)
+	$(call install_cmd,$(IFLAGS2) $^)
 endif
+
 endif # SDK_BINARY
 
 ################################################################################
 # CHROME PACKAGING
 
 JAR_MANIFEST := $(srcdir)/jar.mn
 
 chrome::
@@ -1527,78 +1530,61 @@ TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
 	$(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
 endif
 endif
 
 ################################################################################
 # Install/copy rules
 #
 # The INSTALL_TARGETS variable contains a list of all install target
-# categories. Each category defines a list of files and executables, and an
-# install destination,
+# categories. Each category defines a list of files, an install destination,
+# and whether the files are executables or not.
 #
 # FOO_FILES := foo bar
 # FOO_EXECUTABLES := baz
 # FOO_DEST := target_path
 # INSTALL_TARGETS += FOO
-#
-# Additionally, a FOO_TARGET variable may be added to indicate the target for
-# which the files and executables are installed. Default is "libs".
-
-# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
-ifneq (,$(filter $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX),$(install_cmd)))
-nsinstall_is_usable = $(if $(wildcard $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)),$(eval nsinstall_is_usable := yes)yes)
-
-define install_cmd_override
-$(1): install_cmd = $$(if $$(nsinstall_is_usable),$$(INSTALL),$$(NSINSTALL_PY)) $$(1)
-endef
-endif
-
 define install_file_template
-$(or $(3),libs):: $(2)/$(notdir $(1))
-$(call install_cmd_override,$(2)/$(notdir $(1)))
+libs:: $(2)/$(notdir $(1))
 $(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2))
-	$$(call install_cmd,$(4) $$< $${@D})
+	$(INSTALL) $(3) $$< $${@D}
 endef
 $(foreach category,$(INSTALL_TARGETS),\
   $(if $($(category)_DEST),,$(error Missing $(category)_DEST))\
   $(foreach file,$($(category)_FILES),\
-    $(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS1)))\
+    $(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS1)))\
   )\
   $(foreach file,$($(category)_EXECUTABLES),\
-    $(eval $(call install_file_template,$(file),$($(category)_DEST),$($(category)_TARGET),$(IFLAGS2)))\
+    $(eval $(call install_file_template,$(file),$($(category)_DEST),$(IFLAGS2)))\
   )\
 )
 
 ################################################################################
 # Preprocessing rules
 #
 # The PP_TARGETS variable contains a list of all preprocessing target
 # categories. Each category defines a target path, and optional extra flags
 # like the following:
 #
 # FOO_PATH := target_path
 # FOO_FLAGS := -Dsome_flag
 # PP_TARGETS += FOO
-#
-# Additionally, a FOO_TARGET variable may be added to indicate the target for
-# which the files and executables are installed. Default is "libs".
 
 # preprocess_file_template defines preprocessing rules.
 # $(call preprocess_file_template, source_file, target_path, extra_flags)
 define preprocess_file_template
 $(2)/$(notdir $(1)): $(1) $$(call mkdir_deps,$(2)) $$(GLOBAL_DEPS)
 	$$(RM) $$@
-	$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(4) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
-$(or $(3),libs):: $(2)/$(notdir $(1))
+	$$(PYTHON) $$(topsrcdir)/config/Preprocessor.py $(3) $$(DEFINES) $$(ACDEFINES) $$(XULPPFLAGS) $$< > $$@
+libs:: $(2)/$(notdir $(1))
 endef
 
 $(foreach category,$(PP_TARGETS),\
   $(foreach file,$($(category)),\
-    $(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_TARGET),$($(category)_FLAGS)))\
+    $(eval $(call preprocess_file_template,$(file),$($(category)_PATH),$($(category)_FLAGS)))\
    )\
  )
 
 ################################################################################
 # Special gmake rules.
 ################################################################################
 
 
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -1,16 +1,16 @@
 #filter substitution
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 chrome.jar:
-% content browser %content/
+% content browser %content/ contentaccessible=yes
 
 * content/about.xhtml                  (content/about.xhtml)
   content/config.xhtml                 (content/config.xhtml)
   content/aboutAddons.xhtml            (content/aboutAddons.xhtml)
   content/aboutAddons.js               (content/aboutAddons.js)
   content/aboutCertError.xhtml         (content/aboutCertError.xhtml)
   content/aboutDownloads.xhtml         (content/aboutDownloads.xhtml)
   content/aboutDownloads.js            (content/aboutDownloads.js)
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -244,17 +244,16 @@ class nsHashKey;
 // Scroll events
 #define NS_MOUSE_SCROLL_START         1600
 #define NS_MOUSE_SCROLL               (NS_MOUSE_SCROLL_START)
 #define NS_MOUSE_PIXEL_SCROLL         (NS_MOUSE_SCROLL_START + 1)
 
 #define NS_SCROLLPORT_START           1700
 #define NS_SCROLLPORT_UNDERFLOW       (NS_SCROLLPORT_START)
 #define NS_SCROLLPORT_OVERFLOW        (NS_SCROLLPORT_START+1)
-#define NS_SCROLLPORT_OVERFLOWCHANGED (NS_SCROLLPORT_START+2)
 
 // Mutation events defined elsewhere starting at 1800
 
 #define NS_USER_DEFINED_EVENT         2000
  
 // composition events
 #define NS_COMPOSITION_EVENT_START    2200
 #define NS_COMPOSITION_START          (NS_COMPOSITION_EVENT_START)