Merge from mozilla-central.
authorDavid Anderson <danderson@mozilla.com>
Mon, 06 Aug 2012 12:44:06 -0700
changeset 106678 b8084b0700fa586f1208dfe58076d1cb7cff2edc
parent 106677 0bc212d0183b8c9a9e21db665b6dc25c686a9650 (current diff)
parent 101606 cdc84c93ffe3d88d0fc5880b3db181c500b26db0 (diff)
child 106679 b2361e15b665b003f22de07c2deb3ab68669a4c1
push id14706
push usereakhgari@mozilla.com
push dateTue, 11 Sep 2012 20:39:52 +0000
treeherdermozilla-inbound@d50bf1edaabe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge from mozilla-central.
accessible/src/base/Makefile.in
accessible/src/generic/RootAccessible.cpp
accessible/src/msaa/DocAccessibleWrap.cpp
accessible/src/msaa/nsAccessNodeWrap.cpp
accessible/src/xul/Makefile.in
accessible/src/xul/XULTabAccessible.cpp
accessible/tests/mochitest/Makefile.in
accessible/tests/mochitest/actions/Makefile.in
accessible/tests/mochitest/events/Makefile.in
accessible/tests/mochitest/states/Makefile.in
accessible/tests/mochitest/tree/Makefile.in
aclocal.m4
b2g/installer/package-manifest.in
browser/base/content/browser.xul
browser/base/content/test/test_contextmenu.html
browser/base/jar.mn
browser/components/feeds/test/Makefile.in
browser/components/feeds/test/chrome/Makefile.in
browser/components/sessionstore/test/Makefile.in
browser/components/tabview/test/Makefile.in
browser/devtools/highlighter/Makefile.in
browser/devtools/highlighter/test/Makefile.in
browser/devtools/webconsole/test/Makefile.in
browser/modules/WebappsIconHelpers.js
browser/modules/WebappsInstaller.jsm
build/autoconf/acoutput-fast.pl
build/autoconf/make-makefile
build/autoconf/make-makefile.excl
build/autoconf/makemakefile.pm
build/autoconf/test/Makefile.in
build/autoconf/test/data/mf.notokens
build/autoconf/test/data/mf.notokens.exp
build/autoconf/test/make-makefile.excl
build/autoconf/test/make-makefile.tpl
build/autoconf/test/makemakefile.tpm
build/autoconf/test/runtest
config/add-chrome.pl
config/autoconf.mk.in
configure.in
content/base/public/nsContentUtils.h
content/base/src/Makefile.in
content/base/src/nsAttrAndChildArray.cpp
content/base/src/nsAttrAndChildArray.h
content/base/src/nsContentAreaDragDrop.cpp
content/base/src/nsContentAreaDragDrop.h
content/base/src/nsContentUtils.cpp
content/base/src/nsDOMFile.cpp
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/base/src/nsINode.cpp
content/base/src/nsMappedAttributes.cpp
content/base/src/nsMappedAttributes.h
content/base/src/nsObjectLoadingContent.h
content/base/src/nsRange.cpp
content/base/src/nsScriptLoader.cpp
content/base/src/nsTreeSanitizer.cpp
content/base/src/nsXMLHttpRequest.cpp
content/base/src/nsXMLHttpRequest.h
content/base/test/Makefile.in
content/canvas/src/Makefile.in
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/canvas/test/test_canvas.html
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMEvent.h
content/events/src/nsDOMUIEvent.h
content/events/src/nsEventDispatcher.cpp
content/events/src/nsEventListenerManager.cpp
content/events/src/nsEventStateManager.cpp
content/events/src/nsEventStateManager.h
content/events/src/nsIMEStateManager.cpp
content/events/test/Makefile.in
content/html/content/public/nsHTMLCanvasElement.h
content/html/content/public/nsIRadioGroupContainer.h
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLBodyElement.cpp
content/html/content/src/nsHTMLButtonElement.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/html/content/src/nsHTMLFormElement.h
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLInputElement.h
content/html/content/src/nsHTMLMediaElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/content/src/nsHTMLVideoElement.cpp
content/media/nsAudioStream.cpp
content/media/nsBuiltinDecoder.h
content/media/raw/Makefile.in
content/svg/content/src/Makefile.in
content/svg/content/src/nsSVGGradientElement.cpp
content/svg/content/src/nsSVGPatternElement.cpp
content/svg/content/src/nsSVGTextElement.cpp
content/xbl/src/nsXBLEventHandler.cpp
content/xbl/src/nsXBLPrototypeHandler.cpp
content/xbl/src/nsXBLWindowKeyHandler.cpp
content/xml/document/test/Makefile.in
content/xslt/src/xslt/txMozillaXMLOutput.cpp
content/xul/content/src/nsXULElement.cpp
content/xul/content/src/nsXULPopupListener.cpp
content/xul/content/src/nsXULPopupListener.h
content/xul/document/src/nsXULContentSink.cpp
db/sqlite3/src/Makefile.in
docshell/base/nsDocShell.cpp
dom/Makefile.in
dom/base/ConsoleAPI.js
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsFocusManager.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
dom/base/nsPIDOMWindow.h
dom/bindings/Codegen.py
dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_setrequestheader-invalid-arguments.htm.json
dom/interfaces/core/Makefile.in
dom/ipc/ContentParent.h
dom/ipc/Makefile.in
dom/ipc/TabChild.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/src/Makefile.in
dom/tests/browser/browser_ConsoleAPITests.js
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
editor/libeditor/base/nsEditorEventListener.cpp
editor/libeditor/html/nsHTMLEditorEventListener.cpp
editor/libeditor/text/tests/Makefile.in
embedding/android/Makefile.in
embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
extensions/pref/Makefile.in
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
extensions/widgetutils/src/nsWidgetUtils.cpp
gfx/2d/QuartzSupport.mm
gfx/angle/Makefile.in
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libGLESv2/Makefile.in
gfx/gl/GLContext.cpp
gfx/harfbuzz/src/hb-ot-shape.cc
gfx/layers/ImageLayers.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/basic/BasicImageLayer.cpp
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/thebes/gfx3DMatrix.cpp
gfx/thebes/gfx3DMatrix.h
gfx/thebes/gfxFont.h
gfx/thebes/gfxHarfBuzzShaper.cpp
image/test/mochitest/Makefile.in
js/src/Makefile.in
js/src/build/autoconf/acoutput-fast.pl
js/src/build/autoconf/make-makefile
js/src/build/autoconf/make-makefile.excl
js/src/build/autoconf/makemakefile.pm
js/src/config/autoconf.mk.in
js/src/configure.in
js/src/jsapi-tests/Makefile.in
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jsnum.cpp
js/src/jsstr.cpp
js/src/jswrapper.cpp
js/src/jswrapper.h
js/xpconnect/src/Makefile.in
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/dom_quickstubs.qsconf
js/xpconnect/src/qsgen.py
js/xpconnect/src/xpcpublic.h
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
layout/base/nsBidiPresUtils.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSRenderingBorders.cpp
layout/base/nsDisplayList.cpp
layout/base/nsFrameIterator.cpp
layout/base/nsFrameIterator.h
layout/base/nsFrameTraversal.cpp
layout/base/nsFrameTraversal.h
layout/base/nsIFrameTraversal.h
layout/base/nsIPresShell.h
layout/base/nsPresContext.h
layout/base/nsPresShell.cpp
layout/base/nsRefreshDriver.cpp
layout/base/tests/Makefile.in
layout/build/Makefile.in
layout/build/nsLayoutModule.cpp
layout/build/nsLayoutStatics.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsIFrame.h
layout/generic/nsIScrollableFrame.h
layout/generic/nsImageFrame.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsSelection.cpp
layout/generic/nsTextFrame.h
layout/generic/nsTextFrameThebes.cpp
layout/ipc/RenderFrameParent.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/style/AnimationCommon.cpp
layout/style/Loader.cpp
layout/style/StyleRule.cpp
layout/style/nsCSSParser.cpp
layout/style/nsCSSRules.cpp
layout/style/nsCSSRules.h
layout/style/nsCSSStyleSheet.cpp
layout/style/nsCSSStyleSheet.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/nsDOMCSSAttrDeclaration.cpp
layout/style/nsDOMCSSAttrDeclaration.h
layout/style/nsFontFaceLoader.cpp
layout/style/nsHTMLCSSStyleSheet.cpp
layout/style/nsHTMLStyleSheet.cpp
layout/style/nsHTMLStyleSheet.h
layout/style/nsRuleNode.cpp
layout/style/nsStyleContext.cpp
layout/style/nsStyleSet.cpp
layout/style/test/Makefile.in
layout/svg/base/src/nsSVGEffects.cpp
layout/svg/base/src/nsSVGEffects.h
layout/svg/base/src/nsSVGGeometryFrame.cpp
layout/svg/base/src/nsSVGGeometryFrame.h
layout/svg/base/src/nsSVGGlyphFrame.cpp
layout/svg/base/src/nsSVGPaintServerFrame.cpp
layout/svg/base/src/nsSVGPaintServerFrame.h
layout/svg/base/src/nsSVGUtils.cpp
layout/svg/base/src/nsSVGUtils.h
layout/tables/BasicTableLayoutStrategy.cpp
layout/tables/nsTablePainter.h
layout/xul/base/src/grid/nsGrid.cpp
layout/xul/base/src/grid/nsGrid.h
layout/xul/base/src/grid/nsGridCell.h
layout/xul/base/src/grid/nsGridLayout2.cpp
layout/xul/base/src/grid/nsGridLayout2.h
layout/xul/base/src/grid/nsGridRow.cpp
layout/xul/base/src/grid/nsGridRow.h
layout/xul/base/src/grid/nsGridRowGroupLayout.cpp
layout/xul/base/src/grid/nsGridRowGroupLayout.h
layout/xul/base/src/grid/nsGridRowLayout.cpp
layout/xul/base/src/grid/nsGridRowLayout.h
layout/xul/base/src/grid/nsGridRowLeafLayout.cpp
layout/xul/base/src/grid/nsIGridPart.h
layout/xul/base/src/nsBox.cpp
layout/xul/base/src/nsBox.h
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsBoxFrame.h
layout/xul/base/src/nsBoxLayoutState.h
layout/xul/base/src/nsGroupBoxFrame.cpp
layout/xul/base/src/nsImageBoxFrame.cpp
layout/xul/base/src/nsImageBoxFrame.h
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/nsListBoxBodyFrame.h
layout/xul/base/src/nsListBoxLayout.cpp
layout/xul/base/src/nsListItemFrame.h
layout/xul/base/src/nsMenuBarListener.cpp
layout/xul/base/src/nsMenuBoxObject.cpp
layout/xul/base/src/nsMenuFrame.cpp
layout/xul/base/src/nsMenuFrame.h
layout/xul/base/src/nsPopupBoxObject.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsSliderFrame.h
layout/xul/base/src/nsSplitterFrame.cpp
layout/xul/base/src/nsSprocketLayout.cpp
layout/xul/base/src/nsSprocketLayout.h
layout/xul/base/src/nsStackLayout.cpp
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/nsTextBoxFrame.h
layout/xul/base/src/nsXULPopupManager.cpp
layout/xul/base/src/nsXULTooltipListener.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.h
layout/xul/base/src/tree/src/nsTreeColumns.h
layout/xul/base/test/Makefile.in
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/GeckoApp.java
mobile/android/base/Makefile.in
mobile/android/chrome/content/browser.js
mobile/xul/chrome/content/Util.js
mobile/xul/chrome/content/content.js
mobile/xul/chrome/tests/Makefile.in
mobile/xul/components/Makefile.in
mozglue/android/Makefile.in
netwerk/base/src/nsFileStreams.cpp
netwerk/base/src/nsFileStreams.h
netwerk/protocol/device/Makefile.in
other-licenses/android/Makefile.in
security/manager/ssl/src/nsSmartCardEvent.cpp
security/manager/ssl/src/nsSmartCardEvent.h
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
toolkit/crashreporter/Makefile.in
toolkit/crashreporter/test/Makefile.in
toolkit/mozapps/extensions/nsBlocklistService.js
toolkit/webapps/WebappsInstaller.jsm
tools/trace-malloc/Makefile.in
view/public/nsIView.h
view/public/nsIViewManager.h
widget/LookAndFeel.h
widget/cocoa/nsDragService.mm
widget/xpwidgets/nsXPLookAndFeel.cpp
xpcom/reflect/xptcall/src/md/unix/Makefile.in
xpfe/appshell/src/nsWebShellWindow.cpp
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= .
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 ifndef .PYMAKE
 ifeq (,$(MAKE_VERSION))
 $(error GNU Make is required)
 endif
--- a/accessible/Makefile.in
+++ b/accessible/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE	= accessibility
 DIRS    = public src build
--- a/accessible/build/Makefile.in
+++ b/accessible/build/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir	= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= accessibility
 LIBRARY_NAME	= accessibility
--- a/accessible/public/Makefile.in
+++ b/accessible/public/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 DIRS = msaa ia2
--- a/accessible/public/ia2/Makefile.in
+++ b/accessible/public/ia2/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 LIBRARY_NAME  = IA2Marshal
 MODULE        = accessibility
 GRE_MODULE    = 1
 DEFFILE       = $(win_srcdir)/IA2Marshal.def
--- a/accessible/public/msaa/Makefile.in
+++ b/accessible/public/msaa/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 LIBRARY_NAME	= AccessibleMarshal
 MODULE    = accessibility
 XPIDL_MODULE = accessibility-msaa
 GRE_MODULE   = 1
--- a/accessible/src/Makefile.in
+++ b/accessible/src/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 PLATFORM_DIR = atk
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_base_s
--- a/accessible/src/base/StyleInfo.cpp
+++ b/accessible/src/base/StyleInfo.cpp
@@ -3,16 +3,17 @@
 /* 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/. */
 
 #include "StyleInfo.h"
 
 #include "mozilla/dom/Element.h"
 #include "nsComputedDOMStyle.h"
+#include "nsIFrame.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 StyleInfo::StyleInfo(dom::Element* aElement, nsIPresShell* aPresShell) :
   mElement(aElement)
 {
   mStyleContext =
--- a/accessible/src/generic/BaseAccessibles.cpp
+++ b/accessible/src/generic/BaseAccessibles.cpp
@@ -10,17 +10,16 @@
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsGUIEvent.h"
 #include "nsILink.h"
-#include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // LeafAccessible
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_generic_s
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -21,34 +21,23 @@
 #include "States.h"
 #ifdef MOZ_XUL
 #include "XULTreeAccessible.h"
 #endif
 
 #include "mozilla/dom/Element.h"
 
 #include "nsIAccessibleRelation.h"
-#include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
-#include "nsIDocShellTreeNode.h"
 #include "nsIDocShellTreeOwner.h"
-#include "nsIDOMElement.h"
-#include "nsIDOMEventListener.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMHTMLAnchorElement.h"
-#include "nsIDOMHTMLImageElement.h"
-#include "nsIDOMHTMLInputElement.h"
-#include "nsIDOMHTMLSelectElement.h"
 #include "nsIDOMDataContainerEvent.h"
-#include "nsIDOMNSEvent.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
-#include "nsIDOMXULPopupElement.h"
 #include "nsIDocument.h"
 #include "nsEventListenerManager.h"
-#include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIServiceManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsReadableUtils.h"
 #include "nsFocusManager.h"
 
 #ifdef MOZ_XUL
@@ -257,19 +246,19 @@ RootAccessible::DocumentActivated(DocAcc
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDOMEventListener
 
 NS_IMETHODIMP
 RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
 {
-  nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
+  MOZ_ASSERT(aDOMEvent);
   nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
-  DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
+  aDOMEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
   nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
   if (!origTargetNode)
     return NS_OK;
 
   DocAccessible* document =
     GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
 
   if (document) {
@@ -294,19 +283,19 @@ RootAccessible::HandleEvent(nsIDOMEvent*
 
   return NS_OK;
 }
 
 // RootAccessible protected
 void
 RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
 {
-  nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
+  MOZ_ASSERT(aDOMEvent);
   nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
-  DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
+  aDOMEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
   nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
 
   nsAutoString eventType;
   aDOMEvent->GetType(eventType);
 
   if (eventType.EqualsLiteral("popuphiding")) {
     HandlePopupHidingEvent(origTargetNode);
     return;
--- a/accessible/src/html/Makefile.in
+++ b/accessible/src/html/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_html_s
--- a/accessible/src/jsat/Makefile.in
+++ b/accessible/src/jsat/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
--- a/accessible/src/msaa/DocAccessibleWrap.cpp
+++ b/accessible/src/msaa/DocAccessibleWrap.cpp
@@ -12,17 +12,16 @@
 #include "nsIAccessibilityService.h"
 #include "nsWinUtils.h"
 #include "Role.h"
 #include "RootAccessible.h"
 #include "Statistics.h"
 
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeNode.h"
-#include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionController.h"
 #include "nsIServiceManager.h"
 #include "nsIURI.h"
 #include "nsIViewManager.h"
 #include "nsIWebNavigation.h"
 
 using namespace mozilla;
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -15,17 +15,16 @@
 #include "nsCoreUtils.h"
 #include "nsWinUtils.h"
 #include "RootAccessible.h"
 #include "Statistics.h"
 
 #include "nsAttrName.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMHTMLElement.h"
-#include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIServiceManager.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nullptr;
--- a/accessible/src/other/Makefile.in
+++ b/accessible/src/other/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
--- a/accessible/src/windows/Makefile.in
+++ b/accessible/src/windows/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS += uia \
   $(null)
--- a/accessible/src/windows/uia/Makefile.in
+++ b/accessible/src/windows/uia/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_uia_s
--- a/accessible/src/xforms/Makefile.in
+++ b/accessible/src/xforms/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_xforms_s
--- a/accessible/src/xpcom/Makefile.in
+++ b/accessible/src/xpcom/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_xpcom_s
--- a/accessible/src/xul/Makefile.in
+++ b/accessible/src/xul/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_xul_s
--- a/accessible/src/xul/XULTabAccessible.cpp
+++ b/accessible/src/xul/XULTabAccessible.cpp
@@ -8,17 +8,16 @@
 #include "nsAccUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 // NOTE: alphabetically ordered
 #include "nsIAccessibleRelation.h"
 #include "nsIDocument.h"
-#include "nsIFrame.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULRelatedElement.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/tests/Makefile.in
+++ b/accessible/tests/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE	= test_accessibility
 
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible
 
 DIRS	= \
   actions \
   attributes \
--- a/accessible/tests/mochitest/actions/Makefile.in
+++ b/accessible/tests/mochitest/actions/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/actions
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/attributes/Makefile.in
+++ b/accessible/tests/mochitest/attributes/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/attributes
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/bounds/Makefile.in
+++ b/accessible/tests/mochitest/bounds/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/bounds
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/editabletext/Makefile.in
+++ b/accessible/tests/mochitest/editabletext/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/editabletext
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/elm/Makefile.in
+++ b/accessible/tests/mochitest/elm/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/elm
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/events/Makefile.in
+++ b/accessible/tests/mochitest/events/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/events
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/focus/Makefile.in
+++ b/accessible/tests/mochitest/focus/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/focus
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/hittest/Makefile.in
+++ b/accessible/tests/mochitest/hittest/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/hittest
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/hyperlink/Makefile.in
+++ b/accessible/tests/mochitest/hyperlink/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/hyperlink
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/hypertext/Makefile.in
+++ b/accessible/tests/mochitest/hypertext/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/hypertext
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/name/Makefile.in
+++ b/accessible/tests/mochitest/name/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/name
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/pivot/Makefile.in
+++ b/accessible/tests/mochitest/pivot/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/pivot
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/relations/Makefile.in
+++ b/accessible/tests/mochitest/relations/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/relations
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/role/Makefile.in
+++ b/accessible/tests/mochitest/role/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/role
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/selectable/Makefile.in
+++ b/accessible/tests/mochitest/selectable/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/selectable
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/states/Makefile.in
+++ b/accessible/tests/mochitest/states/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/states
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/table/Makefile.in
+++ b/accessible/tests/mochitest/table/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/table
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/text/Makefile.in
+++ b/accessible/tests/mochitest/text/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/text
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/textcaret/Makefile.in
+++ b/accessible/tests/mochitest/textcaret/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/textcaret
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/textselection/Makefile.in
+++ b/accessible/tests/mochitest/textselection/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/textselection
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES = \
--- a/accessible/tests/mochitest/tree/Makefile.in
+++ b/accessible/tests/mochitest/tree/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/tree
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/treeupdate/Makefile.in
+++ b/accessible/tests/mochitest/treeupdate/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/treeupdate
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/accessible/tests/mochitest/value/Makefile.in
+++ b/accessible/tests/mochitest/value/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/value
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_A11Y_FILES =\
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,13 +1,14 @@
 dnl
 dnl Local autoconf macros used with mozilla
 dnl The contents of this file are under the Public Domain.
-dnl 
+dnl
 
+builtin(include, build/autoconf/config.status.m4)dnl
 builtin(include, build/autoconf/toolchain.m4)dnl
 builtin(include, build/autoconf/ccache.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/codeset.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/mozprog.m4)dnl
@@ -17,16 +18,17 @@ builtin(include, build/autoconf/acwinpat
 builtin(include, build/autoconf/lto.m4)dnl
 builtin(include, build/autoconf/gcc-pr49911.m4)dnl
 builtin(include, build/autoconf/frameptr.m4)dnl
 builtin(include, build/autoconf/compiler-opts.m4)dnl
 builtin(include, build/autoconf/expandlibs.m4)dnl
 builtin(include, build/autoconf/arch.m4)dnl
 builtin(include, build/autoconf/android.m4)dnl
 builtin(include, build/autoconf/zlib.m4)dnl
+builtin(include, build/autoconf/linux.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.
 MOZ_READ_MOZCONFIG(.)
--- a/allmakefiles.sh
+++ b/allmakefiles.sh
@@ -20,16 +20,17 @@ add_makefiles() {
 }
 
 if [ "$srcdir" = "" ]; then
   srcdir=.
 fi
 
 # Common makefiles used by everyone
 add_makefiles "
+mozilla-config.h
 Makefile
 build/Makefile
 build/pgo/Makefile
 build/pgo/blueprint/Makefile
 build/pgo/js-input/Makefile
 config/Makefile
 config/autoconf.mk
 config/nspr/Makefile
@@ -116,17 +117,16 @@ if [ "$ENABLE_MARIONETTE" ]; then
   add_makefiles "
     testing/marionette/Makefile
     testing/marionette/components/Makefile
   "
 fi
 
 if [ "$ENABLE_TESTS" ]; then
   add_makefiles "
-    build/autoconf/test/Makefile
     config/makefiles/test/Makefile
     config/tests/makefiles/autodeps/Makefile
     config/tests/src-simple/Makefile
     mfbt/tests/Makefile
   "
   if [ ! "$LIBXUL_SDK" ]; then 
     add_makefiles "
       mozglue/tests/Makefile
--- a/b2g/Makefile.in
+++ b/b2g/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH      = ..
+DEPTH      = @DEPTH@
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = chrome components locales
 
--- a/b2g/app/Makefile.in
+++ b/b2g/app/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PREF_JS_EXPORTS = $(srcdir)/b2g.js
 
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -63,17 +63,16 @@ pref("browser.sessionstore.resume_from_c
 pref("browser.sessionstore.interval", 10000); // milliseconds
 pref("browser.sessionstore.max_tabs_undo", 1);
 
 /* these should help performance */
 pref("mozilla.widget.force-24bpp", true);
 pref("mozilla.widget.use-buffer-pixmap", true);
 pref("mozilla.widget.disable-native-theme", true);
 pref("layout.reflow.synthMouseMove", false);
-pref("dom.send_after_paint_to_content", true);
 
 /* download manager (don't show the window or alert) */
 pref("browser.download.useDownloadDir", true);
 pref("browser.download.folderList", 1); // Default to ~/Downloads
 pref("browser.download.manager.showAlertOnComplete", false);
 pref("browser.download.manager.showAlertInterval", 2000);
 pref("browser.download.manager.retention", 2);
 pref("browser.download.manager.showWhenStarting", false);
@@ -476,8 +475,23 @@ pref("dom.disable_window_showModalDialog
 // Turns on gralloc-based direct texturing for Gonk
 pref("gfx.gralloc.enabled", false);
 
 // XXXX REMOVE FOR PRODUCTION. Turns on GC and CC logging 
 pref("javascript.options.mem.log", true);
 
 // Increase mark slice time from 10ms to 30ms
 pref("javascript.options.mem.gc_incremental_slice_ms", 30);
+
+// Show/Hide scrollbars when active/inactive
+pref("ui.showHideScrollbars", 1);
+
+// Enable the ProcessPriorityManager, and give processes with no visible
+// documents a 1s grace period before they're eligible to be marked as
+// background.
+pref("dom.ipc.processPriorityManager.enabled", true);
+pref("dom.ipc.processPriorityManager.gracePeriodMS", 1000);
+pref("hal.processPriorityManager.gonk.masterOomAdjust", 0);
+pref("hal.processPriorityManager.gonk.foregroundOomAdjust", 1);
+pref("hal.processPriorityManager.gonk.backgroundOomAdjust", 2);
+pref("hal.processPriorityManager.gonk.masterNice", -1);
+pref("hal.processPriorityManager.gonk.foregroundNice", 0);
+pref("hal.processPriorityManager.gonk.backgroundNice", 10);
--- a/b2g/branding/official/Makefile.in
+++ b/b2g/branding/official/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
--- a/b2g/branding/official/content/Makefile.in
+++ b/b2g/branding/official/content/Makefile.in
@@ -1,16 +1,16 @@
 # 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/.
 
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
--- a/b2g/branding/official/locales/Makefile.in
+++ b/b2g/branding/official/locales/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = b2g/branding/official/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 include $(topsrcdir)/config/rules.mk
--- a/b2g/branding/unofficial/Makefile.in
+++ b/b2g/branding/unofficial/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
--- a/b2g/branding/unofficial/content/Makefile.in
+++ b/b2g/branding/unofficial/content/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
--- a/b2g/branding/unofficial/locales/Makefile.in
+++ b/b2g/branding/unofficial/locales/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = b2g/branding/unofficial/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 include $(topsrcdir)/config/rules.mk
--- a/b2g/chrome/Makefile.in
+++ b/b2g/chrome/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) \
            -DPACKAGE=browser \
--- a/b2g/chrome/content/content.css
+++ b/b2g/chrome/content/content.css
@@ -6,59 +6,51 @@
 @namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 /* Style the scrollbars */
 xul|window xul|scrollbar {
   display: none;
 }
 
 html xul|scrollbar {
-  display: block;
+  -moz-appearance: none !important;
+  position: relative;
+  background-color: transparent !important;
+  background-image: none !important;
+  border: 0px solid transparent !important;
+  z-index: 2147483647;
+  opacity: 1;
 }
 
 xul|scrollbar[orient="vertical"] {
-  -moz-appearance: none !important;
-  position: relative;
-  margin-left: -8px;
+  -moz-margin-start: -8px;
   min-width: 8px;
   max-width: 8px;
-  background-color: transparent !important;
-  background-image: none !important;
-  border: 0px solid transparent !important;
-}
-
-xul|scrollbar[orient="vertical"]:-moz-locale-dir(rtl) {
-  margin-left: 2px;
-  margin-right: -10px;
 }
 
 xul|scrollbar[orient="vertical"] xul|thumb {
   max-width: 6px !important;
   min-width: 6px !important;
 }
 
 xul|scrollbar[orient="horizontal"] {
-  -moz-appearance: none !important;
-  position: relative;
+  margin-top: -8px;
   min-height: 8px;
   max-height: 8px;
-  margin-top: -8px;
-  background-color: transparent !important;
-  background-image: none !important;
-  border: 0px solid transparent !important;
 }
 
 xul|scrollbar[orient="horizontal"] xul|thumb {
   max-height: 6px !important;
   min-height: 6px !important;
 }
 
-xul|scrollbox {
-  overflow-y: scroll;
-  overflow-x: scroll;
+xul|scrollbar:not([active="true"]),
+xul|scrollbar[disabled] {
+  opacity: 0;
+  -moz-transition: opacity 1s ease;
 }
 
 xul|scrollbarbutton {
   min-height: 8px !important;
   min-width: 8px !important;
   -moz-appearance: none !important;
   visibility: hidden;
 }
--- a/b2g/components/Makefile.in
+++ b/b2g/components/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH      = ../..
+DEPTH      = @DEPTH@
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = B2GComponents
 XPIDL_MODULE = B2GComponents
--- a/b2g/installer/Makefile.in
+++ b/b2g/installer/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -681,8 +681,12 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DL
 #ifdef MOZ_UPDATER
 @BINPATH@/components/UpdatePrompt.js
 #endif
 @BINPATH@/components/MozKeyboard.js
 @BINPATH@/components/DirectoryProvider.js
 @BINPATH@/components/ActivitiesGlue.js
 @BINPATH@/components/ProcessGlobal.js
 @BINPATH@/components/ContentHandler.js
+
+#ifdef XP_MACOSX
+@BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
+#endif
--- a/b2g/locales/Makefile.in
+++ b/b2g/locales/Makefile.in
@@ -1,18 +1,18 @@
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir = b2g/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 ifdef LOCALE_MERGEDIR
 vpath crashreporter%.ini $(LOCALE_MERGEDIR)/b2g/crashreporter
 endif
--- a/browser/Makefile.in
+++ b/browser/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(topsrcdir)/config/config.mk
 
 PARALLEL_DIRS = \
   base \
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS        = profile/extensions
 dist_dest   = $(DIST)/$(MOZ_MACBUNDLE_NAME)
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1341959296000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1343854380000">
   <emItems>
       <emItem  blockID="i58" id="webmaster@buzzzzvideos.info">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i86" id="{45147e67-4020-47e2-8f7a-55464fb535aa}">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
@@ -294,16 +294,20 @@
       <emItem  blockID="i62" id="jid0-EcdqvFOgWLKHNJPuqAnawlykCGZ@jetpack">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i70" id="psid-vhvxQHMZBOzUZA@jetpack">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i115" id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+                        <versionRange  minVersion="0" maxVersion="*">
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i56" id="flash@adobe.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i103" id="kdrgun@gmail.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
                   </emItem>
@@ -410,16 +414,19 @@
                   <match name="filename" exp="AdobePDFViewerNPAPI\.plugin" />                      <versionRange  minVersion="0" maxVersion="10.1.3" severity="1"></versionRange>
                   </pluginItem>
       <pluginItem  blockID="p94">
                   <match name="filename" exp="(NPSWF32\.dll)|(Flash\ Player\.plugin)" />                      <versionRange  minVersion="0" maxVersion="10.2.159.1" severity="0"></versionRange>
                   </pluginItem>
       <pluginItem  blockID="p102">
                   <match name="filename" exp="npmozax\.dll" />                      <versionRange  minVersion="0" maxVersion="*"></versionRange>
                   </pluginItem>
+      <pluginItem  blockID="p113">
+                  <match name="filename" exp="npuplaypc\.dll" />                      <versionRange  minVersion="0" maxVersion="1.0.0.0" severity="1"></versionRange>
+                  </pluginItem>
     </pluginItems>
 
   <gfxItems>
     <gfxBlacklistEntry  blockID="g35">      <os>WINNT 6.1</os>      <vendor>0x10de</vendor>              <devices>
                       <device>0x0a6c</device>
                   </devices>
             <feature>DIRECT2D</feature>      <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>      <driverVersion>8.17.12.5896</driverVersion>      <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>    </gfxBlacklistEntry>
     <gfxBlacklistEntry  blockID="g36">      <os>WINNT 6.1</os>      <vendor>0x10de</vendor>              <devices>
--- a/browser/app/profile/extensions/Makefile.in
+++ b/browser/app/profile/extensions/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH      = ../../../..
+DEPTH      = @DEPTH@
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 DISTROEXT = $(call core_abspath,$(DIST))/bin/distribution/extensions
 
 include $(DEPTH)/config/autoconf.mk
 
--- a/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in
+++ b/browser/app/profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 FILES := \
--- a/browser/base/Makefile.in
+++ b/browser/base/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -401,34 +401,53 @@ var SocialSidebar = {
            docElem.getAttribute('chromehidden').indexOf("extrachrome") >= 0;
   },
 
   // Whether the user has toggled the sidebar on (for windows where it can appear)
   get enabled() {
     return Services.prefs.getBoolPref("social.sidebar.open");
   },
 
+  dispatchEvent: function(aType, aDetail) {
+    let sbrowser = document.getElementById("social-sidebar-browser");
+    let evt = sbrowser.contentDocument.createEvent("CustomEvent");
+    evt.initCustomEvent(aType, true, true, aDetail ? aDetail : {});
+    sbrowser.contentDocument.documentElement.dispatchEvent(evt);
+  },
+
   updateSidebar: function SocialSidebar_updateSidebar() {
     // Hide the toggle menu item if the sidebar cannot appear
     let command = document.getElementById("Social:ToggleSidebar");
     command.hidden = !this.canShow;
 
     // Hide the sidebar if it cannot appear, or has been toggled off.
     // Also set the command "checked" state accordingly.
     let hideSidebar = !this.canShow || !this.enabled;
     let broadcaster = document.getElementById("socialSidebarBroadcaster");
     broadcaster.hidden = hideSidebar;
     command.setAttribute("checked", !hideSidebar);
 
-    // If the sidebar is hidden, unload its document
-    // XXX this results in a poor UX, we should revisit
     let sbrowser = document.getElementById("social-sidebar-browser");
-    if (broadcaster.hidden) {
-      sbrowser.removeAttribute("origin");
-      sbrowser.setAttribute("src", "about:blank");
-      return;
+    if (hideSidebar) {
+      this.dispatchEvent("sidebarhide");
+      // If we're disabled, unload the sidebar content
+      if (!this.canShow) {
+        sbrowser.removeAttribute("origin");
+        sbrowser.setAttribute("src", "about:blank");
+      }
+    } else {
+      // Make sure the right sidebar URL is loaded
+      if (sbrowser.getAttribute("origin") != Social.provider.origin) {
+        sbrowser.setAttribute("origin", Social.provider.origin);
+        sbrowser.setAttribute("src", Social.provider.sidebarURL);
+        sbrowser.addEventListener("load", function sidebarOnShow() {
+          sbrowser.removeEventListener("load", sidebarOnShow);
+          // let load finish, then fire our event
+          setTimeout(function () {
+            SocialSidebar.dispatchEvent("sidebarshow");
+          }, 0);
+        });
+      } else {
+        this.dispatchEvent("sidebarshow");
+      }
     }
-
-    // Load the sidebar document
-    sbrowser.setAttribute("origin", Social.provider.origin);
-    sbrowser.setAttribute("src", Social.provider.sidebarURL);
   }
 }
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -653,16 +653,17 @@
                      ondrop="homeButtonObserver.onDrop(event)"
                      ondragexit="homeButtonObserver.onDragExit(event)"
                      onclick="BrowserGoHome(event);"
                      aboutHomeOverrideTooltip="&abouthome.pageTitle;"/>
 
       <toolbaritem id="social-toolbar-button"
                    class="toolbarbutton-1 chromeclass-toolbar-additional"
                    removable="false"
+                   pack="center"
                    title="&socialToolbar.title;"
                    hidden="true">
         <hbox id="social-toolbar-button-box" class="social-statusarea-container">
           <button id="social-provider-image" type="menu">
             <menupopup id="social-statusarea-popup">
               <hbox id="social-statusarea-user" pack="left" align="center">
                 <image id="social-statusarea-user-portrait"/>
                 <vbox>
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/base/content/test
+relativesrcdir  = @relativesrcdir@
 
 DIRS += \
 		newtab \
 		$(NULL)
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_FILES = \
--- a/browser/base/content/test/browser_gestureSupport.js
+++ b/browser/base/content/test/browser_gestureSupport.js
@@ -62,23 +62,23 @@ function test_gestureListener(evt)
   isnot(evt.screenY, 0,
         "evt.screenY (" + evt.screenY + ") does not match expected value");
 
   is(evt.direction, test_expectedDirection,
      "evt.direction (" + evt.direction + ") does not match expected value");
   is(evt.delta, test_expectedDelta,
      "evt.delta (" + evt.delta + ") does not match expected value");
 
-  is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.SHIFT_MASK) != 0,
+  is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.SHIFT_MASK) != 0,
      "evt.shiftKey did not match expected value");
-  is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.CONTROL_MASK) != 0,
+  is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.CONTROL_MASK) != 0,
      "evt.ctrlKey did not match expected value");
-  is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.ALT_MASK) != 0,
+  is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.ALT_MASK) != 0,
      "evt.altKey did not match expected value");
-  is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.META_MASK) != 0,
+  is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.META_MASK) != 0,
      "evt.metaKey did not match expected value");
 
   if (evt.type == "MozTapGesture") {
     is(evt.clickCount, test_expectedClickCount, "evt.clickCount does not match");
   }
 
   test_eventCount++;
 }
@@ -153,29 +153,29 @@ function test_TestEventListeners()
   test_clicks("MozTapGesture", 2);
   test_clicks("MozTapGesture", 3);
   test_clicks("MozPressTapGesture", 1);
 
   // simple delivery test for edgeui gesture
   e("MozEdgeUIGesture", 0, 0, 0);
 
   // event.shiftKey
-  let modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
+  let modifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
 
   // event.metaKey
-  modifier = Components.interfaces.nsIDOMNSEvent.META_MASK;
+  modifier = Components.interfaces.nsIDOMEvent.META_MASK;
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
 
   // event.altKey
-  modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK;
+  modifier = Components.interfaces.nsIDOMEvent.ALT_MASK;
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
 
   // event.ctrlKey
-  modifier = Components.interfaces.nsIDOMNSEvent.CONTROL_MASK;
+  modifier = Components.interfaces.nsIDOMEvent.CONTROL_MASK;
   e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
 }
 
 function test_eventDispatchListener(evt)
 {
   test_eventCount++;
   evt.stopPropagation();
 }
--- a/browser/base/content/test/browser_social_sidebar.js
+++ b/browser/base/content/test/browser_social_sidebar.js
@@ -10,43 +10,64 @@ function test() {
     ok(true, "can't run social sidebar test in debug builds because they falsely report leaks");
     return;
   }
 
   waitForExplicitFinish();
 
   let manifest = { // normal provider
     name: "provider 1",
-    origin: "https://example1.com",
-    sidebarURL: "https://example1.com/sidebar.html",
-    workerURL: "https://example1.com/worker.js",
+    origin: "https://example.com",
+    sidebarURL: "https://example.com/browser/browser/base/content/test/social_sidebar.html",
+    workerURL: "https://example.com/browser/browser/base/content/test/social_worker.js",
     iconURL: "chrome://branding/content/icon48.png"
   };
   runSocialTestWithProvider(manifest, doTest);
 }
 
 function doTest() {
   ok(SocialSidebar.canShow, "social sidebar should be able to be shown");
   ok(SocialSidebar.enabled, "social sidebar should be on by default");
 
   let command = document.getElementById("Social:ToggleSidebar");
   let sidebar = document.getElementById("social-sidebar-box");
+  let browser = sidebar.firstChild;
 
-  // Check the the sidebar is initially visible, and loaded
-  ok(!command.hidden, "sidebar toggle command should be visible");
-  is(command.getAttribute("checked"), "true", "sidebar toggle command should be checked");
-  ok(!sidebar.hidden, "sidebar itself should be visible");
-  ok(Services.prefs.getBoolPref("social.sidebar.open"), "sidebar open pref should be true");
-  is(sidebar.firstChild.getAttribute('src'), "https://example1.com/sidebar.html", "sidebar url should be set");
+  function checkShown(shouldBeShown) {
+    is(command.getAttribute("checked"), shouldBeShown ? "true" : "false",
+       "toggle command should be " + (shouldBeShown ? "checked" : "unchecked"));
+    is(sidebar.hidden, !shouldBeShown,
+       "sidebar should be " + (shouldBeShown ? "visible" : "hidden"));
+    is(Services.prefs.getBoolPref("social.sidebar.open"), shouldBeShown,
+       "sidebar open pref should be " + shouldBeShown);
+    if (shouldBeShown)
+      is(browser.getAttribute('src'), Social.provider.sidebarURL, "sidebar url should be set");
+  }
+
+  // First check the the sidebar is initially visible, and loaded
+  ok(!command.hidden, "toggle command should be visible");
+  checkShown(true);
+
+  browser.addEventListener("sidebarhide", function sidebarhide() {
+    browser.removeEventListener("sidebarhide", sidebarhide);
 
-  // Now toggle it!
-  info("Toggling sidebar");
+    checkShown(false);
+
+    browser.addEventListener("sidebarshow", function sidebarshow() {
+      browser.removeEventListener("sidebarshow", sidebarshow);
+
+      checkShown(true);
+
+      // Remove the test provider
+      SocialService.removeProvider(Social.provider.origin, finish);
+    });
+
+    // Toggle it back on
+    info("Toggling sidebar back on");
+    Social.toggleSidebar();
+  });
+
+  // Now toggle it off
+  info("Toggling sidebar off");
   Social.toggleSidebar();
-  is(command.getAttribute("checked"), "false", "sidebar toggle command should not be checked");
-  ok(sidebar.hidden, "sidebar itself should not be visible");
-  ok(!Services.prefs.getBoolPref("social.sidebar.open"), "sidebar open pref should be false");
-  is(sidebar.firstChild.getAttribute('src'), "about:blank", "sidebar url should not be set");
-
-  // Remove the test provider
-  SocialService.removeProvider(Social.provider.origin, finish);
 }
 
 // XXX test sidebar in popup
--- a/browser/base/content/test/newtab/Makefile.in
+++ b/browser/base/content/test/newtab/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/base/content/test/newtab
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
 	browser_newtab_block.js \
 	browser_newtab_disable.js \
 	browser_newtab_drag_drop.js \
--- a/browser/branding/aurora/Makefile.in
+++ b/browser/branding/aurora/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
--- a/browser/branding/aurora/content/Makefile.in
+++ b/browser/branding/aurora/content/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/aurora/locales/Makefile.in
+++ b/browser/branding/aurora/locales/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/branding/aurora/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD) -DMOZ_DISTRIBUTION_ID_UNQUOTED=$(MOZ_DISTRIBUTION_ID)
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/nightly/Makefile.in
+++ b/browser/branding/nightly/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
--- a/browser/branding/nightly/content/Makefile.in
+++ b/browser/branding/nightly/content/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/nightly/locales/Makefile.in
+++ b/browser/branding/nightly/locales/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/branding/nightly/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD) -DMOZ_DISTRIBUTION_ID_UNQUOTED=$(MOZ_DISTRIBUTION_ID)
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/official/Makefile.in
+++ b/browser/branding/official/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
--- a/browser/branding/official/content/Makefile.in
+++ b/browser/branding/official/content/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/official/locales/Makefile.in
+++ b/browser/branding/official/locales/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/branding/official/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/unofficial/Makefile.in
+++ b/browser/branding/unofficial/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
--- a/browser/branding/unofficial/content/Makefile.in
+++ b/browser/branding/unofficial/content/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/branding/unofficial/locales/Makefile.in
+++ b/browser/branding/unofficial/locales/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/branding/unofficial/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD) -DMOZ_DISTRIBUTION_ID_UNQUOTED=$(MOZ_DISTRIBUTION_ID)
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/Makefile.in
+++ b/browser/components/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browsercomps
 XPIDL_MODULE = browsercompsbase
--- a/browser/components/about/Makefile.in
+++ b/browser/components/about/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browserabout
 LIBRARY_NAME = browserabout_s
--- a/browser/components/build/Makefile.in
+++ b/browser/components/build/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH=../../..
+DEPTH=@DEPTH@
 topsrcdir=@top_srcdir@
 srcdir=@srcdir@
 VPATH=@srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browsercomps
 LIBRARY_NAME = browsercomps
--- a/browser/components/certerror/Makefile.in
+++ b/browser/components/certerror/Makefile.in
@@ -1,15 +1,15 @@
 #
 # 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/.
 
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/components/certerror/test/Makefile.in
+++ b/browser/components/certerror/test/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/certerror/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = browser_bug431826.js \
     $(NULL)
 
 libs::	$(_BROWSER_FILES)
--- a/browser/components/dirprovider/Makefile.in
+++ b/browser/components/dirprovider/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browserdir
 LIBRARY_NAME = browserdir_s
--- a/browser/components/dirprovider/tests/Makefile.in
+++ b/browser/components/dirprovider/tests/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH          = ../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/components/dirprovider/tests
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_browserdir
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/downloads/Makefile.in
+++ b/browser/components/downloads/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = src
 
--- a/browser/components/downloads/src/Makefile.in
+++ b/browser/components/downloads/src/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = \
   BrowserDownloads.manifest \
--- a/browser/components/downloads/test/Makefile.in
+++ b/browser/components/downloads/test/Makefile.in
@@ -1,17 +1,17 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
-relativesrcdir = browser/components/downloads/test
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 XPCSHELL_TESTS = unit
 
 DIRS = browser
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/downloads/test/browser/Makefile.in
+++ b/browser/components/downloads/test/browser/Makefile.in
@@ -1,17 +1,17 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
-DEPTH     = ../../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
-relativesrcdir = browser/components/downloads/test/browser
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_basic_functionality.js \
   head.js \
   $(NULL)
 
--- a/browser/components/feeds/Makefile.in
+++ b/browser/components/feeds/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
--- a/browser/components/feeds/public/Makefile.in
+++ b/browser/components/feeds/public/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../../../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browser-feeds
 XPIDL_MODULE  = browser-feeds
--- a/browser/components/feeds/src/Makefile.in
+++ b/browser/components/feeds/src/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browser_feeds
 LIBRARY_NAME = browser_feeds_s
--- a/browser/components/feeds/test/Makefile.in
+++ b/browser/components/feeds/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/feeds/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_browser_feeds
 XPCSHELL_TESTS	= unit
 
 DIRS = \
 	chrome \
--- a/browser/components/feeds/test/chrome/Makefile.in
+++ b/browser/components/feeds/test/chrome/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/feeds/test/chrome
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # sample_feed.atom was copied from toolkit/components/places/tests/chrome
 MOCHITEST_FILES	= \
 		sample_feed.atom \
 		$(NULL)
 
--- a/browser/components/migration/Makefile.in
+++ b/browser/components/migration/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS		= public src
 
--- a/browser/components/migration/public/Makefile.in
+++ b/browser/components/migration/public/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= migration
 XPIDL_MODULE	= migration
--- a/browser/components/migration/src/Makefile.in
+++ b/browser/components/migration/src/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= migration
 LIBRARY_NAME	= migration_s
--- a/browser/components/migration/tests/Makefile.in
+++ b/browser/components/migration/tests/Makefile.in
@@ -1,15 +1,15 @@
 # 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/.
 
-DEPTH		  = ../../../..
+DEPTH		  = @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		  = @srcdir@
-relativesrcdir = browser/components/migration/tests
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/places/Makefile.in
+++ b/browser/components/places/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = src
 
--- a/browser/components/places/src/Makefile.in
+++ b/browser/components/places/src/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH = ../../../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = \
   BrowserPlaces.manifest \
--- a/browser/components/places/tests/Makefile.in
+++ b/browser/components/places/tests/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir = browser/components/places/tests
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_browser_places
 
 XPCSHELL_TESTS = unit
 
 DIRS = browser chrome
--- a/browser/components/places/tests/browser/Makefile.in
+++ b/browser/components/places/tests/browser/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH			= ../../../../..
+DEPTH			= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
-relativesrcdir  = browser/components/places/tests/browser
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
 	head.js \
 	browser_0_library_left_pane_migration.js \
 	browser_library_left_pane_fixnames.js \
 	browser_425884.js \
--- a/browser/components/places/tests/chrome/Makefile.in
+++ b/browser/components/places/tests/chrome/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH          = ../../../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/components/places/tests/chrome
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_CHROME_FILES = \
 	test_treeview_date.xul \
 	test_bug485100-change-case-loses-tag.xul \
 	test_bug427633_no_newfolder_if_noip.xul \
 	test_0_multiple_left_pane.xul \
--- a/browser/components/preferences/Makefile.in
+++ b/browser/components/preferences/Makefile.in
@@ -1,14 +1,14 @@
 # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS = \
   in-content \
--- a/browser/components/preferences/in-content/Makefile.in
+++ b/browser/components/preferences/in-content/Makefile.in
@@ -1,13 +1,13 @@
 # -- 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += tests
 
--- a/browser/components/preferences/in-content/tests/Makefile.in
+++ b/browser/components/preferences/in-content/tests/Makefile.in
@@ -1,17 +1,17 @@
 # -- 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/preferences/in-content/tests
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
     head.js \
     browser_advanced_update.js \
     browser_bug410900.js \
--- a/browser/components/preferences/tests/Makefile.in
+++ b/browser/components/preferences/tests/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/preferences/tests
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
     browser_advanced_update.js \
     browser_bug410900.js \
     browser_bug567487.js \
--- a/browser/components/privatebrowsing/Makefile.in
+++ b/browser/components/privatebrowsing/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = privatebrowsing
 
--- a/browser/components/privatebrowsing/src/Makefile.in
+++ b/browser/components/privatebrowsing/src/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH   = ../../../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = privatebrowsing
 LIBRARY_NAME = privatebrowsing_s
--- a/browser/components/privatebrowsing/test/Makefile.in
+++ b/browser/components/privatebrowsing/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/privatebrowsing/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_privatebrowsing
 
 XPCSHELL_TESTS	= unit
 
 DIRS +=	browser \
--- a/browser/components/privatebrowsing/test/browser/Makefile.in
+++ b/browser/components/privatebrowsing/test/browser/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/privatebrowsing/test/browser
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES =  \
 		head.js \
 		browser_console_clear.js \
 		browser_privatebrowsing_certexceptionsui.js \
 		browser_privatebrowsing_clearplugindata.js \
--- a/browser/components/search/Makefile.in
+++ b/browser/components/search/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/components/search/test/Makefile.in
+++ b/browser/components/search/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  =  browser/components/search/test
+relativesrcdir  =  @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = 	  browser_405664.js \
 	                  browser_addEngine.js \
 	                  browser_contextmenu.js \
 	                  testEngine.xml \
 	                  testEngine_mozsearch.xml \
--- a/browser/components/sessionstore/Makefile.in
+++ b/browser/components/sessionstore/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = sessionstore
 XPIDL_MODULE = sessionstore
--- a/browser/components/sessionstore/src/Makefile.in
+++ b/browser/components/sessionstore/src/Makefile.in
@@ -1,41 +1,34 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
 
 EXTRA_COMPONENTS = \
   nsSessionStore.manifest \
   $(NULL)
 
 EXTRA_PP_COMPONENTS = \
 	nsSessionStore.js \
 	nsSessionStartup.js \
 	$(NULL)
 
-libs::
-	$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/sessionstore
+JS_MODULES_PATH := $(FINAL_TARGET)/modules/sessionstore
 
-SS_EXTRA_PP_JS_MODULES = \
+EXTRA_JS_MODULES := \
+  DocumentUtils.jsm \
+  SessionStorage.jsm \
+  XPathGenerator.jsm \
+  $(NULL)
+
+EXTRA_PP_JS_MODULES := \
 	SessionStore.jsm \
 	$(NULL)
 
-ifdef SS_EXTRA_PP_JS_MODULES
-libs:: $(SS_EXTRA_PP_JS_MODULES)
-ifndef NO_DIST_INSTALL
-	$(EXIT_ON_ERROR) \
-	$(NSINSTALL) -D $(FINAL_TARGET)/modules/sessionstore; \
-	for i in $^; do \
-	  dest=$(FINAL_TARGET)/modules/sessionstore/`basename $$i`; \
-	  $(RM) -f $$dest; \
-	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
-	done
-endif
-endif
-
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/sessionstore/test/Makefile.in
+++ b/browser/components/sessionstore/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/sessionstore/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # browser_506482.js is disabled because of frequent failures (bug 538672)
 # browser_526613.js is disabled because of frequent failures (bug 534489)
 # browser_589246.js is disabled for leaking browser windows (bug 752467)
 # browser_580512.js is disabled for leaking browser windows (bug 752467)
 
--- a/browser/components/shell/Makefile.in
+++ b/browser/components/shell/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
--- a/browser/components/shell/public/Makefile.in
+++ b/browser/components/shell/public/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../../../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = shellservice
 XPIDL_MODULE  = shellservice
--- a/browser/components/shell/src/Makefile.in
+++ b/browser/components/shell/src/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../../../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = shellservice
 
--- a/browser/components/shell/test/Makefile.in
+++ b/browser/components/shell/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/shell/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_browser_shell
 XPCSHELL_TESTS	= unit
 
 
 MOCHITEST_BROWSER_FILES = browser_420786.js \
--- a/browser/components/sidebar/Makefile.in
+++ b/browser/components/sidebar/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = nsSidebar.manifest
 EXTRA_PP_COMPONENTS = nsSidebar.js
--- a/browser/components/tabview/Makefile.in
+++ b/browser/components/tabview/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/components/tabview/test/Makefile.in
+++ b/browser/components/tabview/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/tabview/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
                  browser_tabview_alltabs.js \
                  browser_tabview_apptabs.js \
                  browser_tabview_bug580412.js \
--- a/browser/components/test/Makefile.in
+++ b/browser/components/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = browser/components/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_bug538331.js \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/thumbnails/Makefile.in
+++ b/browser/components/thumbnails/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = \
 	BrowserPageThumbs.manifest \
--- a/browser/components/thumbnails/test/Makefile.in
+++ b/browser/components/thumbnails/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/thumbnails/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
 	browser_thumbnails_capture.js \
 	browser_thumbnails_privacy.js \
 	browser_thumbnails_redirect.js \
--- a/browser/devtools/Makefile.in
+++ b/browser/devtools/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH   = ../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
--- a/browser/devtools/commandline/Makefile.in
+++ b/browser/devtools/commandline/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/commandline/test/Makefile.in
+++ b/browser/devtools/commandline/test/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = browser/devtools/commandline/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_gcli_addon.js \
   browser_gcli_break.js \
   browser_gcli_calllog.js \
   browser_gcli_commands.js \
--- a/browser/devtools/debugger/Makefile.in
+++ b/browser/devtools/debugger/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/debugger/test/Makefile.in
+++ b/browser/devtools/debugger/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH           = ../../../..
+DEPTH           = @DEPTH@
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
-relativesrcdir  = browser/devtools/debugger/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_TESTS = \
 	browser_dbg_leaktest.js \
 	browser_dbg_createRemote.js \
 	browser_dbg_createChrome.js \
 	browser_dbg_debugger-tab-switch.js \
--- a/browser/devtools/highlighter/Makefile.in
+++ b/browser/devtools/highlighter/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_JS_MODULES = \
 	domplate.jsm \
--- a/browser/devtools/highlighter/test/Makefile.in
+++ b/browser/devtools/highlighter/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/devtools/highlighter/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
 		browser_inspector_initialization.js \
 		browser_inspector_treeSelection.js \
 		browser_inspector_highlighter.js \
--- a/browser/devtools/layoutview/Makefile.in
+++ b/browser/devtools/layoutview/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/layoutview/test/Makefile.in
+++ b/browser/devtools/layoutview/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/devtools/layoutview/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
 		browser_layoutview.js \
 		$(NULL)
 
--- a/browser/devtools/responsivedesign/Makefile.in
+++ b/browser/devtools/responsivedesign/Makefile.in
@@ -1,9 +1,9 @@
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 ifdef ENABLE_TESTS
 	DIRS += test
--- a/browser/devtools/responsivedesign/test/Makefile.in
+++ b/browser/devtools/responsivedesign/test/Makefile.in
@@ -30,21 +30,21 @@
 # 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 *****
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/devtools/responsivedesign/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
 		browser_responsiveui.js \
 		browser_responsiveruleview.js \
 		browser_responsivecomputedview.js \
--- a/browser/devtools/scratchpad/Makefile.in
+++ b/browser/devtools/scratchpad/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/scratchpad/test/Makefile.in
+++ b/browser/devtools/scratchpad/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH			= ../../../..
+DEPTH			= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
-relativesrcdir  = browser/devtools/scratchpad/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
 		browser_scratchpad_initialization.js \
 		browser_scratchpad_contexts.js \
 		browser_scratchpad_tab_switch.js \
 		browser_scratchpad_execute_print.js \
--- a/browser/devtools/shared/Makefile.in
+++ b/browser/devtools/shared/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/shared/test/Makefile.in
+++ b/browser/devtools/shared/test/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = browser/devtools/shared/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_browser_basic.js \
   browser_promise_basic.js \
   browser_require_basic.js \
   browser_templater_basic.js \
--- a/browser/devtools/sourceeditor/Makefile.in
+++ b/browser/devtools/sourceeditor/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/sourceeditor/test/Makefile.in
+++ b/browser/devtools/sourceeditor/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir = browser/devtools/sourceeditor/test
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
 		browser_sourceeditor_initialization.js \
 		browser_bug684862_paste_html.js \
 		browser_bug687573_vscroll.js \
 		browser_bug687568_pagescroll.js \
--- a/browser/devtools/styleeditor/Makefile.in
+++ b/browser/devtools/styleeditor/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/styleeditor/test/Makefile.in
+++ b/browser/devtools/styleeditor/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/devtools/styleeditor/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_TEST_FILES = \
                  browser_styleeditor_enabled.js \
                  browser_styleeditor_filesave.js \
                  browser_styleeditor_import.js \
--- a/browser/devtools/styleinspector/Makefile.in
+++ b/browser/devtools/styleinspector/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS = test
 
--- a/browser/devtools/styleinspector/test/Makefile.in
+++ b/browser/devtools/styleinspector/test/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = browser/devtools/styleinspector/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_styleinspector.js \
   browser_bug683672.js \
   browser_styleinspector_bug_672746_default_styles.js \
   browser_styleinspector_bug_672744_search_filter.js \
--- a/browser/devtools/tilt/Makefile.in
+++ b/browser/devtools/tilt/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 TEST_DIRS += test
 
--- a/browser/devtools/tilt/test/Makefile.in
+++ b/browser/devtools/tilt/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH			= ../../../..
+DEPTH			= @DEPTH@
 topsrcdir		= @top_srcdir@
 srcdir			= @srcdir@
 VPATH			= @srcdir@
-relativesrcdir 	= browser/devtools/tilt/test
+relativesrcdir 	= @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
 	head.js \
 	browser_tilt_01_lazy_getter.js \
 	browser_tilt_02_notifications-seq.js \
 	browser_tilt_02_notifications.js \
--- a/browser/devtools/webconsole/HUDService-content.js
+++ b/browser/devtools/webconsole/HUDService-content.js
@@ -1156,27 +1156,27 @@ let ConsoleAPIObserver = {
       case "time":
       case "timeEnd":
       case "group":
       case "groupCollapsed":
         aRemoteMessage.apiMessage.arguments =
           WebConsoleUtils.cloneObject(aOriginalMessage.arguments, true);
         break;
 
-      case "log":
-      case "info":
-      case "warn":
-      case "error":
-      case "debug":
       case "groupEnd":
         aRemoteMessage.argumentsToString =
           Array.map(aOriginalMessage.arguments || [],
                     this._formatObject.bind(this));
         break;
 
+      case "log":
+      case "info":
+      case "warn":
+      case "error":
+      case "debug":
       case "dir": {
         aRemoteMessage.objectsCacheId = Manager.sequenceId;
         aRemoteMessage.argumentsToString = [];
         let mapFunction = function(aItem) {
           let formattedObject = this._formatObject(aItem);
           aRemoteMessage.argumentsToString.push(formattedObject);
           if (WebConsoleUtils.isObjectInspectable(aItem)) {
             return JSTerm.prepareObjectForRemote(aItem,
--- a/browser/devtools/webconsole/Makefile.in
+++ b/browser/devtools/webconsole/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_JS_MODULES = \
 		HUDService.jsm \
--- a/browser/devtools/webconsole/test/Makefile.in
+++ b/browser/devtools/webconsole/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH			= ../../../..
+DEPTH			= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
-relativesrcdir  = browser/devtools/webconsole/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
 	browser_webconsole_notifications.js \
 	browser_webconsole_message_node_id.js \
 	browser_webconsole_bug_580030_errors_after_page_reload.js \
 	browser_webconsole_basic_net_logging.js \
@@ -107,16 +107,17 @@ MOCHITEST_BROWSER_FILES = \
 	browser_webconsole_bug_622303_persistent_filters.js \
 	browser_webconsole_window_zombie.js \
 	browser_cached_messages.js \
 	browser_bug664688_sandbox_update_after_navigation.js \
 	browser_webconsole_menustatus.js \
 	browser_result_format_as_string.js \
 	browser_webconsole_bug_737873_mixedcontent.js \
 	browser_output_breaks_after_console_dir_uninspectable.js \
+	browser_console_log_inspectable_object.js \
 	head.js \
 	$(NULL)
 
 MOCHITEST_BROWSER_FILES += \
 	test-console.html \
 	test-network.html \
 	test-network-request.html \
 	test-mutation.html \
new file mode 100644
--- /dev/null
+++ b/browser/devtools/webconsole/test/browser_console_log_inspectable_object.js
@@ -0,0 +1,57 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test that objects given to console.log() are inspectable.
+
+function test()
+{
+  waitForExplicitFinish();
+
+  addTab("data:text/html,test for bug 676722 - inspectable objects for window.console");
+
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    openConsole(null, performTest);
+  }, true);
+}
+
+function performTest(hud)
+{
+  hud.jsterm.clearOutput(true);
+
+  hud.jsterm.execute("myObj = {abba: 'omgBug676722'}");
+  hud.jsterm.execute("console.log('fooBug676722', myObj)");
+  waitForSuccess({
+    name: "eval results are shown",
+    validatorFn: function()
+    {
+      return hud.outputNode.textContent.indexOf("fooBug676722") > -1 &&
+             hud.outputNode.querySelector(".hud-clickable");
+    },
+    successFn: function()
+    {
+      isnot(hud.outputNode.textContent.indexOf("myObj = {"), -1,
+            "myObj = ... is shown");
+
+      let clickable = hud.outputNode.querySelector(".hud-clickable");
+      ok(clickable, "the console.log() object .hud-clickable was found");
+      isnot(clickable.textContent.indexOf("omgBug676722"), -1,
+            "clickable node content is correct");
+
+      document.addEventListener("popupshown", function _onPopupShown(aEvent) {
+        document.removeEventListener("popupshown", _onPopupShown);
+
+        isnot(aEvent.target.label.indexOf("omgBug676722"), -1,
+           "object inspector opened on click");
+
+        executeSoon(finishTest);
+      });
+
+      executeSoon(function() {
+        EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
+      });
+    },
+    failureFn: finishTest,
+  });
+}
--- a/browser/devtools/webconsole/webconsole.js
+++ b/browser/devtools/webconsole/webconsole.js
@@ -939,17 +939,22 @@ WebConsoleFrame.prototype = {
     let argsToString = aMessage.argumentsToString;
 
     switch (level) {
       case "log":
       case "info":
       case "warn":
       case "error":
       case "debug":
-        body = argsToString.join(" ");
+        body = {
+          cacheId: aMessage.objectsCacheId,
+          remoteObjects: args,
+          argsToString: argsToString,
+        };
+        clipboardText = argsToString.join(" ");
         sourceURL = aMessage.apiMessage.filename;
         sourceLine = aMessage.apiMessage.lineNumber;
         break;
 
       case "trace":
         let filename = WebConsoleUtils.abbreviateSourceURL(args[0].filename);
         let functionName = args[0].functionName ||
                            l10n.getStr("stacktrace.anonymousFunction");
@@ -1064,16 +1069,67 @@ WebConsoleFrame.prototype = {
         node.querySelector("tree").view = node.propertyTreeView;
       };
     }
 
     return node;
   },
 
   /**
+   * The click event handler for objects shown inline coming from the
+   * window.console API.
+   *
+   * @private
+   * @param nsIDOMNode aMessage
+   *        The message element this handler corresponds to.
+   * @param nsIDOMNode aAnchor
+   *        The object inspector anchor element. This is the clickable element
+   *        in the console.log message we display.
+   * @param array aRemoteObject
+   *        The remote object representation.
+   */
+  _consoleLogClick:
+  function WCF__consoleLogClick(aMessage, aAnchor, aRemoteObject)
+  {
+    if (aAnchor._panelOpen) {
+      return;
+    }
+
+    let options = {
+      title: aAnchor.textContent,
+      anchor: aAnchor,
+
+      // Data to inspect.
+      data: {
+        // This is where the resultObject children are cached.
+        rootCacheId: aMessage._evalCacheId,
+        remoteObject: aRemoteObject,
+        // This is where all objects retrieved by the panel will be cached.
+        panelCacheId: "HUDPanel-" + gSequenceId(),
+        remoteObjectProvider: this.jsterm.remoteObjectProvider.bind(this.jsterm),
+      },
+    };
+
+    let propPanel = this.jsterm.openPropertyPanel(options);
+    propPanel.panel.setAttribute("hudId", this.hudId);
+
+    let onPopupHide = function JST__evalInspectPopupHide() {
+      propPanel.panel.removeEventListener("popuphiding", onPopupHide, false);
+
+      this.jsterm.clearObjectCache(options.data.panelCacheId);
+
+      if (!aMessage.parentNode && aMessage._evalCacheId) {
+        this.jsterm.clearObjectCache(aMessage._evalCacheId);
+      }
+    }.bind(this);
+
+    propPanel.panel.addEventListener("popuphiding", onPopupHide, false);
+  },
+
+  /**
    * Reports an error in the page source, either JavaScript or CSS.
    *
    * @param nsIScriptError aScriptError
    *        The error message to report.
    * @return nsIDOMElement|undefined
    *         The message element to display in the Web Console output.
    */
   reportPageError: function WCF_reportPageError(aCategory, aScriptError)
@@ -1823,29 +1879,41 @@ WebConsoleFrame.prototype = {
     // Store the body text, since it is needed later for the property tree
     // case.
     let body = aBody;
     // If a string was supplied for the body, turn it into a DOM node and an
     // associated clipboard string now.
     aClipboardText = aClipboardText ||
                      (aBody + (aSourceURL ? " @ " + aSourceURL : "") +
                               (aSourceLine ? ":" + aSourceLine : ""));
-    if (!(aBody instanceof Ci.nsIDOMNode)) {
-      aBody = this.document.createTextNode(aLevel == "dir" ?
-                                           aBody.resultString : aBody);
+
+    // Create the containing node and append all its elements to it.
+    let node = this.document.createElementNS(XUL_NS, "richlistitem");
+
+    if (aBody instanceof Ci.nsIDOMNode) {
+      bodyNode.appendChild(aBody);
     }
-
-    if (!aBody.nodeType) {
-      aBody = this.document.createTextNode(aBody.toString());
+    else {
+      let str = undefined;
+      if (aLevel == "dir") {
+        str = aBody.resultString;
+      }
+      else if (["log", "info", "warn", "error", "debug"].indexOf(aLevel) > -1 &&
+               typeof aBody == "object") {
+        this._makeConsoleLogMessageBody(node, bodyNode, aBody);
+      }
+      else {
+        str = aBody;
+      }
+
+      if (str !== undefined) {
+        aBody = this.document.createTextNode(str);
+        bodyNode.appendChild(aBody);
+      }
     }
-    if (typeof aBody == "string") {
-      aBody = this.document.createTextNode(aBody);
-    }
-
-    bodyNode.appendChild(aBody);
 
     let repeatContainer = this.document.createElementNS(XUL_NS, "hbox");
     repeatContainer.setAttribute("align", "start");
     let repeatNode = this.document.createElementNS(XUL_NS, "label");
     repeatNode.setAttribute("value", "1");
     repeatNode.classList.add("webconsole-msg-repeat");
     repeatContainer.appendChild(repeatNode);
 
@@ -1858,18 +1926,16 @@ WebConsoleFrame.prototype = {
 
     // Create the source location (e.g. www.example.com:6) that sits on the
     // right side of the message, if applicable.
     let locationNode;
     if (aSourceURL) {
       locationNode = this.createLocationNode(aSourceURL, aSourceLine);
     }
 
-    // Create the containing node and append all its elements to it.
-    let node = this.document.createElementNS(XUL_NS, "richlistitem");
     node.clipboardText = aClipboardText;
     node.classList.add("hud-msg-node");
 
     node.timestamp = timestamp;
     this.setMessageType(node, aCategory, aSeverity);
 
     node.appendChild(timestampNode);
     node.appendChild(iconContainer);
@@ -1920,16 +1986,68 @@ WebConsoleFrame.prototype = {
     }
 
     node.setAttribute("id", "console-msg-" + gSequenceId());
 
     return node;
   },
 
   /**
+   * Make the message body for console.log() calls.
+   *
+   * @private
+   * @param nsIDOMElement aMessage
+   *        The message element that holds the output for the given call.
+   * @param nsIDOMElement aContainer
+   *        The specific element that will hold each part of the console.log
+   *        output.
+   * @param object aBody
+   *        The object given by this.logConsoleAPIMessage(). This object holds
+   *        the call information that we need to display.
+   */
+  _makeConsoleLogMessageBody:
+  function WCF__makeConsoleLogMessageBody(aMessage, aContainer, aBody)
+  {
+    aMessage._evalCacheId = aBody.cacheId;
+
+    Object.defineProperty(aMessage, "_panelOpen", {
+      get: function() {
+        let nodes = aContainer.querySelectorAll(".hud-clickable");
+        return Array.prototype.some.call(nodes, function(aNode) {
+          return aNode._panelOpen;
+        });
+      },
+      enumerable: true,
+      configurable: false
+    });
+
+    aBody.remoteObjects.forEach(function(aItem, aIndex) {
+      if (aContainer.firstChild) {
+        aContainer.appendChild(this.document.createTextNode(" "));
+      }
+
+      let text = aBody.argsToString[aIndex];
+      if (!Array.isArray(aItem)) {
+        aContainer.appendChild(this.document.createTextNode(text));
+        return;
+      }
+
+      let elem = this.document.createElement("description");
+      elem.classList.add("hud-clickable");
+      elem.setAttribute("aria-haspopup", "true");
+      elem.appendChild(this.document.createTextNode(text));
+
+      this._addMessageLinkCallback(elem,
+        this._consoleLogClick.bind(this, aMessage, elem, aItem));
+
+      aContainer.appendChild(elem);
+    }, this);
+  },
+
+  /**
    * Creates the XUL label that displays the textual location of an incoming
    * message.
    *
    * @param string aSourceURL
    *        The URL of the source file responsible for the error.
    * @param number aSourceLine [optional]
    *        The line number on which the error occurred. If zero or omitted,
    *        there is no line number associated with this message.
@@ -2026,16 +2144,30 @@ WebConsoleFrame.prototype = {
     }
     else {
       linkNode = aNode.querySelector(".webconsole-msg-body");
       linkNode.classList.add("hud-clickable");
     }
 
     linkNode.setAttribute("aria-haspopup", "true");
 
+    this._addMessageLinkCallback(aNode, aCallback);
+  },
+
+  /**
+   * Add the mouse event handlers needed to make a link.
+   *
+   * @private
+   * @param nsIDOMNode aNode
+   *        The node for which you want to add the event handlers.
+   * @param function aCallback
+   *        The function you want to invoke on click.
+   */
+  _addMessageLinkCallback: function WCF__addMessageLinkCallback(aNode, aCallback)
+  {
     aNode.addEventListener("mousedown", function(aEvent) {
       this._startX = aEvent.clientX;
       this._startY = aEvent.clientY;
     }, false);
 
     aNode.addEventListener("click", function(aEvent) {
       if (aEvent.detail != 1 || aEvent.button != 0 ||
           (this._startX != aEvent.clientX &&
--- a/browser/extensions/Makefile.in
+++ b/browser/extensions/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH      = ../..
+DEPTH      = @DEPTH@
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 CHROMEDIR = $(call core_abspath,$(DIST))/bin/chrome
 
 include $(DEPTH)/config/autoconf.mk
 
--- a/browser/extensions/pdfjs/test/Makefile.in
+++ b/browser/extensions/pdfjs/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = browser/extensions/pdfjs/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES = \
   browser_pdfjs_main.js \
   browser_pdfjs_savedialog.js \
   file_pdfjs_test.pdf \
   $(NULL)
--- a/browser/fuel/Makefile.in
+++ b/browser/fuel/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
--- a/browser/fuel/public/Makefile.in
+++ b/browser/fuel/public/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE        = fuel
 XPIDL_MODULE  = fuel
--- a/browser/fuel/src/Makefile.in
+++ b/browser/fuel/src/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = fuel
 
--- a/browser/fuel/test/Makefile.in
+++ b/browser/fuel/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH          = ../../..
+DEPTH          = @DEPTH@
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = browser/fuel/test
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES =browser_Application.js \
 		browser_ApplicationPrefs.js \
 		browser_ApplicationStorage.js \
 		browser_ApplicationQuitting.js \
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
--- a/browser/installer/windows/Makefile.in
+++ b/browser/installer/windows/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -1,18 +1,18 @@
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir = browser/locales
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 vpath %.xml @srcdir@/en-US/searchplugins
 vpath %.xml $(LOCALE_SRCDIR)/searchplugins
 
--- a/browser/modules/Makefile.in
+++ b/browser/modules/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH   = ../..
+DEPTH   = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
@@ -25,13 +25,9 @@ EXTRA_JS_MODULES = \
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows) 
 EXTRA_JS_MODULES += \
 	WindowsPreviewPerTab.jsm \
 	WindowsJumpLists.jsm \
 	$(NULL)
 endif
 
-EXTRA_PP_JS_MODULES = \
-	WebappsInstaller.jsm \
-	$(NULL)
-
 include $(topsrcdir)/config/rules.mk
--- a/browser/modules/test/Makefile.in
+++ b/browser/modules/test/Makefile.in
@@ -1,17 +1,17 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/modules/test
+relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_FILES = \
                  browser_NetworkPrioritizer.js \
                  browser_TelemetryTimestamps.js \
                  $(NULL)
--- a/browser/modules/webappsUI.jsm
+++ b/browser/modules/webappsUI.jsm
@@ -6,17 +6,17 @@ let EXPORTED_SYMBOLS = ["webappsUI"];
 
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Webapps.jsm");
-Cu.import("resource:///modules/WebappsInstaller.jsm");
+Cu.import("resource://gre/modules/WebappsInstaller.jsm");
 Cu.import("resource://gre/modules/WebappOSUtils.jsm");
 
 let webappsUI = {
   init: function webappsUI_init() {
     Services.obs.addObserver(this, "webapps-ask-install", false);
     Services.obs.addObserver(this, "webapps-launch", false);
   },
   
--- a/browser/themes/Makefile.in
+++ b/browser/themes/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 #
 # Theme Selection
--- a/browser/themes/gnomestripe/Makefile.in
+++ b/browser/themes/gnomestripe/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = communicator
 
--- a/browser/themes/gnomestripe/browser.css
+++ b/browser/themes/gnomestripe/browser.css
@@ -2627,8 +2627,125 @@ stack[anonid=browserStack][responsivemod
 
 #developer-toolbar-webconsole[error-count]:before {
   color: #FDF3DE;
   min-width: 16px;
   text-shadow: none;
   background-image: -moz-linear-gradient(top, #B4211B, #8A1915);
   border-radius: 1px;
 }
+
+#social-toolbar-button {
+  -moz-appearance: toolbarbutton;
+}
+
+/* favicon for the service */
+#social-provider-image {
+  -moz-appearance: none;
+  border: none;
+  min-width: 20px;
+  min-height: 20px;
+  padding: 2px 5px;
+  margin: 0;
+  background: transparent;
+  list-style-image: url("chrome://browser/skin/social/social.png");
+}
+
+#social-provider-image > .button-box > .box-inherit > .button-icon {
+  max-height: 16px;
+  max-width: 16px;
+}
+
+#social-provider-image > .button-box {
+  padding: 0;
+  margin: 0;
+  background: transparent;
+  border: none;
+}
+
+#social-provider-image > .button-box > .button-menu-dropmarker {
+  display: none;
+}
+
+/* hbox that hold notification icons */
+#social-status-iconbox {
+  margin: 0;
+  padding: 0;
+}
+
+/* hbox that surrounds an image and its counter */
+.social-notification-icon-container {
+  padding: 0;
+  margin: 0;
+  position: relative;
+}
+
+/* notification counter box */
+.social-notification-icon-counter {
+  background-color: rgb(240,61,37);
+  border: 1px solid rgb(216,55,34);
+  box-shadow: 0px 1px 0px rgba(0,39,121,0.77);
+  padding-right: 1px;
+  padding-left: 1px;
+  color: white;
+  font-size: 9px;
+  font-weight: bold;
+  position: absolute;
+  right: -3px;
+  top: -4px;
+  z-index: 1;
+  text-align: center;
+}
+
+/* notification image */
+.social-notification-icon-image {
+  padding: 2px;
+  margin: 0;
+  min-width: 20px;
+  max-width: 32px;
+  max-height: 20px;
+  list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
+}
+
+/* social toolbar provider menu */
+#social-statusarea-popup {
+  margin-top: 0;
+  margin-left: -12px;
+  margin-right: -12px;
+}
+
+#social-statusarea-user {
+  border-bottom: 1px solid rgb(221,221,221);
+  background-color: -moz-Dialog;
+  color: -moz-dialogtext;
+  position: relative;
+  font: message-box;
+  font-size: 12px;
+}
+
+#social-statusarea-user-portrait {
+  width: 32px;
+  height: 32px;
+  border-radius: 2px;
+  margin: 10px;
+  list-style-image: url("chrome://browser/skin/social/social.png");
+}
+
+#social-statusarea-username {
+  -moz-appearance: none;
+  background: transparent;
+  border: none;
+  color: -moz-nativehyperlinktext;
+  cursor: pointer;
+  min-width: 0;
+  margin: 0 6px;
+}
+#social-statusarea-username:hover {
+  text-decoration: underline;
+}
+
+#social-notification-panel {
+  min-height: 100px;
+  min-width: 100px;
+  max-height: 600px;
+  max-width: 400px;
+}
+
--- a/browser/themes/gnomestripe/communicator/Makefile.in
+++ b/browser/themes/gnomestripe/communicator/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
--- a/browser/themes/pinstripe/Makefile.in
+++ b/browser/themes/pinstripe/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = communicator
 
--- a/browser/themes/pinstripe/communicator/Makefile.in
+++ b/browser/themes/pinstripe/communicator/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
--- a/browser/themes/winstripe/Makefile.in
+++ b/browser/themes/winstripe/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = communicator
 
--- a/browser/themes/winstripe/communicator/Makefile.in
+++ b/browser/themes/winstripe/communicator/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH     = ../../../..
+DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/build/ConfigStatus.py
@@ -0,0 +1,325 @@
+# 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/.
+
+# Combined with build/autoconf/config.status.m4, ConfigStatus is an almost
+# drop-in replacement for autoconf 2.13's config.status, with features
+# borrowed from autoconf > 2.5, and additional features.
+
+from __future__ import with_statement
+from optparse import OptionParser
+import sys, re, os, posixpath, ntpath
+from StringIO import StringIO
+# Standalone js doesn't have virtualenv.
+sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'config'))
+from Preprocessor import Preprocessor
+
+# Basic logging facility
+verbose = False
+def log(string):
+    if verbose:
+        print >>sys.stderr, string
+
+# We need relpath, but it is introduced in python 2.6
+# http://docs.python.org/library/os.path.html
+def my_relpath(path, start):
+    """
+    Return a relative version of a path
+    from /usr/lib/python2.6/posixpath.py
+    """
+
+    if not path:
+        raise ValueError("no path specified")
+
+    start_list = os.path.abspath(start).split(os.path.sep)
+    path_list = os.path.abspath(path).split(os.path.sep)
+
+    # Work out how much of the filepath is shared by start and path.
+    i = len(os.path.commonprefix([start_list, path_list]))
+
+    rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
+    if not rel_list:
+        return os.curdir
+    return os.path.join(*rel_list)
+
+relpath = getattr(os.path, "relpath", my_relpath)
+
+def ensureParentDir(file):
+    '''Ensures the directory parent to the given file exists'''
+    dir = os.path.dirname(file)
+    if dir and not os.path.exists(dir):
+        try:
+            os.makedirs(dir)
+        except OSError, error:
+            if error.errno != errno.EEXIST:
+                raise
+
+class FileAvoidWrite(StringIO):
+    '''file-like object that buffers its output and only writes it to disk
+    if the new contents are different from what the file may already contain.
+    '''
+    def __init__(self, filename):
+        self.filename = filename
+        StringIO.__init__(self)
+
+    def close(self):
+        buf = self.getvalue()
+        StringIO.close(self)
+        try:
+            file = open(self.filename, 'rU')
+        except IOError:
+            pass
+        else:
+            try:
+                 if file.read() == buf:
+                     log("%s is unchanged" % relpath(self.filename, os.curdir))
+                     return
+            except IOError:
+                pass
+            finally:
+                file.close()
+
+        log("creating %s" % relpath(self.filename, os.curdir))
+        ensureParentDir(self.filename)
+        with open(self.filename, 'w') as file:
+            file.write(buf)
+
+    def __enter__(self):
+        return self
+    def __exit__(self, type, value, traceback):
+        self.close()
+
+def shell_escape(s):
+    '''Escape some characters with a backslash, and double dollar signs.
+    '''
+    return re.sub('''([ \t`#$^&*(){}\\|;'"<>?\[\]])''', r'\\\1', str(s)).replace('$', '$$')
+
+class ConfigEnvironment(object):
+    '''A ConfigEnvironment is defined by a source directory and a build
+    directory. It preprocesses files from the source directory and stores
+    the result in the object directory.
+
+     There are two types of files: config files and config headers,
+     each treated through a different member function.
+
+     Creating a ConfigEnvironment requires a few arguments:
+       - topsrcdir and topobjdir are, respectively, the top source and
+         the top object directory.
+       - defines is a list of (name, value) tuples. In autoconf, these are
+         set with AC_DEFINE and AC_DEFINE_UNQUOTED
+       - non_global_defines are a list of names appearing in defines above
+         that are not meant to be exported in ACDEFINES and ALLDEFINES (see
+         below)
+       - substs is a list of (name, value) tuples. In autoconf, these are
+         set with AC_SUBST.
+
+     ConfigEnvironment automatically defines two additional substs variables
+     from all the defines not appearing in non_global_defines:
+       - ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
+         preprocessor command lines. The order in which defines were given
+         when creating the ConfigEnvironment is preserved.
+       - ALLDEFINES contains the defines in the form #define NAME VALUE, in
+         sorted order, for use in config files, for an automatic listing of
+         defines.
+
+    ConfigEnvironment expects a "top_srcdir" subst to be set with the top
+    source directory, in msys format on windows. It is used to derive a
+    "srcdir" subst when treating config files. It can either be an absolute
+    path or a path relative to the topobjdir.
+    '''
+
+    def __init__(self, topobjdir = '.', topsrcdir = '.',
+                 defines = [], non_global_defines = [], substs = []):
+        self.defines = dict(defines)
+        self.substs = dict(substs)
+        self.topsrcdir = topsrcdir
+        self.topobjdir = topobjdir
+        global_defines = [name for name, value in defines if not name in non_global_defines]
+        self.substs['ACDEFINES'] = ' '.join(["-D%s=%s" % (name, shell_escape(self.defines[name])) for name in global_defines])
+        self.substs['ALLDEFINES'] = '\n'.join(sorted(["#define %s %s" % (name, self.defines[name]) for name in global_defines]))
+
+    def get_relative_srcdir(self, file):
+        '''Returns the relative source directory for the given file, always
+        using / as a path separator.
+        '''
+        assert(isinstance(file, basestring))
+        dir = posixpath.dirname(relpath(file, self.topobjdir).replace(os.sep, '/'))
+        if dir:
+            return dir
+        return '.'
+
+    def get_top_srcdir(self, file):
+        '''Returns a normalized top_srcdir for the given file: if
+        substs['top_srcdir'] is a relative path, it is relative to the
+        topobjdir. Adjust it to be relative to the file path.'''
+        top_srcdir = self.substs['top_srcdir']
+        if posixpath.isabs(top_srcdir) or ntpath.isabs(top_srcdir):
+            return top_srcdir
+        return posixpath.normpath(posixpath.join(self.get_depth(file), top_srcdir))
+
+    def get_file_srcdir(self, file):
+        '''Returns the srcdir for the given file, where srcdir is in msys
+        format on windows, thus derived from top_srcdir.
+        '''
+        dir = self.get_relative_srcdir(file)
+        top_srcdir = self.get_top_srcdir(file)
+        return posixpath.normpath(posixpath.join(top_srcdir, dir))
+
+    def get_depth(self, file):
+        '''Returns the DEPTH for the given file, that is, the path to the
+        object directory relative to the directory containing the given file.
+        Always uses / as a path separator.
+        '''
+        return relpath(self.topobjdir, os.path.dirname(file)).replace(os.sep, '/')
+
+    def get_input(self, file):
+        '''Returns the input file path in the source tree that can be used
+        to create the given config file or header.
+        '''
+        assert(isinstance(file, basestring))
+        return os.path.normpath(os.path.join(self.topsrcdir, "%s.in" % relpath(file, self.topobjdir)))
+
+    def create_config_file(self, path):
+        '''Creates the given config file. A config file is generated by
+        taking the corresponding source file and replacing occurences of
+        "@VAR@" by the value corresponding to "VAR" in the substs dict.
+
+        Additional substs are defined according to the file being treated:
+            "srcdir" for its the path to its source directory
+            "relativesrcdir" for its source directory relative to the top
+            "DEPTH" for the path to the top object directory
+        '''
+        input = self.get_input(path)
+        pp = Preprocessor()
+        pp.context.update(self.substs)
+        pp.context.update(top_srcdir = self.get_top_srcdir(path))
+        pp.context.update(srcdir = self.get_file_srcdir(path))
+        pp.context.update(relativesrcdir = self.get_relative_srcdir(path))
+        pp.context.update(DEPTH = self.get_depth(path))
+        pp.do_filter('attemptSubstitution')
+        pp.setMarker(None)
+        with FileAvoidWrite(path) as pp.out:
+            pp.do_include(input)
+
+    def create_config_header(self, path):
+        '''Creates the given config header. A config header is generated by
+        taking the corresponding source file and replacing some #define/#undef
+        occurences:
+            "#undef NAME" is turned into "#define NAME VALUE"
+            "#define NAME" is unchanged
+            "#define NAME ORIGINAL_VALUE" is turned into "#define NAME VALUE"
+            "#undef UNKNOWN_NAME" is turned into "/* #undef UNKNOWN_NAME */"
+            Whitespaces are preserved.
+        '''
+        with open(self.get_input(path), 'rU') as input:
+            ensureParentDir(path)
+            output = FileAvoidWrite(path)
+            r = re.compile('^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?', re.U)
+            for l in input:
+                m = r.match(l)
+                if m:
+                    cmd = m.group('cmd')
+                    name = m.group('name')
+                    value = m.group('value')
+                    if name:
+                        if name in self.defines:
+                            if cmd == 'define' and value:
+                                l = l[:m.start('value')] + str(self.defines[name]) + l[m.end('value'):]
+                            elif cmd == 'undef':
+                                l = l[:m.start('cmd')] + 'define' + l[m.end('cmd'):m.end('name')] + ' ' + str(self.defines[name]) + l[m.end('name'):]
+                        elif cmd == 'undef':
+                           l = '/* ' + l[:m.end('name')] + ' */' + l[m.end('name'):]
+
+                output.write(l)
+            output.close()
+
+def config_status(topobjdir = '.', topsrcdir = '.',
+                  defines = [], non_global_defines = [], substs = [],
+                  files = [], headers = []):
+    '''Main function, providing config.status functionality.
+
+    Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
+    variables, but like config.status from autoconf 2.6, single files may be
+    generated with the --file and --header options. Several such options can
+    be given to generate several files at the same time.
+
+    Without the -n option, this program acts as config.status and considers
+    the current directory as the top object directory, even when config.status
+    is in a different directory. It will, however, treat the directory
+    containing config.status as the top object directory with the -n option,
+    while files given to the --file and --header arguments are considered
+    relative to the current directory.
+
+    The --recheck option, like with the original config.status, runs configure
+    again, with the options given in the "ac_configure_args" subst.
+
+    The options to this function are passed when creating the
+    ConfigEnvironment, except for files and headers, which contain the list
+    of files and headers to be generated by default. These lists, as well as
+    the actual wrapper script around this function, are meant to be generated
+    by configure. See build/autoconf/config.status.m4.
+
+    Unlike config.status behaviour with CONFIG_FILES and CONFIG_HEADERS,
+    but like config.status behaviour with --file and --header, providing
+    files or headers on the command line inhibits the default generation of
+    files when given headers and headers when given files.
+
+    Unlike config.status, the FILE:TEMPLATE syntax is not supported for
+    files and headers. The template is always the filename suffixed with
+    '.in', in the corresponding directory under the top source directory.
+    '''
+
+    if 'CONFIG_FILES' in os.environ:
+        raise Exception, 'Using the CONFIG_FILES environment variable is not supported. Use --file instead.'
+    if 'CONFIG_HEADERS' in os.environ:
+        raise Exception, 'Using the CONFIG_HEADERS environment variable is not supported. Use --header instead.'
+
+    parser = OptionParser()
+    parser.add_option('--recheck', dest='recheck', action='store_true',
+                      help='update config.status by reconfiguring in the same conditions')
+    parser.add_option('--file', dest='files', metavar='FILE', action='append',
+                      help='instantiate the configuration file FILE')
+    parser.add_option('--header', dest='headers', metavar='FILE', action='append',
+                      help='instantiate the configuration header FILE')
+    parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
+                      help='display verbose output')
+    parser.add_option('-n', dest='not_topobjdir', action='store_true',
+                      help='do not consider current directory as top object directory')
+    (options, args) = parser.parse_args()
+
+    # Without -n, the current directory is meant to be the top object directory
+    if not options.not_topobjdir:
+        topobjdir = '.'
+
+    env = ConfigEnvironment(topobjdir = topobjdir, topsrcdir = topsrcdir,
+                            defines = defines, non_global_defines = non_global_defines,
+                            substs = substs)
+
+    if options.recheck:
+        # Execute configure from the top object directory
+        if not os.path.isabs(topsrcdir):
+            topsrcdir = relpath(topsrcdir, topobjdir)
+        os.chdir(topobjdir)
+        os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
+
+    if options.files:
+        files = options.files
+        headers = []
+    if options.headers:
+        headers = options.headers
+        if not options.files:
+            files = []
+    # Default to display messages when giving --file or --headers on the
+    # command line.
+    if options.files or options.headers or options.verbose:
+        global verbose
+        verbose = True
+    if not options.files and not options.headers:
+        print >>sys.stderr, "creating config files and headers..."
+        files = [os.path.join(topobjdir, f) for f in files]
+        headers = [os.path.join(topobjdir, f) for f in headers]
+
+    for file in files:
+        env.create_config_file(file)
+    for header in headers:
+        env.create_config_header(header)
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = build
 
@@ -21,17 +21,16 @@ DIRS = win32
 endif
 
 ifdef STLPORT_SOURCES
 DIRS += stlport
 endif
 
 DIRS += pgo
 
-TEST_DIRS += autoconf/test
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
 TEST_DIRS += mobile/sutagent/android \
           mobile/sutagent/android/watcher \
           mobile/sutagent/android/ffxcp \
           mobile/sutagent/android/fencp \
           mobile/robocop \
           $(NULL)
 endif
@@ -258,9 +257,13 @@ check::
 endif
 
 ifeq ($(OS_ARCH),Linux)
 libs:: $(topsrcdir)/tools/rb/fix-linux-stack.pl
 	$(INSTALL) $< $(DIST)/bin
 endif
 
 GARBAGE += $(srcdir)/automationutils.pyc
+
+# Test for ConfigStatus.py
+check::
+	$(PYTHON) $(srcdir)/tests/unit-ConfigStatus.py
 endif # ENABLE_TESTS
deleted file mode 100755
--- a/build/autoconf/acoutput-fast.pl
+++ /dev/null
@@ -1,170 +0,0 @@
-#! /usr/bin/env perl
-#
-# 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/.
-
-# acoutput-fast.pl - Quickly create makefiles that are in a common format.
-#
-# Most of the makefiles in mozilla only refer to two configure variables:
-#     @srcdir@
-#     @top_srcdir@
-# However, configure does not know any better and it runs sed on each file
-# with over 150 replacement rules (slow as molasses).
-#
-# This script takes a list of makefiles as input. For example,
-#   
-#     echo $MAKEFILES | acoutput-fast.pl
-#
-# The script creates each Makefile that only references @srcdir@ and
-# @top_srcdir@. For other files, it lists them in a shell command that is
-# printed to stdout:
-#
-#     CONFIG_FILES="unhandled_files..."; export CONFIG_FILES
-#
-# This command can be used to have config.status create the unhandled
-# files. For example,
-#
-#     eval "echo $MAKEFILES | acoutput-fast.pl"
-#     AC_OUTPUT($MAKEFILES)
-#
-# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
-
-#use File::Basename;
-sub dirname {
-  my $dir = $_[0];
-  return '.' if not $dir =~ m%/%;
-  $dir =~ s%/[^/][^/]*$%%;
-  return $dir;
-}
-
-# Create one directory. Assumes it doesn't already exist.
-# Will create parent(s) if needed.
-sub create_directory {
-  my $dir = $_[0];
-  my $parent = dirname($dir);
-  create_directory($parent) if not -d $parent;
-  mkdir "$dir",0777;
-}
-
-# Create all the directories at once.
-#   This can be much faster than calling mkdir() for each one.
-sub create_directories {
-  my @makefiles = @_;
-  my @dirs = ();
-  my $ac_file;
-  foreach $ac_file (@makefiles) {
-    push @dirs, dirname($ac_file);
-  }
-  # Call mkdir with the directories sorted by subdir count (how many /'s)
-  if (@dirs) {
-    foreach $dir (@dirs) {
-      if (not -d $dir) {
-        print STDERR "Creating directory $dir\n";
-        create_directory($dir);
-      }
-    }
-  }
-}
-
-while($arg = shift) {
-    if ($arg =~ /^--srcdir=/) {
-        $ac_given_srcdir = (split /=/, $arg)[1];
-    }
-    if ($arg =~ /^--cygwin-srcdir/) {
-        $ac_cygwin_srcdir = (split /=/, $arg)[1];
-    }
-}
-
-if (!$ac_given_srcdir) {
-  $ac_given_srcdir = $0;
-  $ac_given_srcdir =~ s|/?build/autoconf/.*$||;
-  $ac_given_srcdir = '.' if $ac_given_srcdir eq '';
-}
-
-if (!$ac_cygwin_srcdir) {
-    $ac_cygwin_srcdir = $ac_given_srcdir;
-}
-
-# Read list of makefiles from the stdin or,
-#   from files listed on the command-line.
-#
-@makefiles=();
-push @makefiles, split while (<STDIN>);
-
-# Create all the directories at once.
-#   This can be much faster than calling mkdir() for each one.
-create_directories(@makefiles);
-
-# Output the makefiles.
-#
-@unhandled=();
-foreach $ac_file (@makefiles) {
-  if (not $ac_file =~ /Makefile$/ or $ac_file =~ /:/) {
-    push @unhandled, $ac_file;
-    next;
-  }
-  $ac_file_in = "$ac_given_srcdir/$ac_file.in";
-  $ac_dir = dirname($ac_file);
-  if ($ac_dir eq '.') {
-    $ac_dir_suffix = '';
-    $ac_dots = '';
-  } else {
-    $ac_dir_suffix = "/$ac_dir";
-    $ac_dir_suffix =~ s%^/\./%/%;
-    $ac_dots = $ac_dir_suffix;
-    $ac_dots =~ s%/[^/]*%../%g;
-  }
-  if ($ac_given_srcdir eq '.') {
-    $srcdir = '.';
-    if ($ac_dots eq '') {
-      $top_srcdir = '.'
-    } else {
-      $top_srcdir = $ac_dots;
-      $top_srcdir =~ s%/$%%;
-    }
-  } elsif ($ac_cygwin_srcdir =~ m%^/% or $ac_cygwin_srcdir =~ m%^.:/%) {
-    $srcdir     = "$ac_cygwin_srcdir$ac_dir_suffix";
-    $top_srcdir = "$ac_cygwin_srcdir";
-  } else {
-    $srcdir     = "$ac_dots$ac_cygwin_srcdir$ac_dir_suffix";
-    $top_srcdir = "$ac_dots$ac_cygwin_srcdir";
-  }
-
-  if (-e $ac_file) {
-    next if -M _ < -M $ac_file_in;
-    print STDERR "updating $ac_file\n";
-  } else {
-    print STDERR "creating $ac_file\n";
-  }
-
-  open (INFILE, "<$ac_file_in")
-    or ( die "can't read $ac_file_in: No such file or directory\n");
-  open (OUTFILE, ">$ac_file")
-    or ( warn "Unable to create $ac_file\n" and next);
-
-  while (<INFILE>) {
-    #if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) {
-    #  warn "Two defines on a line:$ac_file:$.:$_";
-    #  push @unhandled, $ac_file;
-    #  last;
-    #}
-
-    s/\@srcdir\@/$srcdir/g;
-    s/\@top_srcdir\@/$top_srcdir/g;
-
-    if (/\@[_a-zA-Z]*\@/) {
-      warn "Unknown variable:$ac_file:$.:$_";
-      push @unhandled, $ac_file;
-      last;
-    }
-    print OUTFILE;
-  }
-  close INFILE;
-  close OUTFILE;
-}
-
-# Print the shell command to be evaluated by configure.
-#
-print "CONFIG_FILES=\"".join(' ', @unhandled)."\"; export CONFIG_FILES\n";
-
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -10,22 +10,30 @@ MOZ_ARG_WITH_STRING(android-ndk,
                           location where the Android NDK can be found],
     android_ndk=$withval)
 
 MOZ_ARG_WITH_STRING(android-toolchain,
 [  --with-android-toolchain=DIR
                           location of the android toolchain],
     android_toolchain=$withval)
 
+dnl default android_version is different per target cpu
+case "$target_cpu" in
+arm)
+    android_version=5
+    ;;
+i?86|mipsel)
+    android_version=9
+    ;;
+esac
 
 MOZ_ARG_WITH_STRING(android-version,
 [  --with-android-version=VER
-                          android platform version, default 5],
-    android_version=$withval,
-    android_version=5)
+                          android platform version, default 5 for arm, 9 for x86/mips],
+    android_version=$withval)
 
 MOZ_ARG_WITH_STRING(android-platform,
 [  --with-android-platform=DIR
                            location of platform dir],
     android_platform=$withval)
 
 case "$target" in
 arm-linux*-android*|*-linuxandroid*)
new file mode 100644
--- /dev/null
+++ b/build/autoconf/config.status.m4
@@ -0,0 +1,170 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl For use in AC_SUBST replacement
+define([MOZ_DIVERSION_SUBST], 11)
+
+dnl Replace AC_SUBST to store values in a format suitable for python.
+dnl The necessary comma after the tuple can't be put here because it
+dnl can mess around with things like:
+dnl    AC_SOMETHING(foo,AC_SUBST(),bar)
+define([AC_SUBST],
+[ifdef([AC_SUBST_$1], ,
+[define([AC_SUBST_$1], )dnl
+AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
+        (''' $1 ''', r''' [$]$1 ''')
+AC_DIVERT_POP()dnl
+])])
+
+dnl Wrap AC_DEFINE to store values in a format suitable for python.
+dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
+dnl which is #included during some compile checks.
+dnl The necessary comma after the tuple can't be put here because it
+dnl can mess around with things like:
+dnl    AC_SOMETHING(foo,AC_DEFINE(),bar)
+define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
+define([AC_DEFINE],
+[cat >> confdefs.pytmp <<\EOF
+        (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
+EOF
+ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
+])
+
+dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
+dnl python.
+define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
+define([AC_DEFINE_UNQUOTED],
+[cat >> confdefs.pytmp <<EOF
+        (''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
+EOF
+ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
+])
+
+dnl Replace AC_OUTPUT to create and call a python config.status
+define([AC_OUTPUT],
+[dnl Top source directory in Windows format (as opposed to msys format).
+WIN_TOP_SRC=
+encoding=utf-8
+case "$host_os" in
+mingw*)
+    WIN_TOP_SRC=`cd $srcdir; pwd -W`
+    encoding=mbcs
+    ;;
+esac
+AC_SUBST(WIN_TOP_SRC)
+
+dnl Used in all Makefile.in files
+top_srcdir=$srcdir
+AC_SUBST(top_srcdir)
+
+dnl Picked from autoconf 2.13
+trap '' 1 2 15
+AC_CACHE_SAVE
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+: ${CONFIG_STATUS=./config.status}
+
+dnl We're going to need [ ] for python syntax.
+changequote(<<<, >>>)dnl
+echo creating $CONFIG_STATUS
+
+cat > $CONFIG_STATUS <<EOF
+#!${PYTHON}
+# coding=$encoding
+
+import os, sys
+dnl topsrcdir is the top source directory in native form, as opposed to a
+dnl form suitable for make.
+topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
+if not os.path.isabs(topsrcdir):
+    topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
+dnl Don't rely on virtualenv here. Standalone js doesn't use it.
+sys.path.append(os.path.join(topsrcdir, ${COMM_BUILD:+'mozilla',} 'build'))
+from ConfigStatus import config_status
+
+args = {
+    'topsrcdir': topsrcdir,
+    'topobjdir': os.path.dirname(<<<__file__>>>),
+
+dnl All defines and substs are stored with an additional space at the beginning
+dnl and at the end of the string, to avoid any problem with values starting or
+dnl ending with quotes.
+    'defines': [(name[1:-1], value[1:-1]) for name, value in [
+EOF
+
+dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
+dnl lacks the final comma (see above).
+sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
+rm confdefs.pytmp confdefs.h
+
+cat >> $CONFIG_STATUS <<\EOF
+    ] ],
+
+    'substs': [(name[1:-1], value[1:-1]) for name, value in [
+EOF
+
+dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
+dnl expected format, but lacks the final comma (see above).
+sed 's/$/,/' >> $CONFIG_STATUS <<EOF
+undivert(MOZ_DIVERSION_SUBST)dnl
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+    ] ],
+
+dnl List of files to apply AC_SUBSTs to. This is the list of files given
+dnl as an argument to AC_OUTPUT ($1)
+    'files': [
+EOF
+
+for out in $1; do
+  echo "        '$out'," >> $CONFIG_STATUS
+done
+
+cat >> $CONFIG_STATUS <<\EOF
+    ],
+
+dnl List of header files to apply AC_DEFINEs to. This is stored in the
+dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
+    'headers': [
+EOF
+
+ifdef(<<<AC_LIST_HEADER>>>, <<<
+HEADERS="AC_LIST_HEADER"
+for header in $HEADERS; do
+  echo "        '$header'," >> $CONFIG_STATUS
+done
+>>>)dnl
+
+cat >> $CONFIG_STATUS <<\EOF
+    ],
+
+dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
+    'non_global_defines': [
+EOF
+
+if test -n "$_NON_GLOBAL_ACDEFINES"; then
+  for var in $_NON_GLOBAL_ACDEFINES; do
+    echo "        '$var'," >> $CONFIG_STATUS
+  done
+fi
+
+cat >> $CONFIG_STATUS <<\EOF
+    ]
+}
+
+dnl Do the actual work
+config_status(**args)
+EOF
+changequote([, ])
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+dnl Execute config.status, unless --no-create was passed to configure.
+test "$no_create" = yes || ${PYTHON} $CONFIG_STATUS || exit 1
+])
new file mode 100644
--- /dev/null
+++ b/build/autoconf/linux.m4
@@ -0,0 +1,39 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_LINUX_PERF_EVENT],
+[
+
+MOZ_ARG_WITH_STRING(linux-headers,
+[  --with-linux-headers=DIR
+                          location where the Linux kernel headers can be found],
+    linux_headers=$withval)
+
+LINUX_HEADERS_INCLUDES=
+
+if test "$linux_headers"; then
+    LINUX_HEADERS_INCLUDES="-I$linux_headers"
+fi
+
+_SAVE_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $LINUX_HEADERS_INCLUDES"
+
+dnl Performance measurement headers.
+MOZ_CHECK_HEADER(linux/perf_event.h,
+    [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
+        [AC_TRY_COMPILE([#include <asm/unistd.h>],[return sizeof(__NR_perf_event_open);],
+        ac_cv_perf_event_open=yes,
+        ac_cv_perf_event_open=no)])])
+if test "$ac_cv_perf_event_open" = "yes"; then
+    HAVE_LINUX_PERF_EVENT_H=1
+else
+    HAVE_LINUX_PERF_EVENT_H=
+    LINUX_HEADERS_INCLUDES=
+fi
+AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
+AC_SUBST(LINUX_HEADERS_INCLUDES)
+
+CFLAGS="$_SAVE_CFLAGS"
+
+])
deleted file mode 100755
--- a/build/autoconf/make-makefile
+++ /dev/null
@@ -1,444 +0,0 @@
-#!/usr/bin/env perl
-# 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/.
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-use Getopt::Long;
-
-use Benchmark;
-use Cwd;
-use File::Basename;
-use File::Copy;
-use File::Path      qw{mkpath};
-
-##-------------------##
-##---]  EXPORTS  [---##
-##-------------------##
-our $VERSION = qw(2.0);
-
-##--------------------##
-##---]  INCLUDES  [---##
-##--------------------##
-
-##############################################################
-# pymake: special case path handling for windows cmd shell.
-#   if invoked by cmd.exe and msys-perl is in play
-#     $0 may contain a drive letter
-#     modules use-or-expect msys/unix paths
-#     adjust $0 => C:/foo => /c/foo so string tests and
-#     manipulation can by applied properly.
-##############################################################
-sub BEGIN
-{
-    if ($^O eq 'msys' && $ENV{PATH} =~ m!\w:/!)
-    {
-	$0 =~ s!^(\w):!/$1!;
-    }
-    eval 'use FindBin';
-    die $@ if ($@);
-}
-
-use lib $FindBin::Bin;
-use makemakefile;
-
-##-------------------##
-##---]  GLOBALS  [---##
-##-------------------##
-my %argv;
-
-my $t0 = Benchmark->new();
-sub END
-{
-    if ($argv{bench})
-    {
-        my $t1 = Benchmark->new();
-        my $delta = timediff($t1, $t0);
-        print STDERR timestr($delta), "\n";
-    }
-}
-
-##----------------##
-##---]  MAIN  [---##
-##----------------##
-umask 0;
-
-my $debug = $argv{debug} || 0;
-
-my $pwdcmd = ($^O eq 'msys') ? 'pwd -W' : 'pwd';
-
-# Determine various tree path variables
-#
-my ($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
-
-my $object_fullpath = `$pwdcmd`; # Cwd::getcwd()
-chdir $depth;
-my $object_root = `$pwdcmd`;  # Cwd::getcwd()
-chomp $object_fullpath;
-chomp $object_root;
-
-# $source_subdir is the path from the object root to where
-#    'make-makefile' was called. For example, if make-makefile was
-#    called from "mozilla/gfx/src", then $source_subdir would be
-#    "gfx/src/".
-my $source_subdir = "$object_fullpath/";
-my $quoted_object_root = quotemeta($object_root);
-$source_subdir =~ s|^$quoted_object_root/||;
-
-# Prefix makefiles with $source_subdir so that paths
-# will be relative to the top of the object tree.
-#
-my $makefile;
-for $makefile (@makefiles) { # dead code ?
-  $makefile = "$source_subdir$makefile";
-}
-
-# Find the path to the source directory based on how 'make-makefile'
-#  was invoked. The path is either relative to the object directory
-#  or an absolute path.
-my $given_srcdir = find_srcdir($topsrcdir, $depth);
-my $pgiven_srcdir = find_srcdir($ptopsrcdir, $depth);
-
-if ($debug) {
-  warn "object_fullpath = $object_fullpath\n";
-  warn "object_root     = $object_root\n";
-  warn "source_subdir   = $source_subdir\n";
-  warn "makefiles       = @makefiles\n";
-  warn "given_srcdir    = $given_srcdir\n";
-}
-
-my @errors;
-my @unhandled = update_makefiles_legacy($given_srcdir, $pgiven_srcdir, @makefiles);
-push(@errors, $@) if ($@);
-
-run_config_status(@unhandled);
-push(@errors, $@) if ($@ && $argv{'no-warnings'});
-
-exit scalar(@errors);
-
-# end of Main
-############################################################
-
-###########################################################################
-# find_depth: Pull the value of DEPTH out of a Makefile (or Makefile.in)
-###########################################################################
-sub find_depth {
-  my $depth = '';
-  open(MAKEFILE, "<$_[0]") || die "Unable to open $_[0]: $!\n";
-  while (<MAKEFILE>) {
-    next unless /^DEPTH\s*=\s*(\..*)/;
-    $depth = $1;
-    last;
-  }
-  close MAKEFILE;
-  return $depth;
-}
-
-###########################################################################
-## Intent: Parse command line arguments and assign values
-###########################################################################
-sub parse_arguments {
-  my @args = @_;
-  my @makefiles = ();
-
-  my @arglist = qw(badtokens! bench
-                   chdir=s
-                   debug
-                   depth|d=s
-                   enhanced
-                   obj=s top|t=s ptop|p=s
-                   src=s dst=s
-                   );
-  unless(GetOptions(\%argv, @arglist))
-  {
-      my $script = join('/', $FindBin::RealBin, $FindBin::Script);
-      system("perldoc $script </dev/null");
-      exit
-  }
-  @args = @ARGV;
-
-  my $topsrcdir = $argv{top} || '';
-  if (! $topsrcdir)
-  {
-      $topsrcdir = $argv{top} = getTopDir();
-  }
-
-  my $ptopsrcdir ||= $argv{ptop} || $topsrcdir || '';
-
-  ## Init --no- switch values
-  foreach my $var (qw(badtokens exclusions warnings))
-  {
-      $argv{"no-${var}"} = $argv{$var} || 0;
-  }
-  # Propogate parsed arguments for module use [--debug, --verbose]
-  while (my($k, $v) = each %argv)
-  {
-      $main::argv{$k} = $v;
-  }
-
-  if ($argv{chdir})
-  {
-      chdir $argv{chdir} || die "chdir $argv{chdir} failed: $!";
-  }
-
-  ##############################################################
-  ## Arguments allowing make-makefile to be invoked from $topsrc
-  ##############################################################
-  if (!$argv{top} || !$argv{obj})
-  {
-  }
-  ## Limit access to container makefiles for now
-  elsif ($argv{enhanced})
-  {
-      my @errors;
-
-      ## iterate over @ARGV to preserve original filename for 'unhandled'
-      my @files = map{ getRelPath($_) } @ARGV;
-
-      my $top = getTopDir();
-      my $obj = getObjDir();
-
-      mkdirr(map{ "$obj/$_" } @files);
-      push(@errors, $@) if ($@); # legacy behavior: do not exit with status
-
-      my $exclude = join('/', $FindBin::RealBin, $FindBin::Script);
-      $exclude .= '.excl'; # $argv{exclude}
-      my %exclude = getExclusions($exclude);
-      my @unhandled;
-      foreach my $relpath (@files)
-      {
-          my $rel = join('/', $relpath, 'Makefile.in');
-          my $mf = join('/', $top, $rel);
-          next if ($exclude{$rel});
-          print STDERR " ** relpath=[$relpath], mf=[$mf]\n" if ($main::argv{debug});
-
-          my $rc = updateMakefiles($relpath, {depth=>$depth, obj=>$obj, top=>$top});
-          if ($@)
-          {
-            push(@errors, $@);
-          }
-          elsif ($rc eq 'badtokens')
-          {
-            push(@unhandled, $mf);
-          }
-      }
-
-      run_config_status(@unhandled);
-      push(@errors, $@) if ($@ && $argv{'no-warnings'});
-      exit scalar(@errors);
-  }
-
-
-  my $depth = $argv{depth} || '';
-  if (! $depth)
-  {
-      foreach my $fyl (@args)
-      {
-          if (my $tmp = find_depth($fyl))
-          {
-              $depth = $tmp;
-              last;
-          }
-      }
-  }
-
-  if (! $depth) {
-    # Use $(DEPTH) in the Makefile or Makefile.in to determine the depth
-    if (-e "Makefile.in") {
-      $depth = find_depth("Makefile.in");
-    } elsif (-e "Makefile") {
-      $depth = find_depth("Makefile");
-    } elsif (-e "../Makefile") {
-      $depth = "../".find_depth("../Makefile");
-      $depth =~ s/\/\.$//;
-    } else {
-      warn "Unable to determine depth (e.g. ../..) to root of objdir tree.\n";
-      die  "No Makefile(.in) present. Try running with '-d <depth>'\n";
-    }
-  } 
-
-  # Build the list of makefiles to generate
-  #
-  @makefiles = ();
-  while (@args)
-  {
-      next unless my $makefile = shift @args;
-      $makefile =~ s/\.in$//;
-      $makefile =~ s/\/$//;
-      $makefile =~ /Makefile$/
-        or $makefile =~ /^\.\//
-        or $makefile .= "/Makefile";
-    push @makefiles, "$makefile";
-  }
-  @makefiles = "Makefile" unless @makefiles;
-
-  return ($topsrcdir, $ptopsrcdir, $depth, @makefiles);
-}
-
-# Find the top of the source directory
-# (Assuming that the executable is in $top_srcdir/build/autoconf)
-sub find_srcdir {
-  my ($ac_given_srcdir, $depth) = @_;
-
-  if ($debug) {
-    print "ac_given_srcdir = $ac_given_srcdir\n";
-    print "depth           = $depth\n";
-  }
-  if ($ac_given_srcdir =~ /^\./ and $depth ne '.') {
-    my $quoted_depth = quotemeta($depth);
-    $ac_given_srcdir =~ s|^$quoted_depth/?||;
-  }
-  if ($debug) {
-    print "ac_given_srcdir = $ac_given_srcdir\n";
-  }
-  $ac_given_srcdir = '.' if $ac_given_srcdir eq '';
-  return $ac_given_srcdir;
-}
-
-1;
-###########################################################################
-## perldoc 
-###########################################################################
-__END__
-
-=head1 NAME
-
-make-makefile - Generate a Makefile from a F<Makefile.in> template
-
-=head1 SYNOPSIS
-
-make-makefile [--top t] [--obj o] [--depth d] foo/bar/Makefile.in tans/fans/Makefile foo/bar
-
-=head1 DESCRIPTION
-
-Given options and makefile path arguments determine path to the template
-F<Makefile.in> beneath a source directory and path to generated F<Makefile>
-beneath $MOZ_OBJDIR.  DEPTH from destination directory to the 'root' will
-also be determined.  F<Makefile.in> will be read in, template strings of the
-gorm @token@ will be replaced with derived values and a generated makefile
-will be written out as F<Makefile>.
-
-Makefile DEPTH= can be determined in a few different ways:
-  o The string C<DEPTH=../../..> may be embedded within F<Makefile.in>.
-  o Search parent directories for F<Makefile.in> and use it to assign the child.
-
-
-=head2 Option List
-
-=over 4
-
-=item --chdir
-
-Move to this directory before doing anything else
-
-=item -d, --depth
-
-Explicitly specify the relative path from directory containing Makefile.in
-to the top sandbox directory.  memory/makefile, DEPTH=../.., js/src/config, DEPTH=..
-
-=item --enhanced
-
-Use alternate/simplified path construction when options --top and --obj are
-passed.  This feature will be used by container makefiles to support makefile
-generation while cd'd into the sandbox top directory.
-
-=item -t, --top
-
-Path the root of a development sandbox.
-
-=item --obj
-
-Path to object directory where generated makefile will be written ($MOZ_OBJDIR).
-
-=item --ptop
-
-Print top source dir
-
-=back
-
-
-=head2 Options List DEBUG
-
-=over 4
-
-=item --bench
-
-Enable script benchmarking, report elapsed runtime.
-
-=item --debug
-
-Enable script debug mode.
-
-=back
-
-
-=head2 Options List --NO-
-
-=over 4
-
-=item --no-badtokens (wip)
-
-Handle unexpanded @token@ makefile tokens as an error condition.
-Do not rely on system(config.status) to externally supply values.
-
-=item --no-excludes
-
-Ignore file entries on the exclusion list, generate everything.
-
-=item --no-warnings
-
-Warnings are handled as an error condition.
-
-=back
-
-
-=head2 Examples
-
-=over 4
-
-=item * make-makefile -t /mozilla/nightly -d . memory/mozalloc
-
-cd $MOZ_OBJDIR;
---top and --depth are explicitly set for generting memory/mozalloc/Makefile.
-
-=item * make-makefile -t /mozilla/nightly -d ../../../.. html5lib_tree_construction/Makefile
-
-cd $MOZ_OBJDIR/parser/htmlparser/tests/mochitest
-
---top and --depth are explicitly set for generting a makefile from within
-a subdirectory of $MOZ_OBJDIR
-
-=item * make-makefile --top /mozilla/nightly --obj /mozilla/nightly/obj memory/mozalloc
-
-With --top and --obj explicitly set generate $MOZ_OBJDIR/memory/mozalloc/Makefile
-while sitting in the sandbox root.
-
-=back
-
-
-=head2 Work In Progress
-
-=over 4
-
-=item --no-badtokens
-
-Fail on unexpanded @foo@ makefile tokens.  Any tokens that can be expanded
-directly by make-makefile will avoid config.status shell overhead.
-
-=item Depth from delta(--obj, --top)
-
-If DEPTH= has not been embedded within a makefile the value could
-be set directly if --top and --obj are specified and the paths overlap.
-
-=back
-
-
-=head1 SEE ALSO
-
-L<config/rules.mk>
-
-=cut
deleted file mode 100644
--- a/build/autoconf/make-makefile.excl
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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/.
-
-###########################################################################
-## Intent: Exclusion list for container make builds
-###########################################################################
-
-# EOF
deleted file mode 100644
--- a/build/autoconf/makemakefile.pm
+++ /dev/null
@@ -1,711 +0,0 @@
-package makemakefile;
-
-# 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/.
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-# use feature 'state'; 5.10+ not available everywhere
-
-##-------------------##
-##---]  EXPORTS  [---##
-##-------------------##
-our $VERSION = qw(2.0);
-use Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT = qw(dirname_legacy
-                 getConfig getDepth getRelPath getObjDir getTopDir mkdirr
-                 getExclusions
-                 run_config_status
-                 updateMakefiles
-                 update_makefiles_legacy
-                 );
-
-##--------------------##
-##---]  INCLUDES  [---##
-##--------------------##
-use Cwd;
-use Cwd     qw{abs_path};
-use FindBin;
-use File::Basename;
-use File::Copy;
-
-##-------------------##
-##---]  GLOBALS  [---##
-##-------------------##
-umask 0;
-my $cwd = Cwd::abs_path('.');
-my %argv;
-
-
-###########################################################################
-## Intent: Helper function, retrieve contents of a file with error checking
-## -----------------------------------------------------------------------
-## Args:
-##   scalar   path to input file
-## Returns:
-##   array    contents of the given file
-##   $@       set on error
-###########################################################################
-sub cat
-{
-    my $fyl = shift || '';
-    $@ = '';
-    my @data;
-
-    local *FYL;
-    if (!open(FYL, $fyl))
-    {
-        $@ = "open($fyl) failed: $!";
-    }
-    else
-    {
-        @data = <FYL>;
-        close(FYL);
-    }
-    return @data;
-} # cat
-
-###########################################################################
-## Intent: Return directory path for a given argument
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-## Todo:
-##   o Check if function can be replaced by File::Basename::dirname()
-###########################################################################
-sub dirname_legacy
-{
-    my $str = (@_ && defined($_[0])) ? shift : '';
-    return $str =~ /(.*)\/.*/ ? "$1" : '.';
-}
-
-###########################################################################
-## Intent: Given a list of makefile paths recursively create all
-##         directories between file and the root
-## -----------------------------------------------------------------------
-## Args:
-##   array   A list of makefiles
-##   fargs   Function arguments
-##     mode  Filesystem mode used for directory creation
-## Returns:
-##   $@      Set on error
-##   0       on success
-## -----------------------------------------------------------------------
-## Note:
-##   Reporting directory creation can be enabled by the --verbose
-##   command line argument.
-###########################################################################
-sub mkdirr
-{
-    my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
-    my $mode = $fargs{mode} || 0755;
-    my $verbose = $main::argv{verbose} || 0;
-    $@ = '' unless ($fargs{recursive});
-    $fargs{recursive} = 1;
-
-    my @errors;
-    push(@errors, $@) if ($@);
-    foreach my $path (@_)
-    {
-        (my $dir = $path) =~ s%/?Makefile[^/]*$%%o;
-        next unless (length($dir));
-        next if (-e $dir);
-        mkdirr( dirname($dir), \%fargs);
-        eval{ File::Path::mkpath($dir, $verbose, 0755); };
-        push(@errors, $@) if ($@);
-    }
-    $@ = join("\n", @errors);
-    return $@ ? 0 : 1;
-} # mkdirr
-
-###########################################################################
-## Intent: Read in configure values and return a hash of key/value pairs
-## -----------------------------------------------------------------------
-## Args:
-##   fargs  Function arguments
-##     reset   clear value storage and repopulate
-## Returns:
-##   hash  configure data to use for makefile substitutions
-## -----------------------------------------------------------------------
-## Todo: wrapper for reading config* and run_config_status
-###########################################################################
-my %_CONFIG_; # todo: state %config; w/5.10
-sub getConfig
-{
-    my %fargs = (@_ && ref($_[$#_]) eq 'HASH') ? %{ (pop) } : ();
-    if ($fargs{reset})
-    {
-        %_CONFIG_ = ();
-        shift;
-    }
-
-    #my $ac_file_in    = "$ac_given_srcdir/${ac_file}.in";
-    #my $ac_dir        = dirname_legacy($ac_file);
-    #my $ac_dots       = '';
-    #my $ac_dir_suffix = '';
-    #my $srcdir        = '.';
-    #my $top_srcdir    = '.';
-    unless (%_CONFIG_)
-    {
-        while (@_)
-        {
-            my ($k, $v) = splice(@_, 0, 2);
-            $_CONFIG_{$k} = $v;
-        }
-    }
-
-    return %_CONFIG_;
-} # getConfig
-
-###########################################################################
-## Intent: Determine path depth between leaf and root directory.
-##   o DEPTH= may be set by makefile content
-##   o DEPTH= may be set by Makefile in a parent
-##   o Manually determine by relpath form leaf to sandbox top
-## -----------------------------------------------------------------------
-## Args:
-##   scalar  Path to makefile or directory to determine DEPTH for
-## Returns:
-##   scalar  Relative path from leaf to root directory
-## -----------------------------------------------------------------------
-###########################################################################
-sub getDepth($)
-{
-    my $fyl = shift || '';
-
-    my @path = split(m%/%o, $fyl);
-    pop(@path) if ('Makefile' eq substr($path[$#path], 0, 8));
-    my $depth;
-    my @depth;
-
-    my $top = getTopDir();
-    my @top = split(m%/%o, $top);
-    my @pathNoTop = @path;
-    splice(@pathNoTop, 0, scalar(@top));
-
-    SEARCH:
-    while (@path)
-    {
-        ## Search for a file containing DEPTH=../..
-        foreach my $fyl ( qw{Makefile.in Makefile} )
-        {
-            my $path = join('/', @path, $fyl);
-            local *FYL;
-            if (!open(FYL, $path)) {} # NOP
-            elsif (my @tmp = map{ /^\s*DEPTH\s*=\s*([\.\/]+)/o ? $1 : () } <FYL>)
-            {
-                $depth = join('/', @depth, shift @tmp);
-                last SEARCH;
-            }
-            close(FYL);
-        }
-        pop @path;
-        pop @pathNoTop;
-
-        if (0 == scalar(@pathNoTop))
-        {
-            $depth = join('/', @depth);
-            last;
-        }
-        
-        ## Construct path manually
-        push(@depth, '..');
-    }
-    return $depth;
-} # getDepth
-
-###########################################################################
-## Intent: Read in the exclusion file
-###########################################################################
-sub getExclusions
-{
-    my $file = shift || '';
-    
-    return () if ($main::argv{'no-exclusions'});
-
-    my %exclude;
-    if ($file)
-    {
-        my @data = cat($file);
-        foreach (@data)
-        {
-            next unless ($_);
-            next if (/^\s*\#/o);
-            next unless (m%/%);
-            chomp;
-            $exclude{$_}++;
-        }
-    }
-    return %exclude;
-} # getExclusions
-
-###########################################################################
-## Intent: Given the path to a makefile beneath either src or obj
-##         derive the relative path prefix between makefile and root.
-###########################################################################
-sub getRelPath
-{
-    my $path0 =  shift;
-    my $abspath;
-
-    # Determine type and orientation
-    my $name = basename($path0);
-    my $haveMF = ($name eq 'Makefile.in') ? 1
-        : ($name eq 'Makefile') ? -1
-        : 0
-        ;
-
-    ####################################################
-    ## Prep work: form a relative path with ../ removed
-    ####################################################
-    my $top = getTopDir();
-    my $obj = getObjDir();
-    ## If the same Makefile will be created alongside Makefile.in
-    my $topQM = quotemeta($top);
-    my $objQM = quotemeta($obj);
-
-    if ('..' eq substr($path0, 0, 2))
-    {
-        my @cwd = split(m%/%, $cwd);
-        my @pth = split(m%/%, $path0);
-        while (@pth && $pth[0] eq '..')
-        {
-            pop(@cwd);
-            shift @pth;
-        }
-        $path0 = join('/', @cwd, @pth);
-        $abspath = $path0;
-    }
-
-    if ('/' eq substr($path0, 0, 1))
-    {
-        $path0 =~ s%^$objQM\/?%%;
-        $path0 =~ s%^$topQM\/?%%;
-    }
-
-    #######################################################################
-    ## Build a list of directories to search.  Input source will be one
-    ## of path to Makefile.in, path to Makefile, directory, file within
-    ## a directory or relative path from cwd.
-    #######################################################################
-    my @subdirs;
-    my $path = (0 == $haveMF) ? $path0 : dirname($path0);
-    push(@subdirs, $path); # containing directory
-    push(@subdirs, dirname($path)) if (0 == $haveMF && -f $path); # Arg is file within a directory
-    push(@subdirs, $cwd);  # relative to pwd
-
-    # obj - path to generated makefile
-    # top - path to Makefile.in source template
-    my @prefixes = ('/' ne substr($path0, 0, 1))
-        ? (&getTopDir, &getObjDir)
-        : ()
-        ;
-
-  ON_SAFARI:
-    for my $prefix (@prefixes)
-    {
-        next unless ($prefix); # no command line not passed
-        foreach my $subdir (@subdirs)
-        {
-            foreach my $mf ('Makefile.in', 'Makefile')
-            {
-                my $path = join('/', $prefix, $subdir, $mf);
-                if (-e $path)
-                {
-                    $name = $mf;
-                    $haveMF = ($mf eq 'Makefile.in') ? 1 : -1;
-                    $abspath = $path;
-                    last ON_SAFARI;
-                }
-            }
-        }
-    }
-
-    #######################################################################
-    ## Generated makefile does not yet exist or path is invalid.
-    ## Should this conditon be handled to detect non-existent Makefile.in:
-    ##   Makefile.am => Makefile.in => Makefile but Makefile.in
-    #######################################################################
-    if (!$abspath && -1 == $haveMF && $obj)
-    {
-        $abspath = ('/' eq substr($path0, 0, 1)) 
-            ? $path0
-            : join('/', $obj, $path0)
-            ;
-    }
-
-    ########################################################
-    ## If --top and/or --obj specified extract relative path
-    ########################################################
-    my $relpath;
-    if (! $abspath)
-    {
-        # Error, fall through
-    }
-    elsif (1 == $haveMF) # Makefile.in
-    {
-        ## err w/o --top
-        (my $tmp = $abspath) =~ s%^$topQM/?%%;
-        $relpath = dirname($tmp) unless ($tmp eq $abspath);
-    }
-    elsif (-1 == $haveMF) # Makefile
-    {
-        ## err w/o --obj
-        (my $tmp = $abspath) =~ s%^$objQM/?%%;
-        $relpath = dirname($tmp) unless ($tmp eq $abspath);
-    }
-
-    $relpath ||= '';
-    $relpath =~ s%/./%/%og; # filter ./
-
-    $@ = ($relpath) ? '' : "ERROR($path0): Unable to locate sources";
-    return $relpath || '';
-} # getRelPath
-
-###########################################################################
-## Intent: Determine sandbox root from script startup directory
-## -----------------------------------------------------------------------
-## Args:
-##    _set_    optional, if passed use the given value as path
-##    _reset_  clear cached directory path to reassign
-## Returns:
-##   scalar - absolute path to the sandbox root directory
-## -----------------------------------------------------------------------
-###########################################################################
-my $gtd_dir;
-sub getTopDir
-{
-    if (@_) # testing override
-    {
-        $gtd_dir = abs_path($_[1] || '.') if ($_[0] eq '_set_');
-        $gtd_dir = ''    if ($_[0] eq '_reset_');
-    }
-
-    unless ($gtd_dir)
-    {
-        ## Set by command line
-        if ($main::argv{top})
-        {
-            $gtd_dir = $main::argv{top};
-        }
-        else
-        {
-            my $path = abs_path($FindBin::RealBin);
-            my @path = split(m%/%o, $path);
-            ## --2 memory/mozalloc/Makefile.in
-            ## --3 was this for FindBin::Script ?
-            splice(@path, -2);
-            $gtd_dir = join('/', @path);
-        }
-    }
-    return $gtd_dir;
-} # getTopDir
-
-###########################################################################
-## Intent: Determine path to MOZ_OBJDIR/object directory
-## -----------------------------------------------------------------------
-## Args:
-##   _set_    optional testing arg, if passed re-compute cached value
-## Returns:
-##   scalar - absolute path to the sandbox object directory
-## -----------------------------------------------------------------------
-###########################################################################
-my $god_dir;
-sub getObjDir
-{
-    if (@_) # testing override
-    {
-        if ($_[0] eq '_reset_')
-        {
-            $god_dir = '';
-            shift;
-        }
-        elsif ($_[0] eq '_set_')
-        {
-            shift;
-            my $path = $_[0] || '.';
-            $god_dir = abs_path($path);
-            shift;
-        }
-    }
-
-    ## extract $obj from given path
-    unless ($god_dir)
-    {
-        if ($main::argv{obj})
-        {
-            $god_dir = $main::argv{obj};
-        }
-        elsif (@_ && 'Makefile' eq substr($_, -8))
-        {
-            $god_dir = abs_path(shift);
-        }
-        else # assume we are sitting in moz_objdir
-        {
-            $god_dir = abs_path('.');
-        }
-    }
-
-    return $god_dir;
-} # getObjDir
-
-###########################################################################
-## Intent: Generate Makefile from a given Makefile.in template
-## -----------------------------------------------------------------------
-## Args:
-##   scalar  Relative path to a directory containing a makefile
-##   fargs   Hash ref of function arguments.
-##     obj     Absolute path to MOZ_OBJ/a destination directory
-##     top     Absolute path to the sandbox root
-## Returns:
-##    $@     Set on error
-##    scalar
-##      1     True if the makefile was updated
-##      0     Otherwise
-##      badtokens - If the makefile contains unexpandable @token@ strings
-## -----------------------------------------------------------------------
-###########################################################################
-sub updateMakefiles
-{
-    my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
-    local $_;
-    $@ = '';
-
-    my $top = $fargs{top};
-    my $obj = $fargs{obj};
-
-    my $relpath = shift || '';
-    my $src = join('/',  $top, $relpath, 'Makefile.in');
-    my $depth = getDepth($src);
-
-    my @src = cat($src);
-    return 0 if ($@);
-
-    my $dst = join('/', $obj, $relpath, 'Makefile');
-    my @dst = cat($dst);
-    $@ = '';
-
-    my $dstD = dirname($dst);
-    mkdirr($dstD);
-    return 0 if ($@);
-
-    my %data =
-        ( getConfig(),
-          depth      => $depth,
-          srcdir     => join('/', $top, $relpath),
-          top_srcdir => $top,
-        );
-
-    my $line = 0;
-    my @data;
-    while (scalar @src)
-    {
-        $line++;
-        $_ = shift(@src);
-
-        ## Expand embedded @foo@
-        while (/\@[^\@\s\$]+\@/go)
-        {
-            my $end = pos($_);
-            my $val = $&;
-            my $len = length($val);
-            $val =~ s/^\@\s*//o;
-            $val =~ s/\s*\@$//o;
-
-            ## Identify expansions to see if we can avoid shell overhead
-            if (!defined $data{$val} && !$argv{'no-badtokens'})
-            {
-                if (1) # warnings
-                {
-                    print STDERR "WARNING: token $val not defined\n";
-                    print STDERR "   line $line, src: $src\n";
-                }
-                return 'badtokens';
-            }
-
-            # Insert $(error txt) makefile macros for invalid tokens
-            my $val1 = defined($data{$val})
-                ? $data{$val}
-                : "\$(error $FindBin::Script: variable ${val} is undefined)"
-                ;
-            substr($_, ($end-$len), $len, $val1);
-        }
-        push(@data, $_);
-    }
-
-    if (("@data" eq "@dst") && scalar(@data))
-    {
-        print "Skipping up2date makefile: $dst\n" if ($argv{verbose});
-    }
-    else
-    {
-        my $action = (scalar @dst) ? 'Updating' : 'Creating';
-        print "$action makefile: $dst\n";
-
-        my $tmp = join('.', $dst, "tmp_$$");
-        if (!open(FYL, "> $tmp"))
-        {
-            $@ = "open($tmp) failed: $!";
-        }
-        else
-        {
-            print FYL @data;
-            close(FYL);
-
-            ## Install the new makefile
-            File::Copy::move($tmp, $dst)
-                || ($@ = "move($tmp, $dst) failed: $!");
-        }
-    }
-
-    return $@ ? 0 : 1;
-} # updateMakefiles
-
-# Output the makefiles.
-#
-sub update_makefiles_legacy {
-  my ($ac_given_srcdir, $pac_given_srcdir, @makefiles) = @_;
-  my $debug = $main::argv{debug} || 0;
-  my $pwdcmd = ($^O eq 'msys') ? 'pwd -W' : 'pwd';
-  my @unhandled=();
-
-  my @warn;
-
-  my $ac_file;
-  foreach $ac_file (@makefiles) {
-    my $ac_file_in    = "$ac_given_srcdir/${ac_file}.in";
-    my $ac_dir        = dirname_legacy($ac_file);
-    my $ac_dots       = '';
-    my $ac_dir_suffix = '';
-    my $srcdir        = '.';
-    my $top_srcdir    = '.';
-
-    # Determine $srcdir and $top_srcdir
-    #
-    if ($ac_dir ne '.') {
-      $ac_dir_suffix = "/$ac_dir";
-      $ac_dir_suffix =~ s%^/\./%/%;
-      $ac_dots = $ac_dir_suffix;
-      # Remove .. components from the provided dir suffix, and
-      # also the forward path components they were reversing.
-      my $backtracks = $ac_dots =~ s%\.\.(/|$)%%g;
-      while ($backtracks--) {
-        $ac_dots =~ s%/[^/]*%%;
-      }
-      $ac_dots =~ s%/[^/]*%../%g;
-    }
-    if ($ac_given_srcdir eq '.') {
-      if ($ac_dots ne '') {
-        $top_srcdir = $ac_dots;
-        $top_srcdir =~ s%/$%%;
-      }
-    } elsif ($pac_given_srcdir =~ m%^/% or $pac_given_srcdir =~ m%^.:/%) {
-      $srcdir     = "$pac_given_srcdir$ac_dir_suffix";
-      $top_srcdir = "$pac_given_srcdir";
-    } else {
-      if ($debug) {
-              print "ac_dots       = $ac_dots\n";
-        print "ac_dir_suffix = $ac_dir_suffix\n";
-      }
-      $srcdir     = "$ac_dots$ac_given_srcdir$ac_dir_suffix";
-      $top_srcdir = "$ac_dots$ac_given_srcdir";
-    }
-
-    if ($debug) {
-      print "ac_dir     = $ac_dir\n";
-      print "ac_file    = $ac_file\n";
-      print "ac_file_in = $ac_file_in\n";
-      print "srcdir     = $srcdir\n";
-      print "top_srcdir = $top_srcdir\n";
-      print "cwd        = " . `$pwdcmd` . "\n";
-    }
-
-    # Copy the file and make substitutions.
-    #    @srcdir@     -> value of $srcdir
-    #    @top_srcdir@ -> value of $top_srcdir
-    #
-    if (-e $ac_file) {
-      next if -M _ < -M $ac_file_in;  # Next if Makefile is up-to-date.
-      warn "updating $ac_file\n";
-    } else {
-      warn "creating $ac_file\n";
-    }
-
-    mkdirr(dirname($ac_file));
-
-    open INFILE, "<$ac_file_in" or do {
-      warn "$0: Cannot read $ac_file_in: No such file or directory\n";
-      next;
-    };
-    open OUTFILE, ">$ac_file" or do {
-      warn "$0: Unable to create $ac_file\n";
-      next;
-    };
-
-    while (<INFILE>) {
-      s/\@srcdir\@/$srcdir/g;
-      s/\@top_srcdir\@/$top_srcdir/g;
-
-      if (/\@[_a-zA-Z]*\@/) {
-        #warn "Unknown variable:$ac_file:$.:$_";
-        push @unhandled, $ac_file;
-        last;
-      }
-      print OUTFILE;
-    }
-    close INFILE;
-    close OUTFILE;
-  }
-  return @unhandled;
-} # update_makefiles_legacy
-
-###########################################################################
-## Intent: Invoke config.status for unknown makefiles to create
-##         directory hierarchy for the tree.
-## -----------------------------------------------------------------------
-## Args:
-##   array   an optional list of makefiles to process
-## Returns:
-##   0    on success
-##   $#   set on error
-## -----------------------------------------------------------------------
-## Note: Is this function needed anymore ?  Undefined tokens should fail
-##   at time of expansion rather than having to source config.status.
-##   Also config.status could be parsed to define values and avoide the
-##   shell overhead altogether.
-###########################################################################
-sub run_config_status {
-  my @unhandled = @_;
-
-  # Run config.status with any unhandled files.
-  #
-  my @errors;
-  if (@unhandled) {
-    local $ENV{CONFIG_FILES}= join ' ', @unhandled;
-
-    my $conf = 'config.status';
-    if (! -e $conf) # legacy behavior, warn rather than err
-    {
-        my $cwd = cwd();
-        my $err = "$FindBin::Script ERROR: Config file $conf does not exist, cwd=$cwd";
-        push(@errors, $err);
-    }
-    elsif (0 != system("./config.status"))
-    {
-        my $cwd = cwd();
-        push(@errors, "config.status failed \$?=$?, \$!=$!, cwd: $cwd");
-    }
-  }
-  $@ = join("\n", @errors);
-
-  ## Legacy behavior: config.status problems are not fatal {yet}.
-  ## Display warning since caller will not be calling die.
-  warn $@ if ($@ && $argv{'no-warnings'});
-  return $@ ? 1 : 0;
-}
-
-1;
deleted file mode 100644
--- a/build/autoconf/test/Makefile.in
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- 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/.
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-
-##################################################
-## Gather a list of tests, generate timestamp deps
-##################################################
-TS=.ts
-ifneq (,$(findstring check,$(MAKECMDGOALS)))
-          allsrc = $(wildcard $(srcdir)/*)
-       tests2run = $(notdir $(filter %.tpl,$(allsrc)))
-       tests2run += $(notdir $(filter %.tpm,$(allsrc)))
-  check_targets += $(addprefix $(TS)/,$(tests2run))
-endif
-
-all_nop: # export, libs and tools are not needed
-
-check:: $(TS) $(check_targets)
-
-#############################################
-# Only invoke tests when sources have changed
-#############################################
-$(TS)/%: $(srcdir)/%
-	$(PERL) $(srcdir)/runtest $<
-	@touch $@
-
-parent = $(patsubst %/,%,$(dir $(srcdir)))
-$(TS)/make-makefile.tpl: \
-  $(srcdir)/make-makefile.tpl\
-  $(parent)/makemakefile.pm\
-  $(NULL)
-	$(PERL) $(srcdir)/runtest $<
-	@touch $@
-
-$(TS)/makemakefile.tpm: \
-  $(srcdir)/makemakefile.tpm \
-  $(parent)/makemakefile.pm \
-  $(NULL)
-	$(PERL) $(srcdir)/runtest $<
-	@touch $@
-
-#####################################################
-## Extra dep needed to synchronize parallel execution
-#####################################################
-$(TS): $(TS)/.done
-$(TS)/.done:
-	$(MKDIR) -p $(dir $@)
-	touch $@
-
-GARBAGE_DIRS += $(TS)
-
-# EOF
deleted file mode 100644
--- a/build/autoconf/test/data/mf.notokens
+++ /dev/null
@@ -1,4 +0,0 @@
-jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
-        @$(RM) $@ jsautocfg.tmp
-        ./jscpucfg > jsautocfg.tmp
-        mv jsautocfg.tmp $@
deleted file mode 100644
--- a/build/autoconf/test/data/mf.notokens.exp
+++ /dev/null
@@ -1,4 +0,0 @@
-jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
-        @$(RM) $@ jsautocfg.tmp
-        ./jscpucfg > jsautocfg.tmp
-        mv jsautocfg.tmp $@
deleted file mode 100644
--- a/build/autoconf/test/make-makefile.excl
+++ /dev/null
@@ -1,8 +0,0 @@
-###########################################################################
-## Intent: Exclusion list for container make builds
-###########################################################################
-
-/dev/null
-/foo/bar
-/a/b/c
-/a/b/d
deleted file mode 100644
--- a/build/autoconf/test/make-makefile.tpl
+++ /dev/null
@@ -1,436 +0,0 @@
-#!/usr/bin/env perl
-###########################################################################
-## Intent: Unit test to verify make-makefile.tpl
-###########################################################################
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-#use feature 'state';  # 5.10+ not installed everywhere
-use Getopt::Long;
-
-use Cwd;
-use Cwd         qw{abs_path};
-use File::Basename;
-use File::Copy;
-use File::Path;
-use File::Temp  qw{ tempdir };
-
-use Test;
-sub BEGIN { plan tests => 4 };
-my @workdirs;
-sub END { system("/bin/rm -fr @workdirs"); }  # cleanup behind interrupts
-
-##-------------------##
-##---]  EXPORTS  [---##
-##-------------------##
-use FindBin;
-our $VERSION = qw(1.0);
-
-##------------------##
-##---] INCLUDES [---##
-##------------------##
-use FindBin;
-use lib "$FindBin::RealBin/..";
-use makemakefile;
-
-##-------------------##
-##---]  GLOBALS  [---##
-##-------------------##
-my %argv;
-
-###########################################################################
-## Intent: Create a temp sandbox populated with sources
-## -----------------------------------------------------------------------
-## Args:
-##   array    a list of file paths to copy
-## Returns:
-##     $@     set on error
-##   scalar   path to scratch sandbox
-## -----------------------------------------------------------------------
-###########################################################################
-my $root; # state $root not available
-sub createSandbox
-{
-    my @errors;
-
-    unless ($root)
-    {
-        my @tmp = split(m%/%, $FindBin::RealBin);
-        splice(@tmp, -3);
-        $root = join('/', @tmp);
-    }
-
-    my $work = tempdir();
-    push(@workdirs, $work);
-    my @dirs = map{ join('/', $work, dirname($_)) } @_;
-    mkdirr(@dirs);
-    push(@errors, "createSandbox: $@") if ($@);
-
-    foreach (@_)
-    {
-        ## Copy sources into the temp source directory
-        my $src = join('/', $root, $_);
-        my $dst = join('/', $work, $_);
-        unless (copy($src, $dst))
-        {
-            push(@errors, "copy($src, $dst) failed: $!");
-        }
-    }
-    print STDERR "createSandbox: $work\n" if ($main::argv{debug});
-    $@ = join('', map{ "$_\n" } @errors);
-    $work;
-} # createSandbox
-
-###########################################################################
-## Intent: wrapper to run the make-makefile command.
-## -----------------------------------------------------------------------
-## Args:
-##   array  command line arguments passed to make-makefile
-## Returns:
-##    array  command output
-##    $@     set by shell exit status, empty string on success
-##    $?     command shell exit status
-###########################################################################
-my $mm; # state $mm not available
-sub makemakefile
-{
-    my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
-    $mm ||= join('/', dirname($FindBin::Bin), 'make-makefile'); # cmd in parent of test/
-    my $cmd = join(' ', $mm, @_);
-    print "RUNNING: $cmd\n" if ($fargs{debug});
-    my @out = `$cmd 2>&1`;
-    print STDERR map{ "out> $_" } @out if ($argv{verbose});
-    $@ = (0 == $?) ? '' : "Command failed: $cmd\n@out";
-    @out;
-} # makemakefile
-
-###########################################################################
-## Intent: Helper function, display the contents of a given sandbox
-## -----------------------------------------------------------------------
-## Args:
-##   scalar   Path to sandbox
-## Returns:
-##   none
-## -----------------------------------------------------------------------
-###########################################################################
-sub find_ls
-{
-    my $path = shift || '';
-
-    # Assuming dot contributes to cryptic problems
-    die "find_ls: a path is required" unless ($path);
-
-    my $cmd = "find $path -ls";
-    print "\nRunning: $cmd\n";
-    print '=' x 75, "\n";
-    print `$cmd`;
-} # myls
-
-###########################################################################
-## Intent: Verify make-makefile is able to digest paths and generate
-##         makefiles when object directory is a child of top.
-###########################################################################
-sub check_makemakefile
-{
-    my $work = createSandbox
-        (
-         'memory/mozalloc/Makefile.in',
-         'toolkit/system/windowsproxy/Makefile.in',
-         'toolkit/crashreporter/google-breakpad/src/client/Makefile.in',
-        );
-
-
-    my $workdir = createSandbox();
-    my $top = $workdir;
-    chdir $top;
-
-    my $objA = 'obj-arch-dir';
-    my $obj = join('/', $top, $objA);
-
-    # getTopDir()
-    local $main::argv{top} = $work;
-    local $main::argv{obj} = $obj;
-    getObjDir('_reset_');
-
-    my @root = split(m%/%, $FindBin::RealBin);
-    splice(@root, -3);
-    my $root = join('/', @root);
-    my @args =
-        (
-
-         [
-          banner => "--top and --obj are impled, generate Makefile",
-             rel => 'memory/mozalloc',
-             cmd => join(' ',
-                         '--top', $top,
-                         '--obj', $obj,
-                         'memory/mozalloc/Makefile',
-                         ),
-         ],
-
-         [
-          banner => "--top and abs(obj) passed",
-             rel => "toolkit/system/windowsproxy",
-             cmd => join(' ',
-                         '--top', $top,
-                         "$obj/toolkit/system/windowsproxy/Makefile",
-                         ),
-             exp => "$obj/toolkit/system/windowsproxy/Makefile",
-            skip => 1, #
-         ],
-
-
-         [
-          banner => "--obj and abs(top) passed",
-             rel => "toolkit/crashreporter/google-breakpad/src/client",
-             cmd => join(' ',
-                         '--obj', $obj,
-                         "$top/toolkit/crashreporter/google-breakpad/src/client/Makefile.in",
-                         ),
-             exp => "$top/toolkit/crashreporter/google-breakpad/src/client/Makefile.in",
-          skip => 1, #
-         ],
-
-         );
-
-    foreach (@args)
-    {
-        my %rec = @{ $_ };
-        next if ($rec{skip});
-        next unless ($rec{rel});
-
-        my $srcR = join('/', $top, $rec{rel});
-        my $dstR = join('/', $obj, $rec{rel});
-
-        my $src = join('/', $top, $rec{rel}, 'Makefile.in');
-        my $dst = join('/', $obj, $rec{rel}, 'Makefile');
-
-        # Use distinct sources to avoid cleanup overhead between tests
-        die "Test source already used: $dstR" if (-d $dstR);
-
-        ## Copy sources into the temp source directory
-        my $rootR = join('/', $root, $rec{rel});
-        my $rootS = join('/', $root, $rec{rel}, 'Makefile.in');
-        File::Path::mkpath($srcR, 0, 0700);
-        copy($rootS, $src) or die "copy($rootS, $src) failed: $!";
-
-        die "source does not exist: $src" unless (-e $src);
-
-        ######################
-        ## Generate and verify
-        ######################
-        print STDERR "RUNNING: $rec{banner}\n" if ($argv{debug});
-        my @errs;
-        makemakefile('--enhanced', $rec{cmd}, {verbose=>1});
-        if ($@)
-        {
-            push(@errs, "\$@ should not be set: $@\n");
-        }
-        elsif (! -e $dst)
-        {
-            push(@errs, "Generated makefile does not exist: $dst, banner: $rec{banner}\n");
-        }
-
-        ok(scalar(@errs), 0, "Errors detected:\n" . join("    $_", @errs));
-        find_ls($top) if (@errs);
-    }
-
-} # check_makemakefile
-
-###########################################################################
-## Intent: Verify make-makefile is able to digest paths and generate
-##         makefiles when top/MOZ_OBJDIR are not parent/child directories
-## ---------------------------------------------------------------------------
-## Args:
-##   none
-## Returns:
-##   none
-## ---------------------------------------------------------------------------
-###########################################################################
-sub check_makemakefile_distinct
-{
-    my $workdir = createSandbox();
-#    my $workdir = tempdir();
-
-    ###############################################
-    ## Now update when top/obj are not parent/child
-    ###############################################
-    my $top = join('/', $workdir, 'top');
-    my $obj = join('/', $workdir, 'obj');
-
-    $main::argv{top} = $top;
-    $main::argv{obj} = $obj;  # test afterward, using undef ?
-
-    my @sbxroot = split(m%/%, $FindBin::RealBin);
-    splice(@sbxroot, -2);
-    my $sbxroot = join('/', @sbxroot);
-
-    ## Copy in a makefile template to to convert
-    File::Path::mkpath(["$top/memory/mozalloc"], 0, 0700);
-    copy("$sbxroot/memory/mozalloc/Makefile.in", "$top/memory/mozalloc/Makefile.in");
-
-
-    # work/memory/mozalloc/Makefile.in
-
-    my @args =
-        (
-         [
-          banner => '--top and --obj are distinct [1]',
-             cmd => "--obj $obj memory/mozalloc/Makefile",
-             exp => "$obj/memory/mozalloc/Makefile",
-         ],
-
-         [
-          banner => "--top and --obj are distinct [2]",
-             cmd => "--top $top memory/mozalloc/Makefile.in",
-             exp => "$obj/memory/mozalloc/Makefile",
-            skip => 1,  # test problem: top != obj
-         ],
-
-         [
-          banner => "--top and --obj are distinct [3]",
-             cmd => join(' ',
-                         "--top $top",
-                         "--obj $obj",
-                         "memory/mozalloc/Makefile.in",
-                         ),
-             exp => "$obj/memory/mozalloc/Makefile",
-            skip => 1,  # test problem: top != obj
-         ],
-        );
-
-
-    foreach (@args)
-    {
-        my %rec = @{ $_ };
-        print STDERR "banner: $rec{banner}\n" if ($argv{debug});
-        next if $rec{skip};
-
-        unlink $rec{exp};
-        makemakefile('--enhanced', $rec{cmd});
-
-        my @errs;
-        if ($@)
-        {
-            push(@errs, "\$@ should not be set: $@\n");
-        }
-        elsif (! -e $rec{exp})
-        {
-            push(@errs, "Makefile does not exist: $rec{exp}\n");
-        }
-        ok(scalar(@errs), 0, "Errors detected:\n" . join("    $_", @errs));
-    }
-
-} # check_makemakefile_distinct
-
-###########################################################################
-## Intent: Verify legacy behavior, invoke make-makefile when cwd is
-##         a subdirectory beneath MOZ_OBJDIR.
-## -----------------------------------------------------------------------
-## Args:
-##   none
-## Returns:
-##   none
-## -----------------------------------------------------------------------
-###########################################################################
-sub check_makemakefile_legacy
-{
-    my $work = createSandbox
-        (
-         'memory/mozalloc/Makefile.in',
-         'parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile.in',
-        );
-
-    my $obj = join('/', $work, 'obj');
-    mkdir $obj;
-
-    my @args =
-        (
-         {
-             banner => '-t path -d dot',
-                cwd => $obj,
-                cmd => "-t $work -d . memory/mozalloc/Makefile",
-                exp => "$obj/memory/mozalloc/Makefile",
-               skip => 0,
-         },
-         
-         {
-             banner => '-t path -d relpath',
-                cwd => join('/', $obj, 'parser/htmlparser/tests/mochitest'),
-                cmd => "-t $work -d ../../../.. html5lib_tree_construction/Makefile",
-                exp => "$obj/parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile",
-               skip => 0,
-         },
-        );
-
-    foreach (@args)
-    {
-        my %rec = %{ $_ };
-        next if ($rec{skip});
-
-        ## make-make while sitting in $objdir
-        mkdirr($rec{cwd});
-        chdir $rec{cwd} || die "chdir $rec{cwd} failed; $!";
-
-        makemakefile($rec{cmd});
-        my @errs;
-        if ($@)
-        {
-            push(@errs, "make-makefile $rec{cmd} failed: $@");
-        }
-        elsif (! -e $rec{exp})
-        {
-            push(@errs, "generated makefile does not exist: $rec{exp}");
-        }
-        ok(scalar(@errs), 0, "Errors detected: @errs");
-        find_ls($work) if (@errs);
-    }
-    chdir $FindBin::RealBin;
-} # check_makemakefile_legacy
-
-###########################################################################
-## Intent: Smoke tests for the unittests module
-###########################################################################
-sub smoke
-{
-    print STDERR "Running test: smoke()\n" if ($argv{debug});
-} # smoke()
-
-###########################################################################
-## Intent: Intitialize global test objects and consts
-###########################################################################
-sub init
-{
-    print "Running: init()\n" if ($argv{debug});
-#    testplan(24, 0);
-} # init()
-
-##----------------##
-##---]  MAIN  [---##
-##----------------##
-unless(GetOptions(\%argv,
-                  qw(
-                     debug|d
-                     manual
-                     test=s@
-                     verbose
-                     )))
-{
-    print "USAGE: $0\n";
-    print "  --debug    Enable script debug mode\n";
-    print "  --manual   Also run disabled tests\n";
-    print "  --smoke    Run smoke tests then exit\n";
-    print "  --test     Run a list of tests by function name\n";
-    print "  --verbose  Enable script verbose mode\n";
-    exit 1;
-}
-
-init();
-smoke();
-
-check_makemakefile();
-check_makemakefile_distinct();
-check_makemakefile_legacy();
deleted file mode 100644
--- a/build/autoconf/test/makemakefile.tpm
+++ /dev/null
@@ -1,519 +0,0 @@
-#!/usr/bin/env perl
-###########################################################################
-## Intent: Unit test to verify the makemakefile.pm module
-###########################################################################
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-#use feature 'state';
-use Getopt::Long;
-
-use FindBin;
-use Cwd         qw{abs_path};
-use File::Basename;
-use File::Compare;
-use File::Copy;
-use File::Temp  qw{tempdir};
-
-use Test;
-sub BEGIN { plan tests => 36 };
-my @workdirs;
-sub END { system("/bin/rm -fr @workdirs"); }  # cleanup behind interrupts
-
-##-------------------##
-##---]  EXPORTS  [---##
-##-------------------##
-our $VERSION = qw(1.0);
-
-##------------------##
-##---] INCLUDES [---##
-##------------------##
-use FindBin;
-use lib "$FindBin::RealBin/..";
-use makemakefile;
-
-##-------------------##
-##---]  GLOBALS  [---##
-##-------------------##
-my %argv;
-
-###########################################################################
-## Intent: Create a temp sandbox populated with sources
-## -----------------------------------------------------------------------
-## Args:
-##   array    files to copy into the temporary sandbox
-## Returns:
-##     $@     set on error
-##   array 
-##     top  - path to temp sandbox root
-##     obj  - path to temp sandbox moz_obj directory
-## -----------------------------------------------------------------------
-###########################################################################
-my $_root_; # state $root
-sub createSandbox
-{
-#    state $root;
-    my @errors;
-
-    unless ($_root_)
-    {
-        my @tmp = split(m%/%, $FindBin::RealBin);
-        splice(@tmp, -3);
-        $_root_ = join('/', @tmp);
-    }
-
-    my $work = tempdir(CLEANUP=>1);
-    push(@workdirs, $work);
-    my @dirs = map{ join('/', $work, dirname($_)) } @_;
-    mkdirr(@dirs);
-    push(@errors, "createSandbox: $@") if ($@);
-
-    foreach (@_)
-    {
-        ## Copy sources into the temp source directory
-        my $src = join('/', $_root_, $_);
-        my $dst = join('/', $work, $_);
-        unless (copy($src, $dst))
-        {
-            push(@errors, "copy($src, $dst) failed: $!");
-        }
-    }
-    print STDERR "createSandbox: $work\n" if ($main::argv{debug});
-    $@ = join('', map{ "$_\n" } @errors);
-    $work;
-} # createSandbox
-
-###########################################################################
-## Intent: Verify legacy dirname function
-###########################################################################
-sub check_dirname_legacy
-{
-    print "Running: check_dirname_legacy\n" if ($main::argv{debug});
-
-    foreach (
-        ['/dev/null', '/dev'],
-        ['/foo/bar/Makefile', '/foo/bar'],
-        )
-    {
-        my ($src, $exp) = @{ $_ };
-        my $dir = dirname_legacy($src);
-        ok($dir, $exp, "dirname_legacy($src) failed");
-    }
-
-    my $path = dirname_legacy(undef);
-    ok($path ? 1 : 0, 1, "dirname('') should expand to cwd");
-} # check_dirname_legacy
-
-###########################################################################
-## Intent: Verify topdir lookup function
-###########################################################################
-sub check_getTopDir
-{
-    print "Running: check_getTopDir\n" if ($main::argv{debug});
-
-    my $path = getTopDir();
-
-    ## Unit test is special, cmd not invoked from the same directory
-    ## as the makemakefile.pm module.
-    ok($path ? 1 : 0, 1, "getTopDir failed");
-    ok(-d $path ? 1 : 0, 1, "getTopDir: directory $path does not exist");
-    ok($FindBin::RealBin =~ m%\Q$path/% ? 1 : 0, 1, 'Invalid topdir path');
-    ok(-e "$path/client.mk" ? 1 : 0, 1, "client.mk not found in $path");
-} # check_getTopDir
-
-###########################################################################
-## Intent: Verify objdir lookup function
-###########################################################################
-sub check_getObjDir
-{
-    print "Running: check_getObjDir\n" if ($main::argv{debug});
-    local $main::argv{obj} = '/bin';
-    my $path = getObjDir('_reset_');
-    ok($path ? 1 : 0, 1, "getObjDir failed");
-    ok(-d $path ? 1 : 0, 1, "getObjDir: directory $path does not exist");
-
-    my $top = getTopDir();
-    $main::argv{obj} = join('/', $top, 'browser'); # use existing path so file can be resolved
-    my $obj = getObjDir('_reset_');
-    ok($top ne $obj ? 1 : 0, 1, "top and object directory paths should not match");
-
-    ## If we fail for /bin use here getObjDir() was not reset
-    my $client = join('/', $obj, '..', 'client.mk');
-    ok(-e $client ? 1 : 0, 1, "client.mk not found in parent of $path, $client");
-    getObjDir('_set_'); # clear cached value and recompute
-
-    foreach my $file ("$top/memory/mozalloc/Makefile")
-    {
-        my $obj = getObjDir('_reset_', $file);
-        ok($obj ne $file ? 1 : 0, 1, "getObjDir($file) failed")
-    }
-} # check_getObjDir
-
-###########################################################################
-## Intent: Verify rel-path-to-root/getdepth function
-###########################################################################
-sub check_getDepth
-{
-    my @tmp = split(m%/%o, $FindBin::Bin);
-    splice(@tmp, -3);
-    my $root = abs_path( join('/', @tmp) );
-
-    my %data =
-        (
-         $root => '.',
-         join('/', $root, 'netwerk/Makefile.in') => '..',
-
-         join('/', $root, 'browser/components/privatebrowsing/test/browser/Makefile.in') => '../../../../..',
-         join('/', $root, 'browser/components/privatebrowsing/test/browser/') => '../../../../..',
-         join('/', $root, 'browser/components/privatebrowsing/test/browser') => '../../../../..',
-         join('/', $root, 'browser/components/privatebrowsing/test') => '../../../..',
-        );
-
-    while (my($k, $v) = each %data)
-    {
-        my $depth = makemakefile::getDepth($k);
-        ok($depth, $v, "getDepth($k) failed");
-    }
-} # check_getDepth
-
-###########################################################################
-## Intent: Verify reading the exclusion file
-###########################################################################
-sub check_getExclusions
-{
-    my $cfg = join('/', $FindBin::RealBin, 'make-makefile.excl');
-    my %excl = getExclusions($cfg);
-    ok($@, '', '$@ should not be set');
-
-    my @excl = sort keys %excl;
-    ok(scalar @excl, 4, "Exclusion file is invalid: \@excl=@excl");
-} # check_getExclusions
-
-###########################################################################
-## Intent: Verify rel-path-to-root function
-## -----------------------------------------------------------------------
-## Args:
-##   none
-## Returns:
-##   none
-## -----------------------------------------------------------------------
-## Note:
-##   String test only, top and obj paths are bogus for this test
-###########################################################################
-sub check_getRelPath
-{
-    my @tmp = split(m%/%o, $FindBin::Bin);
-    splice(@tmp, -3);
-    my $root = abs_path( join('/', @tmp) );
-    my $obj0 = 'obj-arch';
-    my $obj = join('/', $root, $obj0);
-
-    local $main::argv{top} = $root;
-    local $main::argv{obj} = $obj;
-    getTopDir('_reset_');
-    getObjDir('_set_', $obj);
-
-    ## Cannot test relative paths with objdir beneath /tmp
-    ## Commented paths are needed for full test coverage
-    ## but are not currently supported by all module functions.
-    my %data =
-        (
-         # Relative - path correct for build directory but 
-         'profile/dirserviceprovider/public/Makefile.in'                   => 'profile/dirserviceprovider/public',
-
-         join('/', $root, 'profile/dirserviceprovider/public/Makefile.in') => 'profile/dirserviceprovider/public',
-
-         # File search
-         'profile/dirserviceprovider/public'                               => 'profile/dirserviceprovider/public',
-
-         # cwd + cleanup
-         # '../../../profile/dirserviceprovider/public/Makefile.in'          => 'profile/dirserviceprovider/public',
-#         "../../../${obj0}/profile/dirserviceprovider/public/Makefile.in"  => 'profile/dirserviceprovider/public',
-
-         ## Special case: This could be handled but permutations of non-existent files, non-overlapping paths
-         ## and relative paths containing partial subdirectories will compilicate the logic.  Wait until needed.
-         ## Relative path: $root + obj + subdir
-#         "${obj0}/profile/dirserviceprovider/public/Makefile"          => 'profile/dirserviceprovider/public',
-         join('/', $obj, 'profile/dirserviceprovider/public/Makefile') => 'profile/dirserviceprovider/public',
-
-         # $RealBin, -d ../../..
-         # top and obj not subdirectories of each other:  /foo/x, /bar/y
-        );
-
-    while (my($k, $v) = each %data)
-    {
-        my $dir = getRelPath($k);
-        ok($@, '', '$@ should not be set');
-        ok($dir, $v, "ERROR[$k]: exp[$v] != found=[$dir]");
-    }
-
-
-    my $top = '/tmp/foo';
-    my $tmp = '/tmp/bar';
-    local $main::argv{top} = $tmp;
-    local $main::argv{obj} = $obj;
-
-    %data =
-        (
-#         "$top/profile/dirserviceprovider/public/Makefile.in" => 'profile/dirserviceprovider/public',
-         "$obj/profile/dirserviceprovider/public/Makefile"    => 'profile/dirserviceprovider/public',
-        );
-
-    while (my($k, $v) = each %data)
-    {
-        my $dir = getRelPath($k);
-        ok($dir, $v, "ERROR[$k]: exp[$v] != found=[$dir]");
-    }
-} # check_getRelPath
-
-###########################################################################
-## Intent: Verify rel-path-to-root directory creation
-###########################################################################
-sub check_mkdirr
-{
-    if (-w '/bin') # cygwin may be writable
-    {
-        ok(1, 1, 'bogus test to maintain count');
-    } else {
-        mkdirr('/bin/invalid/Makefile');
-        ok($@ ? 1 : 0, 1, '$@ should be set');
-    }
-
-    my $work = createSandbox();
-    my @paths = map{ join('/', $work, $_, 'Makefile.in') } qw (xyz/abc foo/bar a/b/c/d/e);
-    mkdirr(@paths);
-    ok($@ ? 1 : 0, 0, '$@ should not be set');
-
-    push(@paths, '/bin');
-
-    my @errors;
-    foreach (@paths)
-    {
-        my $dir = dirname($_);
-        next if (-d $dir);
-        push(@errors, "mkdirr($dir) failed\n");
-    }
-    ok(scalar @errors, 0, "Errors detected: @errors");
-} # check_mkdirr
-
-###########################################################################
-## Intent: Verify permutations for system("config.status")
-###########################################################################
-sub check_run_config_status
-{
-    print STDERR "Running: check_run_config_status()\n"
-        if ($main::argv{debug});
-
-    my $work = createSandbox();
-    chdir $work;
-    run_config_status();
-    ok($@ ? 1 : 0, '$@ should be set, config.status does not exist');
-
-    my $cfg = join('/', $work, 'config.status');
-    local *CFG;
-    open(CFG, "> $cfg") && close(CFG);
-    run_config_status();
-    ok($@, qr/config.status failed/, '$@ should be set, config.status is not executabl');
-
-    open(CFG, "> $cfg");
-    print CFG join("\n",
-		   '#!/bin/sh',
-		   '',
-		   'true',
-		   '');
-    close(CFG);
-    chmod 0555, $cfg;
-    run_config_status();
-    ok($@, qr/config.status failed/, '$@ should not be set');
-		   
-} # check_run_config_status
-
-###########################################################################
-## Intent: Verify makefile generation by legacy make-makefile functions
-##   o make-makefile -t /x/y -d ..
-###########################################################################
-sub check_update_makefiles_legacy
-{
-    print STDERR "Running: check_update_makefiles_legacy()\n"
-        if ($main::argv{debug});
-    
-    return unless ($argv{legacy});
-    print STDERR "check_update_makefiles_legacy: not yet implemented\n";
-
-} # check_update_makefiles_legacy
-
-###########################################################################
-## Intent: Verify updateMakefiles()
-##   o a makefile is generated when none exists.
-##   o a makefile will only be updated when the templates changes.
-##   o existing makefiles will be updated when the template changes.
-##   o @foo@ tokens have been expanded
-###########################################################################
-sub check_updateMakefiles
-{
-    my @errors;
-
-    print STDERR "Running: check_updateMakefiles()\n"
-        if ($main::argv{debug});
-
-    my $mf = 'memory/mozalloc/Makefile.in';
-
-    my $work = createSandbox($mf);
-    my $obj = join('/', $work, 'obj');
-    my %args =
-        (
-         top => $work,
-         obj => $obj,
-        );
-
-    my $mf_src = join('/', $work, 'memory/mozalloc/Makefile.in');
-    my $mf_dst = join('/', $obj, 'memory/mozalloc/Makefile');
-
-    updateMakefiles('memory/mozalloc', \%args);
-    my $tlm0 = (stat $mf_dst)[9] || 0;
-    ok(-e $mf_dst ? 1 : 0, 1, "failed to generate makefile: $mf_dst");
-
-    #############################
-    ## Regeneration will be a nop
-    #############################
-    updateMakefiles('memory/mozalloc', \%args);   
-    my $tlm1 = (stat $mf_dst)[9] || -1;
-    ok($tlm1, $tlm0, "makefile should not have been modified");
-
-    #####################################################
-    ## Modify template to verify makefile will regenerate
-    #####################################################
-    local *MF;
-    if (open(MF, ">> $mf_src"))
-    {
-        print MF map{ "# MODIFIED MAKEFILE\n" } 0..4;
-        close(MF);
-    }
-    updateMakefiles('memory/mozalloc', \%args);
-    my @data = makemakefile::cat($mf_dst);
-    ## Check content to avoid a silly 'sleep [n]' call here
-    ok(grep(/^\# MODIFIED MAKEFILE/o, @data) ? 1 : 0,
-       1,
-       "template modified, makefile should have regenerated");
-
-    ## VERIFY template expansion
-    my @gen = makemakefile::cat($mf_dst);
-    push(@errors, $@) if ($@);
-
-    foreach (@gen)
-    {
-        if (/\@[^\@]+\@/o)
-        {
-            push(@errors, join("\n",
-                               "Unexpanded template string detected [$_]",
-                               "Makefile: $mf_src",
-                 ));
-            last;
-            
-        }
-    }
-
-    ok(scalar(@errors), 0, "Errors detected: @errors");
-} # check_updateMakefiles
-
-###########################################################################
-## Intent: Verify makefile generation by updateMakefiles() when
-##         command line arguments --top and --obj were passed.
-###########################################################################
-sub check_updateMakefilesByTopObj
-{
-    my @errors;
-
-    print STDERR "Running: check_updateMakefilesByTopObj()\n"
-        if ($main::argv{debug});
-
-    my $work = createSandbox();
-    my %args =
-        (
-         top => $work,
-         obj => $work,
-        );
-
-    ## Grab a list of makefile templates to generate
-    my @all = glob('data/mf.*');
-    my @src = map{ /\.exp$/o ? () : $_ } @all;
-
-    foreach my $src (@src)
-    {
-        my $dst = join('/', $work, 'Makefile');
-        unlink $dst;
-        copy($src, "$work/Makefile.in");
-        updateMakefiles('.', \%args);
-        ok($@, '', '$@ should not be set');
-
-        my @dst = makemakefile::cat($dst);
-
-        my $exp = join('.', $src, 'exp');
-        my @exp = makemakefile::cat($exp);
-        ok("@dst", "@exp", "updateMakefile($dst) failed");
-    }
-    return;
-} # check_updateMakefilesByTopObj
-
-###########################################################################
-## Intent: Smoke tests for the unittests module
-###########################################################################
-sub smoke
-{
-    print STDERR "Running test: smoke()\n" if ($argv{debug});
-} # smoke()
-
-###########################################################################
-## Intent: Intitialize global test objects and consts
-###########################################################################
-sub init
-{
-    print "Running: init()\n" if ($argv{debug});
-#    testplan(24, 0);
-
-    my @path = split(m%/%, $FindBin::RealBin);
-    splice(@path, -3);
-    my $top = join('/', @path);
-    ## Top set based on make-makefile startup directory so adjust for test/ use
-    getTopDir('_set_', $top);
-
-} # init()
-
-##----------------##
-##---]  MAIN  [---##
-##----------------##
-unless(GetOptions(\%argv,
-                  qw(
-                     debug|d
-                     manual
-                     test=s@
-                     verbose
-                     )))
-{
-    print "USAGE: $0\n";
-    print "  --debug    Enable script debug mode\n";
-    print "  --manual   Also run disabled tests\n";
-    print "  --smoke    Run smoke tests then exit\n";
-    print "  --test     Run a list of tests by function name\n";
-    print "  --verbose  Enable script verbose mode\n";
-    exit 1;
-}
-
-init();
-smoke();
-
-check_dirname_legacy();
-
-check_getTopDir();
-check_getObjDir();
-check_getDepth();
-check_getExclusions();
-check_getRelPath();
-check_mkdirr();
-
-check_updateMakefiles();
-check_update_makefiles_legacy();
-check_updateMakefilesByTopObj();
deleted file mode 100644
--- a/build/autoconf/test/runtest
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env perl
-###########################################################################
-## Intent:
-##   Test::Harness is a testing wrapper that will process output
-##   from Test.pm module tests.  Sumarize results, report stats
-##   and exit with overall status for the testing suites.
-##
-## Run testing suite:
-##   % make clean test
-##   % perl runtest
-##
-## Run Individual tests
-##   % perl tUtils0
-###########################################################################
-
-##----------------------------##
-##---] CORE/CPAN INCLUDES [---##
-##----------------------------##
-use strict;
-use warnings;
-use Getopt::Long;
-
-use Test::Harness;
-
-##-------------------##
-##---]  EXPORTS  [---##
-##-------------------##
-our $VERSION = qw(1.0);
-use FindBin;
-
-##-------------------##
-##---]  GLOBALS  [---##
-##-------------------##
-my %argv;
-
-##----------------##
-##---]  MAIN  [---##
-##----------------##
-unless(GetOptions(\%argv,
-		  qw(debug|d)
-		 ))
-{
-    print "Usage: $0\n";
-    print "  --debug  Enable debug mode\n";
-    exit 1;
-}
-
-if (2 > $Test::Harness::VERSION)
-{
-    print "Unit tests will not be run, Test::Harness is too old\n"
-	if ($argv{debug});
-    exit 0;
-}
-
-
-my @tests;
-
-########################################
-## Gather a list of tests if none passed
-########################################
-unless (@tests = @ARGV)
-{
-  local *D;
-    opendir(D, '.');
-    while($_ = readdir(D)) {
-	next unless /.t\S+$/;
-	next if (/\.ts$/);
-	push(@tests, $_);
-    }
-    closedir(D);
-}
-
-###############################################
-## Glob a list of tests when directories passed
-###############################################
-my @tmp;
-foreach (@tests)
-{
-  local *D;
-    if (-d $_ && (my $dir = $_))
-    {
-        opendir(D, $_) || die "opendir(D) failed: $!";
-	my @tests = grep(/\.t[^\.\s]+/o, readdir(D));
-	closedir(D);
-	push(@tmp, map{ join('/', $dir, $_); } @tests);
-    } else {
-        push(@tmp, $_);
-    }
-}
-@tests = @tmp;
-
-print "$0: @ARGV\n" if ($argv{debug});
-runtests(@tests);
-
-# EOF
--- a/build/manifestparser.py
+++ b/build/manifestparser.py
@@ -45,17 +45,17 @@ except AttributeError:
         start_list = os.path.abspath(start).split(os.path.sep)
         path_list = os.path.abspath(path).split(os.path.sep)
 
         # Work out how much of the filepath is shared by start and path.
         i = len(os.path.commonprefix([start_list, path_list]))
 
         rel_list = [os.path.pardir] * (len(start_list)-i) + path_list[i:]
         if not rel_list:
-            return start
+            return os.curdir
         return os.path.join(*rel_list)
 
 # expr.py
 # from:
 # http://k0s.org/mozilla/hg/expressionparser
 # http://hg.mozilla.org/users/tmielczarek_mozilla.com/expressionparser
 
 # Implements a top-down parser/evaluator for simple boolean expressions.
--- a/build/mobile/b2gautomation.py
+++ b/build/mobile/b2gautomation.py
@@ -101,17 +101,17 @@ class B2GRemoteAutomation(Automation):
 
         return app, args
 
     def getLanIp(self):
         nettools = NetworkTools()
         return nettools.getLanIp()
 
     def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime,
-                      debuggerInfo, symbolsPath, logger):
+                      debuggerInfo, symbolsPath):
         """ Wait for mochitest to finish (as evidenced by a signature string
             in logcat), or for a given amount of time to elapse with no
             output.
         """
         timeout = timeout or 120
 
         didTimeout = False
 
--- a/build/mobile/robocop/Makefile.in
+++ b/build/mobile/robocop/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH       = ../../..
+DEPTH       = @DEPTH@
 topsrcdir   = @top_srcdir@
 srcdir      = @srcdir@
 VPATH       = @srcdir@
 TESTPATH    = $(topsrcdir)/mobile/android/base/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = robocop
--- a/build/mobile/sutagent/android/Makefile.in
+++ b/build/mobile/sutagent/android/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = sutAgentAndroid
 
--- a/build/mobile/sutagent/android/fencp/Makefile.in
+++ b/build/mobile/sutagent/android/fencp/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = FenCP
 
--- a/build/mobile/sutagent/android/ffxcp/Makefile.in
+++ b/build/mobile/sutagent/android/ffxcp/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = FfxCP
 
--- a/build/mobile/sutagent/android/watcher/Makefile.in
+++ b/build/mobile/sutagent/android/watcher/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../../../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = Watcher
 
--- a/build/package/Makefile.in
+++ b/build/package/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 # This makefile doesn't do anything by default. Use one of the special targets
 # below to stage and build packages.
--- a/build/pgo/Makefile.in
+++ b/build/pgo/Makefile.in
@@ -1,18 +1,18 @@
 #
 # 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/.
 
-DEPTH		= ../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir = build/pgo
+relativesrcdir = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   blueprint \
   js-input \
   $(NULL)
 
--- a/build/pgo/blueprint/Makefile.in
+++ b/build/pgo/blueprint/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _PROFILE_DIR = $(DEPTH)/_profile/pgo/blueprint
--- a/build/pgo/js-input/Makefile.in
+++ b/build/pgo/js-input/Makefile.in
@@ -1,14 +1,14 @@
 #
 # 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/.
 
-DEPTH		= ../../..
+DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _PROFILE_DIR = $(DEPTH)/_profile/pgo/js-input
--- a/build/pymake/pymake/parser.py
+++ b/build/pymake/pymake/parser.py
@@ -493,19 +493,19 @@ def parsestring(s, filename):
 
             if kword == 'export':
                 currule = False
                 e, token, offset = parsemakesyntax(d, offset, _varsettokens, itermakefilechars)
                 e.lstrip()
                 e.rstrip()
 
                 if token is None:
-                    condstack[-1].append(parserdata.ExportDirective(e, single=False))
+                    condstack[-1].append(parserdata.ExportDirective(e, concurrent_set=False))
                 else:
-                    condstack[-1].append(parserdata.ExportDirective(e, single=True))
+                    condstack[-1].append(parserdata.ExportDirective(e, concurrent_set=True))
 
                     value = flattenmakesyntax(d, offset).lstrip()
                     condstack[-1].append(parserdata.SetVariable(e, value=value, valueloc=d.getloc(offset), token=token, targetexp=None))
 
                 continue
 
             if kword == 'unexport':
                 e, token, offset = parsemakesyntax(d, offset, (), itermakefilechars)
--- a/build/pymake/pymake/parserdata.py
+++ b/build/pymake/pymake/parserdata.py
@@ -83,16 +83,17 @@ def parsecommandlineargs(args):
         if t == '':
             vname, t, val = util.strpartition(a, '=')
         if t != '':
             overrides.append(_flagescape.sub(r'\\\1', a))
 
             vname = vname.strip()
             vnameexp = data.Expansion.fromstring(vname, "Command-line argument")
 
+            stmts.append(ExportDirective(vnameexp, concurrent_set=True))
             stmts.append(SetVariable(vnameexp, token=t,
                                      value=val, valueloc=Location('<command-line>', i, len(vname) + len(t)),
                                      targetexp=None, source=data.Variables.SOURCE_COMMANDLINE))
         else:
             r.append(a)
 
     return stmts, r, ' '.join(overrides)
 
@@ -543,30 +544,32 @@ class VPathDirective(Statement):
 class ExportDirective(Statement):
     """
     Represents the "export" directive.
 
     This is used to control exporting variables to sub makes.
 
     See https://www.gnu.org/software/make/manual/make.html#Variables_002fRecursion
 
-    The `single` field defines whether this statement occurred with or without
-    a variable assignment. If True, no variable assignment was present. If
-    False, the SetVariable immediately following this statement originally came
-    from this export directive (the parser splits it into multiple statements).
+    The `concurrent_set` field defines whether this statement occurred with or
+    without a variable assignment. If False, no variable assignment was
+    present. If True, the SetVariable immediately following this statement
+    originally came from this export directive (the parser splits it into
+    multiple statements).
     """
-    __slots__ = ('exp', 'single')
 
-    def __init__(self, exp, single):
+    __slots__ = ('exp', 'concurrent_set')
+
+    def __init__(self, exp, concurrent_set):
         assert isinstance(exp, (data.Expansion, data.StringExpansion))
         self.exp = exp
-        self.single = single
+        self.concurrent_set = concurrent_set
 
     def execute(self, makefile, context):
-        if self.single:
+        if self.concurrent_set:
             vlist = [self.exp.resolvestr(makefile, makefile.variables)]
         else:
             vlist = list(self.exp.resolvesplit(makefile, makefile.variables))
             if not len(vlist):
                 raise data.DataError("Exporting all variables is not supported", self.exp.loc)
 
         for v in vlist:
             makefile.exportedvars[v] = True
--- a/build/pymake/pymake/process.py
+++ b/build/pymake/pymake/process.py
@@ -10,17 +10,18 @@ import subprocess, shlex, re, logging, s
 subprocess._cleanup = lambda: None
 import command, util
 if sys.platform=='win32':
     import win32process
 
 _log = logging.getLogger('pymake.process')
 
 _escapednewlines = re.compile(r'\\\n')
-_blacklist = re.compile(r'[$><;[{~`|&()]')
+_blacklist = re.compile(r'[$><;[~`|&()]' +
+    r'|\${|(?:^|\s){(?:$|\s)')  # Blacklist ${foo} and { commands }
 _needsglob = re.compile(r'[\*\?]')
 def clinetoargv(cline):
     """
     If this command line can safely skip the shell, return an argv array.
     @returns argv, badchar
     """
 
     str = _escapednewlines.sub('', cline)
--- a/build/pymake/tests/makeflags.mk
+++ b/build/pymake/tests/makeflags.mk
@@ -1,6 +1,7 @@
 #T environment: {'MAKEFLAGS': 'OVAR=oval'}
 
 all:
 	test "$(OVAR)" = "oval"
+	test "$$OVAR" = "oval"
 	@echo TEST-PASS
 
--- a/build/pymake/tests/native-simple.mk
+++ b/build/pymake/tests/native-simple.mk
@@ -1,10 +1,11 @@
 ifndef TOUCH
 TOUCH = touch
 endif
 
-all: testfile
+all: testfile {testfile2}
 	test -f testfile
+	test -f {testfile2}
 	@echo TEST-PASS
 
-testfile:
+testfile {testfile2}:
 	$(TOUCH) $@
--- a/build/stlport/Makefile.in
+++ b/build/stlport/Makefile.in
@@ -1,13 +1,13 @@
 # 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/.
 
-DEPTH = ../..
+DEPTH = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULES = stlport
 LIBRARY_NAME = stlport_static
new file mode 100644
--- /dev/null
+++ b/build/tests/unit-ConfigStatus.py
@@ -0,0 +1,328 @@
+from __future__ import with_statement
+import os, posixpath
+from StringIO import StringIO
+import unittest
+from mozunit import main, MockedOpen
+import ConfigStatus
+from ConfigStatus import FileAvoidWrite
+
+class ConfigEnvironment(ConfigStatus.ConfigEnvironment):
+    def __init__(self, **args):
+        ConfigStatus.ConfigEnvironment.__init__(self, **args)
+        # Be helpful to unit tests
+        if not 'top_srcdir' in self.substs:
+            if os.path.isabs(self.topsrcdir):
+                self.substs['top_srcdir'] = self.topsrcdir.replace(os.sep, '/')
+            else:
+                self.substs['top_srcdir'] = ConfigStatus.relpath(self.topsrcdir, self.topobjdir).replace(os.sep, '/')
+
+class TestFileAvoidWrite(unittest.TestCase):
+    def test_file_avoid_write(self):
+        '''Test the FileAvoidWrite class
+        '''
+        with MockedOpen({'file': 'content'}):
+            # Overwriting an existing file replaces its content
+            with FileAvoidWrite('file') as file:
+                file.write('bazqux')
+            self.assertEqual(open('file', 'r').read(), 'bazqux')
+
+            # Creating a new file (obviously) stores its content
+            with FileAvoidWrite('file2') as file:
+                file.write('content')
+            self.assertEqual(open('file2').read(), 'content')
+
+        class MyMockedOpen(MockedOpen):
+            '''MockedOpen extension to raise an exception if something
+            attempts to write in an opened file.
+            '''
+            def __call__(self, name, mode):
+                if 'w' in mode:
+                    raise Exception, 'Unexpected open with write mode'
+                return MockedOpen.__call__(self, name, mode)
+
+        with MyMockedOpen({'file': 'content'}):
+            # Validate that MyMockedOpen works as intended
+            file = FileAvoidWrite('file')
+            file.write('foobar')
+            self.assertRaises(Exception, file.close)
+
+            # Check that no write actually happens when writing the
+            # same content as what already is in the file
+            with FileAvoidWrite('file') as file:
+                file.write('content')
+
+
+class TestEnvironment(unittest.TestCase):
+    def test_auto_substs(self):
+        '''Test the automatically set values of ACDEFINES and ALLDEFINES.
+        '''
+        env = ConfigEnvironment(
+                  defines = [ ('foo', 'bar'), ('baz', 'qux 42'),
+                              ('abc', 'def'), ('extra', 'foobar') ],
+                  non_global_defines = ['extra', 'ignore'])
+        # non_global_defines should be filtered out in ACDEFINES and
+        # ALLDEFINES.
+        # Original order of the defines need to be respected in ACDEFINES