merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 17 Jun 2016 00:32:10 +0100
changeset 342023 5f95858f8ddf21ea2271a12810332efd09eff138
parent 341977 05873df0c0c268e419a714b8a6204cb852049098 (current diff)
parent 342022 8c3dd3e28c79ed168bf04b265a1e9a589f000284 (diff)
child 342024 048bc3681be741fa5677744a0a30cff6a7358557
child 342034 759277e45f04a6f27c030cf1e675ed9a5199d029
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone50.0a1
first release with
nightly linux32
5f95858f8ddf / 50.0a1 / 20160616163918 / files
nightly linux64
5f95858f8ddf / 50.0a1 / 20160616163918 / files
nightly mac
5f95858f8ddf / 50.0a1 / 20160616163918 / files
nightly win32
5f95858f8ddf / 50.0a1 / 20160617030217 / files
nightly win64
5f95858f8ddf / 50.0a1 / 20160616163918 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central a=merge
dom/html/nsFormSubmission.cpp
dom/html/nsFormSubmission.h
dom/html/nsFormSubmissionConstants.h
gfx/thebes/gfxPlatformGtk.cpp
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableOuterFrame.h
toolkit/crashreporter/gonk-include/elf.h
toolkit/crashreporter/gonk-include/link.h
toolkit/crashreporter/gonk-include/stab.h
toolkit/crashreporter/gonk-include/sys/procfs.h
toolkit/crashreporter/gonk-include/sys/signal.h
toolkit/crashreporter/gonk-include/sys/stat.h
toolkit/crashreporter/gonk-include/sys/ucontext.h
toolkit/crashreporter/gonk-include/sys/user.h
toolkit/crashreporter/gonk-include/ucontext.h
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1674,22 +1674,22 @@ nsAccessibilityService::CreateAccessible
       // accessible HTML table or a direct child of accessible of HTML table.
       Accessible* table = aContext->IsTable() ? aContext : nullptr;
       if (!table && aContext->Parent() && aContext->Parent()->IsTable())
         table = aContext->Parent();
 
       if (table) {
         nsIContent* parentContent = aContent->GetParent();
         nsIFrame* parentFrame = parentContent->GetPrimaryFrame();
-        if (parentFrame->GetType() != nsGkAtoms::tableOuterFrame) {
+        if (parentFrame->GetType() != nsGkAtoms::tableWrapperFrame) {
           parentContent = parentContent->GetParent();
           parentFrame = parentContent->GetPrimaryFrame();
         }
 
-        if (parentFrame->GetType() == nsGkAtoms::tableOuterFrame &&
+        if (parentFrame->GetType() == nsGkAtoms::tableWrapperFrame &&
             table->GetContent() == parentContent) {
           newAcc = new HTMLTableRowAccessible(aContent, document);
         }
       }
       break;
     }
     case eHTMLTextFieldType:
       newAcc = new HTMLTextFieldAccessible(aContent, document);
--- a/accessible/html/HTMLTableAccessible.cpp
+++ b/accessible/html/HTMLTableAccessible.cpp
@@ -29,17 +29,17 @@
 #include "nsIPresShell.h"
 #include "nsITableCellLayout.h"
 #include "nsFrameSelection.h"
 #include "nsError.h"
 #include "nsArrayUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsNameSpaceManager.h"
 #include "nsTableCellFrame.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableCellAccessible
 ////////////////////////////////////////////////////////////////////////////////
@@ -490,31 +490,31 @@ HTMLTableAccessible::Summary(nsString& a
 
   if (table)
     table->GetSummary(aSummary);
 }
 
 uint32_t
 HTMLTableAccessible::ColCount()
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   return tableFrame ? tableFrame->GetColCount() : 0;
 }
 
 uint32_t
 HTMLTableAccessible::RowCount()
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   return tableFrame ? tableFrame->GetRowCount() : 0;
 }
 
 uint32_t
 HTMLTableAccessible::SelectedCellCount()
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return 0;
 
   uint32_t count = 0, rowCount = RowCount(), colCount = ColCount();
   for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
     for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
       nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
       if (!cellFrame || !cellFrame->IsSelected())
@@ -554,17 +554,17 @@ HTMLTableAccessible::SelectedRowCount()
       count++;
 
   return count;
 }
 
 void
 HTMLTableAccessible::SelectedCells(nsTArray<Accessible*>* aCells)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return;
 
   uint32_t rowCount = RowCount(), colCount = ColCount();
   for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
     for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
       nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
       if (!cellFrame || !cellFrame->IsSelected())
@@ -581,17 +581,17 @@ HTMLTableAccessible::SelectedCells(nsTAr
         aCells->AppendElement(cell);
     }
   }
 }
 
 void
 HTMLTableAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return;
 
   uint32_t rowCount = RowCount(), colCount = ColCount();
   for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
     for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
       nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
       if (!cellFrame || !cellFrame->IsSelected())
@@ -623,85 +623,85 @@ HTMLTableAccessible::SelectedRowIndices(
   for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++)
     if (IsRowSelected(rowIdx))
       aRows->AppendElement(rowIdx);
 }
 
 Accessible*
 HTMLTableAccessible::CellAt(uint32_t aRowIdx, uint32_t aColIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return nullptr;
 
   nsIContent* cellContent = tableFrame->GetCellAt(aRowIdx, aColIdx);
   Accessible* cell = mDoc->GetAccessible(cellContent);
 
   // XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may
   // return itself as a cell what makes Orca hang.
   return cell == this ? nullptr : cell;
 }
 
 int32_t
 HTMLTableAccessible::CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return -1;
 
   return tableFrame->GetIndexByRowAndColumn(aRowIdx, aColIdx);
 }
 
 int32_t
 HTMLTableAccessible::ColIndexAt(uint32_t aCellIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return -1;
 
   int32_t rowIdx = -1, colIdx = -1;
   tableFrame->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
   return colIdx;
 }
 
 int32_t
 HTMLTableAccessible::RowIndexAt(uint32_t aCellIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return -1;
 
   int32_t rowIdx = -1, colIdx = -1;
   tableFrame->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
   return rowIdx;
 }
 
 void
 HTMLTableAccessible::RowAndColIndicesAt(uint32_t aCellIdx, int32_t* aRowIdx,
                                         int32_t* aColIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (tableFrame)
     tableFrame->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
 }
 
 uint32_t
 HTMLTableAccessible::ColExtentAt(uint32_t aRowIdx, uint32_t aColIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return 0;
 
   return tableFrame->GetEffectiveColSpanAt(aRowIdx, aColIdx);
 }
 
 uint32_t
 HTMLTableAccessible::RowExtentAt(uint32_t aRowIdx, uint32_t aColIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return 0;
 
   return tableFrame->GetEffectiveRowSpanAt(aRowIdx, aColIdx);
 }
 
 bool
 HTMLTableAccessible::IsColSelected(uint32_t aColIdx)
@@ -731,17 +731,17 @@ HTMLTableAccessible::IsRowSelected(uint3
   }
 
   return isSelected;
 }
 
 bool
 HTMLTableAccessible::IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return false;
 
   nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(aRowIdx, aColIdx);
   return cellFrame ? cellFrame->IsSelected() : false;
 }
 
 void
@@ -786,17 +786,17 @@ HTMLTableAccessible::UnselectCol(uint32_
                                    false);
 }
 
 nsresult
 HTMLTableAccessible::AddRowOrColumnToSelection(int32_t aIndex, uint32_t aTarget)
 {
   bool doSelectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
 
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return NS_OK;
 
   uint32_t count = 0;
   if (doSelectRow)
     count = ColCount();
   else
     count = RowCount();
@@ -818,17 +818,17 @@ HTMLTableAccessible::AddRowOrColumnToSel
   return NS_OK;
 }
 
 nsresult
 HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(int32_t aIndex,
                                                       uint32_t aTarget,
                                                       bool aIsOuter)
 {
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return NS_OK;
 
   nsIPresShell* presShell(mDoc->PresShell());
   RefPtr<nsFrameSelection> tableSelection =
     const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
 
   bool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
@@ -1042,17 +1042,17 @@ HTMLTableAccessible::IsProbablyLayoutTab
   // Check for many columns
   if (colCount >= 5) {
     RETURN_LAYOUT_ANSWER(false, ">=5 columns");
   }
 
   // Now we know there are 2-4 columns and 2 or more rows
   // Check to see if there are visible borders on the cells
   // XXX currently, we just check the first cell -- do we really need to do more?
-  nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     RETURN_LAYOUT_ANSWER(false, "table with no frame!");
 
   nsIFrame* cellFrame = tableFrame->GetCellFrameAt(0, 0);
   if (!cellFrame)
     RETURN_LAYOUT_ANSWER(false, "table's first cell has no frame!");
 
   nsMargin border;
--- a/b2g/moz.configure
+++ b/b2g/moz.configure
@@ -1,23 +1,21 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 option('--with-gonk', nargs=1, help='Path to the gonk base directory')
 
-@depends_if('--with-gonk')
-def gonkdir(value):
+@depends_if('--with-gonk', '--help')
+def gonkdir(value, _):
     return value[0]
 
 add_old_configure_assignment('gonkdir', gonkdir)
-set_config('ANDROID_NDK',
-           depends_if(gonkdir)(lambda x: os.path.join(x, 'ndk')))
 
 @depends_if('--with-gonk')
 def gonk_toolkit(_):
     return 'cairo-gonk'
 
 imply_option('--enable-default-toolkit', gonk_toolkit)
 
 
--- a/browser/base/content/docs/sslerrorreport/preferences.rst
+++ b/browser/base/content/docs/sslerrorreport/preferences.rst
@@ -7,17 +7,17 @@ Preferences
 The following preferences are used by SSL Error reporting:
 
 "security.ssl.errorReporting.enabled"
   Should the SSL Error Reporting UI be shown on pin violations? Default
   value: ``true``
 
 "security.ssl.errorReporting.url"
   Where should SSL error reports be sent? Default value:
-  ``https://data.mozilla.com/submit/sslreports-stg``
+  ``https://incoming.telemetry.mozilla.org/submit/sslreports/``
 
 "security.ssl.errorReporting.automatic"
   Should error reports be sent without user interaction. Default value:
   ``false``. Note: this pref is overridden by the value of
   ``security.ssl.errorReporting.enabled``
   This is only set when specifically requested by the user. The user can set
   this value (or unset it) by checking the "Automatically report errors in the
   future" checkbox when about:neterror is displayed for SSL Errors.
--- a/browser/config/tooltool-manifests/linux64/tsan.manifest
+++ b/browser/config/tooltool-manifests/linux64/tsan.manifest
@@ -1,15 +1,23 @@
 [
 {
-"version": "clang 3.6.2/r241773",
-"size": 89690541, 
-"digest": "470d258d9785a120fcba65eee90daa632a42affa0f97f57d70fc8285bd76bcc27d4d0d70b6c37577ab271a04c843b6269425391a8d6df1967718dba26dd3a73d", 
-"algorithm": "sha512", 
-"filename": "clang.tar.bz2",
+"version": "gcc 4.8.5 + PR64905",
+"size": 80160264,
+"digest": "c1a9dc9da289b8528874d16300b9d13a997cec99195bb0bc46ff665216d8535d6d6cb5af6b4b1f2749af6815dab12e703fdb3849014e5c23a70eff351a0baf4e",
+"algorithm": "sha512",
+"filename": "gcc.tar.xz",
+"unpack": true
+},
+{
+"version": "clang 3.8.0, libgcc 4.8.5",
+"size": 139183100,
+"digest": "a056a151d4f25f415b6d905136c3fa8d51d12a5a815c3df37d5663c67d59571736641a4c990884a69f78ea6b5e37a6a7bfff0417dfe38936d842d6fa0776ae54",
+"algorithm": "sha512",
+"filename": "clang.tar.xz",
 "unpack": true
 },
 {
 "size": 12072532,
 "digest": "3915f8ec396c56a8a92e6f9695b70f09ce9d1582359d1258e37e3fd43a143bc974410e4cfc27f500e095f34a8956206e0ebf799b7287f0f38def0d5e34ed71c9",
 "algorithm": "sha512",
 "filename": "gtk3.tar.xz",
 "setup": "setup.sh",
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -65,17 +65,17 @@ case "$target" in
     ;;
 esac
 
 ])
 
 AC_DEFUN([MOZ_ANDROID_CPU_ARCH],
 [
 
-if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
+if test "$OS_TARGET" = "Android"; then
     case "${CPU_ARCH}-${MOZ_ARCH}" in
     arm-armv7*)
         ANDROID_CPU_ARCH=armeabi-v7a
         ;;
     arm-*)
         ANDROID_CPU_ARCH=armeabi
         ;;
     x86-*)
@@ -88,17 +88,17 @@ if test "$OS_TARGET" = "Android" -a -z "
 
     AC_SUBST(ANDROID_CPU_ARCH)
 fi
 ])
 
 AC_DEFUN([MOZ_ANDROID_STLPORT],
 [
 
-if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
+if test "$OS_TARGET" = "Android"; then
     cpu_arch_dir="$ANDROID_CPU_ARCH"
     if test "$MOZ_THUMB2" = 1; then
         cpu_arch_dir="$cpu_arch_dir/thumb"
     fi
 
     if test -z "$STLPORT_CPPFLAGS$STLPORT_LIBS"; then
         case "$android_cxx_stl" in
         libstdc++)
--- a/build/buildconfig.py
+++ b/build/buildconfig.py
@@ -1,30 +1,20 @@
 # 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/.
 
-import imp
 import os
 import sys
+from mozbuild.base import MozbuildObject
 
-path = os.path.dirname(sys.executable)
-while not os.path.exists(os.path.join(path, 'config.status')):
-    parent = os.path.normpath(os.path.join(path, os.pardir))
-    if parent == path:
-        raise Exception("Can't find config.status")
-    path = parent
+config = MozbuildObject.from_environment()
 
-path = os.path.join(path, 'config.status')
-config = imp.load_module('_buildconfig', open(path), path, ('', 'r', imp.PY_SOURCE))
+for var in ('topsrcdir', 'topobjdir', 'defines', 'non_global_defines',
+            'substs'):
+    value = getattr(config, var)
+    setattr(sys.modules[__name__], var, value)
 
-# Copy values from the config.status namespace into this module namespace.
-# This effectively imports topsrcdir, topobjdir, defines, substs, files,
-# headers and non_global_defines
-for var in config.__all__:
-    value = getattr(config, var)
-    if isinstance(value, list) and value and isinstance(value[0], tuple):
-        value = dict(value)
-    setattr(sys.modules[__name__], var, value)
+substs = dict(substs)
 
 for var in os.environ:
     if var != 'SHELL' and var in substs:
         substs[var] = os.environ[var]
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -788,9 +788,19 @@ def js_option(*args, **kwargs):
 
     add_old_configure_arg(js_option)
 
 
 include('pkg.configure')
 # Make this assignment here rather than in pkg.configure to avoid
 # requiring this file in unit tests.
 add_old_configure_assignment('PKG_CONFIG', pkg_config)
+
+# Bug 1278542: This function is a workaround to resolve
+# |android_ndk_include|'s dependency on 'gonkdir.' The
+# actual implementation is located in b2g/moz.configure.
+# Remove this function as soon as 'android_ndk_include'
+# depends on 'target.'
+@depends('--help')
+def gonkdir(_):
+    return None
+
 include(include_project_configure)
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -54,19 +54,19 @@ def have_yasm(value):
 set_config('HAVE_YASM', have_yasm)
 # Until the YASM variable is not necessary in old-configure.
 add_old_configure_assignment('YASM', have_yasm)
 
 
 # Android NDK
 # ==============================================================
 
-@depends('--disable-compile-environment', build_project, '--help')
-def android_ndk_include(compile_env, build_project, _):
-    if compile_env and build_project in ('mobile/android', 'js'):
+@depends('--disable-compile-environment', build_project, gonkdir, '--help')
+def android_ndk_include(compile_env, build_project, gonkdir, _):
+    if compile_env and (gonkdir or build_project in ('mobile/android', 'js')):
         return 'android-ndk.configure'
 
 include(android_ndk_include)
 
 
 # MacOS deployment target version
 # ==============================================================
 # This needs to happen before any compilation test is done.
--- a/build/unix/mozconfig.tsan
+++ b/build/unix/mozconfig.tsan
@@ -7,16 +7,22 @@ export CC="$topsrcdir/clang/bin/clang"
 export CXX="$topsrcdir/clang/bin/clang++"
 export LLVM_SYMBOLIZER="$topsrcdir/clang/bin/llvm-symbolizer"
 
 # Mandatory flag for TSan
 export CFLAGS="-fsanitize=thread"
 export CXXFLAGS="-fsanitize=thread"
 export LDFLAGS="-fsanitize=thread"
 
+# Use a newer binutils, from the tooltool gcc package, if it's there
+if [ -e "$topsrcdir/gcc/bin/ld" ]; then
+    export CC="$CC -B $topsrcdir/gcc/bin"
+    export CXX="$CXX -B $topsrcdir/gcc/bin"
+fi
+
 # Enable TSan specific code and build workarounds
 ac_add_options --enable-thread-sanitizer
 
 # The ThreadSanitizer is not compatible with sanboxing
 # (see bug 1182565)
 ac_add_options --disable-sandbox
 
 # These are required by TSan
--- a/client.mk
+++ b/client.mk
@@ -187,16 +187,19 @@ WANT_MOZCONFIG_MK = 1
 endif
 
 ifdef WANT_MOZCONFIG_MK
 # For now, only output "export" lines and lines containing UPLOAD_EXTRA_FILES
 # from mach environment --format=client.mk output.
 MOZCONFIG_MK_LINES := $(filter export||% UPLOAD_EXTRA_FILES% %UPLOAD_EXTRA_FILES%,$(MOZCONFIG_OUT_LINES))
 $(OBJDIR)/.mozconfig.mk: $(TOPSRCDIR)/client.mk $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
 	$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
+ifdef MOZ_CURRENT_PROJECT
+	echo export MOZ_CURRENT_PROJECT=$(MOZ_CURRENT_PROJECT) >> $@
+endif
 
 # Include that makefile so that it is created. This should not actually change
 # the environment since MOZCONFIG_CONTENT, which MOZCONFIG_OUT_LINES derives
 # from, has already been eval'ed.
 include $(OBJDIR)/.mozconfig.mk
 endif
 
 # Print out any options loaded from mozconfig.
--- a/config/tests/test_mozbuild_reading.py
+++ b/config/tests/test_mozbuild_reading.py
@@ -77,16 +77,19 @@ class TestMozbuildReading(unittest.TestC
 
         try:
             config = mb.config_environment
         except Exception as e:
             if e.message == 'config.status not available. Run configure.':
                 raise unittest.SkipTest('failing without config.status')
             raise
 
+        if config.substs['MOZ_BUILD_APP'] == 'js':
+            raise unittest.SkipTest('failing in Spidermonkey builds')
+
         reader = BuildReader(config)
         all_paths = self._mozbuilds(reader)
         _, contexts = reader.read_relevant_mozbuilds(all_paths)
 
         finder = FileFinder(config.topsrcdir, find_executables=False,
                             ignore=['obj*'])
 
         def pattern_exists(pat):
--- a/configure.py
+++ b/configure.py
@@ -77,18 +77,17 @@ if __name__ == '__main__':
     from mozbuild.config_status import config_status
     config_status(**args)
 ''')
 
     # Other things than us are going to run this file, so we need to give it
     # executable permissions.
     os.chmod('config.status', 0755)
     if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
-        if not config.get('JS_STANDALONE'):
-            os.environ['WRITE_MOZINFO'] = '1'
+        os.environ['WRITE_MOZINFO'] = '1'
         # Until we have access to the virtualenv from this script, execute
         # config.status externally, with the virtualenv python.
         return subprocess.call([config['PYTHON'], 'config.status'])
     return 0
 
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv))
--- a/dom/base/FormData.cpp
+++ b/dom/base/FormData.cpp
@@ -11,17 +11,17 @@
 #include "mozilla/dom/HTMLFormElement.h"
 
 #include "MultipartBlobImpl.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 FormData::FormData(nsISupports* aOwner)
-  : nsFormSubmission(NS_LITERAL_CSTRING("UTF-8"), nullptr)
+  : HTMLFormSubmission(NS_LITERAL_CSTRING("UTF-8"), nullptr)
   , mOwner(aOwner)
 {
 }
 
 namespace {
 
 already_AddRefed<File>
 GetOrCreateFileCalledBlob(Blob& aBlob, ErrorResult& aRv)
@@ -94,17 +94,17 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(FormDat
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FormData)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsIDOMFormData)
   NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormData)
 NS_INTERFACE_MAP_END
 
 // -------------------------------------------------------------------------
-// nsFormSubmission
+// HTMLFormSubmission
 nsresult
 FormData::GetEncodedSubmission(nsIURI* aURI,
                                nsIInputStream** aPostDataStream)
 {
   NS_NOTREACHED("Shouldn't call FormData::GetEncodedSubmission");
   return NS_OK;
 }
 
@@ -367,17 +367,17 @@ FormData::Constructor(const GlobalObject
 
 // -------------------------------------------------------------------------
 // nsIXHRSendable
 
 NS_IMETHODIMP
 FormData::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
                       nsACString& aContentType, nsACString& aCharset)
 {
-  nsFSMultipartFormData fs(NS_LITERAL_CSTRING("UTF-8"), nullptr);
+  FSMultipartFormData fs(NS_LITERAL_CSTRING("UTF-8"), nullptr);
 
   for (uint32_t i = 0; i < mFormData.Length(); ++i) {
     if (mFormData[i].wasNullBlob) {
       MOZ_ASSERT(mFormData[i].value.IsUSVString());
       fs.AddNameBlobOrNullPair(mFormData[i].name, nullptr);
     } else if (mFormData[i].value.IsUSVString()) {
       fs.AddNameValuePair(mFormData[i].name,
                           mFormData[i].value.GetAsUSVString());
--- a/dom/base/FormData.h
+++ b/dom/base/FormData.h
@@ -5,33 +5,33 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_FormData_h
 #define mozilla_dom_FormData_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/BindingDeclarations.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FormDataBinding.h"
 #include "nsIDOMFormData.h"
 #include "nsIXMLHttpRequest.h"
-#include "nsFormSubmission.h"
 #include "nsTArray.h"
 #include "nsWrapperCache.h"
 
 namespace mozilla {
 namespace dom {
 
 class HTMLFormElement;
 class GlobalObject;
 
 class FormData final : public nsIDOMFormData,
                        public nsIXHRSendable,
-                       public nsFormSubmission,
+                       public HTMLFormSubmission,
                        public nsWrapperCache
 {
 private:
   ~FormData() {}
 
   struct FormDataTuple
   {
     nsString name;
@@ -99,17 +99,17 @@ public:
            ErrorResult& aRv);
 
   uint32_t GetIterableLength() const;
 
   const nsAString& GetKeyAtIndex(uint32_t aIndex) const;
 
   const OwningBlobOrUSVString& GetValueAtIndex(uint32_t aIndex) const;
 
-  // nsFormSubmission
+  // HTMLFormSubmission
   virtual nsresult
   GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override;
 
   virtual nsresult AddNameValuePair(const nsAString& aName,
                                     const nsAString& aValue) override
   {
     FormDataTuple* data = mFormData.AppendElement();
     SetNameValuePair(data, aName, aValue);
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -2010,17 +2010,17 @@ GK_ATOM(rubyTextFrame, "RubyTextFrame")
 GK_ATOM(scrollFrame, "ScrollFrame")
 GK_ATOM(scrollbarFrame, "ScrollbarFrame")
 GK_ATOM(sequenceFrame, "SequenceFrame")
 GK_ATOM(sliderFrame, "sliderFrame")
 GK_ATOM(tableCellFrame, "TableCellFrame")
 GK_ATOM(tableColFrame, "TableColFrame")
 GK_ATOM(tableColGroupFrame, "TableColGroupFrame")
 GK_ATOM(tableFrame, "TableFrame")
-GK_ATOM(tableOuterFrame, "TableOuterFrame")
+GK_ATOM(tableWrapperFrame, "TableWrapperFrame")
 GK_ATOM(tableRowGroupFrame, "TableRowGroupFrame")
 GK_ATOM(tableRowFrame, "TableRowFrame")
 GK_ATOM(textInputFrame,"TextInputFrame")
 GK_ATOM(textFrame, "TextFrame")
 GK_ATOM(viewportFrame, "ViewportFrame")
 #ifdef MOZ_XUL
 GK_ATOM(XULLabelFrame, "XULLabelFrame")
 #endif
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -1,27 +1,26 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "mozilla/dom/HTMLButtonElement.h"
 
+#include "HTMLFormSubmissionConstants.h"
 #include "mozilla/dom/HTMLButtonElementBinding.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFormControl.h"
-#include "nsIForm.h"
-#include "nsFormSubmission.h"
-#include "nsFormSubmissionConstants.h"
 #include "nsIURL.h"
 #include "nsIFrame.h"
 #include "nsIFormControlFrame.h"
 #include "nsIDOMEvent.h"
 #include "nsIDocument.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
@@ -435,17 +434,17 @@ HTMLButtonElement::UnbindFromTree(bool a
 
 NS_IMETHODIMP
 HTMLButtonElement::Reset()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLButtonElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLButtonElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
 {
   //
   // We only submit if we were the button pressed
   //
   if (aFormSubmission->GetOriginatingElement() != this) {
     return NS_OK;
   }
 
--- a/dom/html/HTMLButtonElement.h
+++ b/dom/html/HTMLButtonElement.h
@@ -44,17 +44,17 @@ public:
   }
 
   // nsIDOMHTMLButtonElement
   NS_DECL_NSIDOMHTMLBUTTONELEMENT
 
   // overriden nsIFormControl methods
   NS_IMETHOD_(uint32_t) GetType() const override { return mType; }
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   bool RestoreState(nsPresState* aState) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
   // nsIDOMEventTarget
   virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override;
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -149,17 +149,17 @@ HTMLFieldSetElement::Elements()
 
 nsresult
 HTMLFieldSetElement::Reset()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLFieldSetElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLFieldSetElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
 {
   return NS_OK;
 }
 
 nsresult
 HTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
                                    bool aNotify)
 {
--- a/dom/html/HTMLFieldSetElement.h
+++ b/dom/html/HTMLFieldSetElement.h
@@ -46,17 +46,17 @@ public:
 
   virtual nsresult InsertChildAt(nsIContent* aChild, uint32_t aIndex,
                                      bool aNotify) override;
   virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
 
   // nsIFormControl
   NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_FIELDSET; }
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
 
   const nsIContent* GetFirstLegend() const { return mFirstLegend; }
 
   void AddElement(nsGenericHTMLFormElement* aElement);
 
   void RemoveElement(nsGenericHTMLFormElement* aElement);
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -31,31 +31,31 @@
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
 #include "nsIMutableArray.h"
 #include "nsIFormAutofillContentService.h"
 #include "mozilla/BinarySearch.h"
 #include "nsQueryObject.h"
 
 // form submission
+#include "HTMLFormSubmissionConstants.h"
 #include "mozilla/dom/FormData.h"
 #include "mozilla/Telemetry.h"
 #include "nsIFormSubmitObserver.h"
 #include "nsIObserverService.h"
 #include "nsICategoryManager.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsISimpleEnumerator.h"
 #include "nsRange.h"
 #include "nsIScriptError.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsNetUtil.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebProgress.h"
 #include "nsIDocShell.h"
-#include "nsFormSubmissionConstants.h"
 #include "nsIPrompt.h"
 #include "nsISecurityUITelemetry.h"
 #include "nsIStringBundle.h"
 
 // radio buttons
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsIRadioVisitor.h"
 #include "RadioNodeList.h"
@@ -639,17 +639,17 @@ HTMLFormElement::DoSubmit(WidgetEvent* a
     // XXX Should this return an error?
     return NS_OK;
   }
 
   // Mark us as submitting so that we don't try to submit again
   mIsSubmitting = true;
   NS_ASSERTION(!mWebProgress && !mSubmittingRequest, "Web progress / submitting request should not exist here!");
 
-  nsAutoPtr<nsFormSubmission> submission;
+  nsAutoPtr<HTMLFormSubmission> submission;
 
   //
   // prepare the submission object
   //
   nsresult rv = BuildSubmission(getter_Transfers(submission), aEvent);
   if (NS_FAILED(rv)) {
     mIsSubmitting = false;
     return rv;
@@ -679,17 +679,17 @@ HTMLFormElement::DoSubmit(WidgetEvent* a
 
   //
   // perform the submission
   //
   return SubmitSubmission(submission);
 }
 
 nsresult
-HTMLFormElement::BuildSubmission(nsFormSubmission** aFormSubmission,
+HTMLFormElement::BuildSubmission(HTMLFormSubmission** aFormSubmission,
                                  WidgetEvent* aEvent)
 {
   NS_ASSERTION(!mPendingSubmission, "tried to build two submissions!");
 
   // Get the originating frame (failure is non-fatal)
   nsGenericHTMLElement* originatingElement = nullptr;
   if (aEvent) {
     InternalFormEvent* formEvent = aEvent->AsFormEvent();
@@ -704,30 +704,31 @@ HTMLFormElement::BuildSubmission(nsFormS
     }
   }
 
   nsresult rv;
 
   //
   // Get the submission object
   //
-  rv = GetSubmissionFromForm(this, originatingElement, aFormSubmission);
+  rv = HTMLFormSubmission::GetFromForm(this, originatingElement,
+                                       aFormSubmission);
   NS_ENSURE_SUBMIT_SUCCESS(rv);
 
   //
   // Dump the data into the submission object
   //
   rv = WalkFormElements(*aFormSubmission);
   NS_ENSURE_SUBMIT_SUCCESS(rv);
 
   return NS_OK;
 }
 
 nsresult
-HTMLFormElement::SubmitSubmission(nsFormSubmission* aFormSubmission)
+HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
 {
   nsresult rv;
   nsIContent* originatingElement = aFormSubmission->GetOriginatingElement();
 
   //
   // Get the action and target
   //
   nsCOMPtr<nsIURI> actionURI;
@@ -1028,17 +1029,17 @@ HTMLFormElement::NotifySubmitObservers(n
     }
   }
 
   return rv;
 }
 
 
 nsresult
-HTMLFormElement::WalkFormElements(nsFormSubmission* aFormSubmission)
+HTMLFormElement::WalkFormElements(HTMLFormSubmission* aFormSubmission)
 {
   nsTArray<nsGenericHTMLFormElement*> sortedControls;
   nsresult rv = mControls->GetSortedControls(sortedControls);
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint32_t len = sortedControls.Length();
 
   // Hold a reference to the elements so they can't be deleted while
@@ -1604,17 +1605,17 @@ HTMLFormElement::OnSubmitClickEnd()
 }
 
 void
 HTMLFormElement::FlushPendingSubmission()
 {
   if (mPendingSubmission) {
     // Transfer owning reference so that the submissioin doesn't get deleted
     // if we reenter
-    nsAutoPtr<nsFormSubmission> submission = Move(mPendingSubmission);
+    nsAutoPtr<HTMLFormSubmission> submission = Move(mPendingSubmission);
 
     SubmitSubmission(submission);
   }
 }
 
 nsresult
 HTMLFormElement::GetActionURL(nsIURI** aActionURL,
                               nsIContent* aOriginatingElement)
--- a/dom/html/HTMLFormElement.h
+++ b/dom/html/HTMLFormElement.h
@@ -4,21 +4,21 @@
  * 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/. */
 
 #ifndef mozilla_dom_HTMLFormElement_h
 #define mozilla_dom_HTMLFormElement_h
 
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsIForm.h"
 #include "nsIFormControl.h"
-#include "nsFormSubmission.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIWebProgressListener.h"
 #include "nsIRadioGroupContainer.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsThreadUtils.h"
 #include "nsInterfaceHashtable.h"
 #include "nsRefPtrHashtable.h"
@@ -278,17 +278,17 @@ public:
   bool CheckValidFormSubmission();
 
   /**
    * Walk over the form elements and call SubmitNamesValues() on them to get
    * their data pumped into the FormSubmitter.
    *
    * @param aFormSubmission the form submission object
    */
-  nsresult WalkFormElements(nsFormSubmission* aFormSubmission);
+  nsresult WalkFormElements(HTMLFormSubmission* aFormSubmission);
 
   /**
    * Whether the submission of this form has been ever prevented because of
    * being invalid.
    *
    * @return Whether the submission of this form has been prevented because of
    * being invalid.
    */
@@ -476,24 +476,24 @@ protected:
   nsresult DoSubmit(WidgetEvent* aEvent);
 
   /**
    * Prepare the submission object (called by DoSubmit)
    *
    * @param aFormSubmission the submission object
    * @param aEvent the DOM event that was passed to us for the submit
    */
-  nsresult BuildSubmission(nsFormSubmission** aFormSubmission,
+  nsresult BuildSubmission(HTMLFormSubmission** aFormSubmission,
                            WidgetEvent* aEvent);
   /**
    * Perform the submission (called by DoSubmit and FlushPendingSubmission)
    *
    * @param aFormSubmission the submission object
    */
-  nsresult SubmitSubmission(nsFormSubmission* aFormSubmission);
+  nsresult SubmitSubmission(HTMLFormSubmission* aFormSubmission);
 
   /**
    * Notify any submit observers of the submit.
    *
    * @param aActionURL the URL being submitted to
    * @param aCancelSubmit out param where submit observers can specify that the
    *        submit should be cancelled.
    */
@@ -585,17 +585,17 @@ protected:
   /** If we notified the listeners early, what was the result? */
   bool mNotifiedObserversResult;
   /** Keep track of what the popup state was when the submit was initiated */
   PopupControlState mSubmitPopupState;
   /** Keep track of whether a submission was user-initiated or not */
   bool mSubmitInitiatedFromUserInput;
 
   /** The pending submission object */
-  nsAutoPtr<nsFormSubmission> mPendingSubmission;
+  nsAutoPtr<HTMLFormSubmission> mPendingSubmission;
   /** The request currently being submitted */
   nsCOMPtr<nsIRequest> mSubmittingRequest;
   /** The web progress object we are currently listening to */
   nsWeakPtr mWebProgress;
 
   /** The default submit element -- WEAK */
   nsGenericHTMLFormElement* mDefaultSubmitElement;
 
rename from dom/html/nsFormSubmission.cpp
rename to dom/html/HTMLFormSubmission.cpp
--- a/dom/html/nsFormSubmission.cpp
+++ b/dom/html/HTMLFormSubmission.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsFormSubmission.h"
+#include "HTMLFormSubmission.h"
 
 #include "nsCOMPtr.h"
 #include "nsIForm.h"
 #include "nsILinkHandler.h"
 #include "nsIDocument.h"
 #include "nsGkAtoms.h"
 #include "nsIFormControl.h"
 #include "nsIDOMHTMLFormElement.h"
@@ -35,75 +35,75 @@
 #include "nsCExternalHandlerService.h"
 #include "nsIFileStreams.h"
 #include "nsContentUtils.h"
 
 #include "mozilla/dom/Directory.h"
 #include "mozilla/dom/EncodingUtils.h"
 #include "mozilla/dom/File.h"
 
-using namespace mozilla;
-using mozilla::dom::Blob;
-using mozilla::dom::Directory;
-using mozilla::dom::EncodingUtils;
-using mozilla::dom::File;
+namespace mozilla {
+namespace dom {
 
-static void
+namespace {
+
+void
 SendJSWarning(nsIDocument* aDocument,
               const char* aWarningName,
               const char16_t** aWarningArgs, uint32_t aWarningArgsLen)
 {
   nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                   NS_LITERAL_CSTRING("HTML"), aDocument,
                                   nsContentUtils::eFORMS_PROPERTIES,
                                   aWarningName,
                                   aWarningArgs, aWarningArgsLen);
 }
 
-static void
+void
 RetrieveFileName(Blob* aBlob, nsAString& aFilename)
 {
   if (!aBlob) {
     return;
   }
 
   RefPtr<File> file = aBlob->ToFile();
   if (file) {
     file->GetName(aFilename);
   }
 }
 
 // --------------------------------------------------------------------------
 
-class nsFSURLEncoded : public nsEncodingFormSubmission
+class FSURLEncoded : public EncodingFormSubmission
 {
 public:
   /**
    * @param aCharset the charset of the form as a string
    * @param aMethod the method of the submit (either NS_FORM_METHOD_GET or
    *        NS_FORM_METHOD_POST).
    */
-  nsFSURLEncoded(const nsACString& aCharset,
-                 int32_t aMethod,
-                 nsIDocument* aDocument,
-                 nsIContent* aOriginatingElement)
-    : nsEncodingFormSubmission(aCharset, aOriginatingElement),
+  FSURLEncoded(const nsACString& aCharset,
+               int32_t aMethod,
+               nsIDocument* aDocument,
+               nsIContent* aOriginatingElement)
+    : EncodingFormSubmission(aCharset, aOriginatingElement),
       mMethod(aMethod),
       mDocument(aDocument),
       mWarnedFileControl(false)
   {
   }
 
-  virtual nsresult AddNameValuePair(const nsAString& aName,
-                                    const nsAString& aValue) override;
-  virtual nsresult AddNameBlobOrNullPair(const nsAString& aName,
-                                         Blob* aBlob) override;
-  virtual nsresult GetEncodedSubmission(nsIURI* aURI,
-                                        nsIInputStream** aPostDataStream)
-                                                                       override;
+  virtual nsresult
+  AddNameValuePair(const nsAString& aName, const nsAString& aValue) override;
+
+  virtual nsresult
+  AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob) override;
+
+  virtual nsresult
+  GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override;
 
   virtual bool SupportsIsindexSubmission() override
   {
     return true;
   }
 
   virtual nsresult AddIsindex(const nsAString& aValue) override;
 
@@ -132,18 +132,18 @@ private:
   /** The document whose URI to use when reporting errors */
   nsCOMPtr<nsIDocument> mDocument;
 
   /** Whether or not we have warned about a file control not being submitted */
   bool mWarnedFileControl;
 };
 
 nsresult
-nsFSURLEncoded::AddNameValuePair(const nsAString& aName,
-                                 const nsAString& aValue)
+FSURLEncoded::AddNameValuePair(const nsAString& aName,
+                               const nsAString& aValue)
 {
   // Encode value
   nsCString convValue;
   nsresult rv = URLEncode(aValue, convValue);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Encode name
   nsAutoCString convName;
@@ -158,17 +158,17 @@ nsFSURLEncoded::AddNameValuePair(const n
     mQueryString += NS_LITERAL_CSTRING("&") + convName
                   + NS_LITERAL_CSTRING("=") + convValue;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsFSURLEncoded::AddIsindex(const nsAString& aValue)
+FSURLEncoded::AddIsindex(const nsAString& aValue)
 {
   // Encode value
   nsCString convValue;
   nsresult rv = URLEncode(aValue, convValue);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Append data to string
   if (mQueryString.IsEmpty()) {
@@ -176,32 +176,32 @@ nsFSURLEncoded::AddIsindex(const nsAStri
   } else {
     mQueryString += NS_LITERAL_CSTRING("&isindex=") + convValue;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsFSURLEncoded::AddNameBlobOrNullPair(const nsAString& aName,
-                                      Blob* aBlob)
+FSURLEncoded::AddNameBlobOrNullPair(const nsAString& aName,
+                                    Blob* aBlob)
 {
   if (!mWarnedFileControl) {
     SendJSWarning(mDocument, "ForgotFileEnctypeWarning", nullptr, 0);
     mWarnedFileControl = true;
   }
 
   nsAutoString filename;
   RetrieveFileName(aBlob, filename);
   return AddNameValuePair(aName, filename);
 }
 
-static void
-HandleMailtoSubject(nsCString& aPath) {
-
+void
+HandleMailtoSubject(nsCString& aPath)
+{
   // Walk through the string and see if we have a subject already.
   bool hasSubject = false;
   bool hasParams = false;
   int32_t paramSep = aPath.FindChar('?');
   while (paramSep != kNotFound && paramSep < (int32_t)aPath.Length()) {
     hasParams = true;
 
     // Get the end of the name at the = op.  If it is *after* the next &,
@@ -256,18 +256,18 @@ HandleMailtoSubject(nsCString& aPath) {
     aPath.AppendLiteral("subject=");
     nsCString subjectStrEscaped;
     aPath.Append(NS_EscapeURL(NS_ConvertUTF16toUTF8(subjectStr), esc_Query,
                               subjectStrEscaped));
   }
 }
 
 nsresult
-nsFSURLEncoded::GetEncodedSubmission(nsIURI* aURI,
-                                     nsIInputStream** aPostDataStream)
+FSURLEncoded::GetEncodedSubmission(nsIURI* aURI,
+                                   nsIInputStream** aPostDataStream)
 {
   nsresult rv = NS_OK;
 
   *aPostDataStream = nullptr;
 
   if (mMethod == NS_FORM_METHOD_POST) {
 
     bool isMailto = false;
@@ -360,17 +360,17 @@ nsFSURLEncoded::GetEncodedSubmission(nsI
     }
   }
 
   return rv;
 }
 
 // i18n helper routines
 nsresult
-nsFSURLEncoded::URLEncode(const nsAString& aStr, nsACString& aEncoded)
+FSURLEncoded::URLEncode(const nsAString& aStr, nsACString& aEncoded)
 {
   // convert to CRLF breaks
   int32_t convertedBufLength = 0;
   char16_t* convertedBuf =
     nsLinebreakConverter::ConvertUnicharLineBreaks(aStr.BeginReading(),
                                                    nsLinebreakConverter::eLinebreakAny,
                                                    nsLinebreakConverter::eLinebreakNet,
                                                    aStr.Length(),
@@ -386,54 +386,56 @@ nsFSURLEncoded::URLEncode(const nsAStrin
 
   if (NS_WARN_IF(!NS_Escape(encodedBuf, aEncoded, url_XPAlphas))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
 }
 
+} // anonymous namespace
+
 // --------------------------------------------------------------------------
 
-nsFSMultipartFormData::nsFSMultipartFormData(const nsACString& aCharset,
-                                             nsIContent* aOriginatingElement)
-    : nsEncodingFormSubmission(aCharset, aOriginatingElement)
+FSMultipartFormData::FSMultipartFormData(const nsACString& aCharset,
+                                         nsIContent* aOriginatingElement)
+    : EncodingFormSubmission(aCharset, aOriginatingElement)
 {
   mPostDataStream =
     do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1");
   mTotalLength = 0;
 
   mBoundary.AssignLiteral("---------------------------");
   mBoundary.AppendInt(rand());
   mBoundary.AppendInt(rand());
   mBoundary.AppendInt(rand());
 }
 
-nsFSMultipartFormData::~nsFSMultipartFormData()
+FSMultipartFormData::~FSMultipartFormData()
 {
   NS_ASSERTION(mPostDataChunk.IsEmpty(), "Left unsubmitted data");
 }
 
 nsIInputStream*
-nsFSMultipartFormData::GetSubmissionBody(uint64_t* aContentLength)
+FSMultipartFormData::GetSubmissionBody(uint64_t* aContentLength)
 {
   // Finish data
   mPostDataChunk += NS_LITERAL_CSTRING("--") + mBoundary
                   + NS_LITERAL_CSTRING("--" CRLF);
 
   // Add final data input stream
   AddPostDataStream();
 
   *aContentLength = mTotalLength;
   return mPostDataStream;
 }
 
 nsresult
-nsFSMultipartFormData::AddNameValuePair(const nsAString& aName,
-                                        const nsAString& aValue)
+FSMultipartFormData::AddNameValuePair(const nsAString& aName,
+                                      const nsAString& aValue)
 {
   nsCString valueStr;
   nsAutoCString encodedVal;
   nsresult rv = EncodeVal(aValue, encodedVal, false);
   NS_ENSURE_SUCCESS(rv, rv);
 
   valueStr.Adopt(nsLinebreakConverter::
                  ConvertLineBreaks(encodedVal.get(),
@@ -454,18 +456,17 @@ nsFSMultipartFormData::AddNameValuePair(
                  + NS_LITERAL_CSTRING("Content-Disposition: form-data; name=\"")
                  + nameStr + NS_LITERAL_CSTRING("\"" CRLF CRLF)
                  + valueStr + NS_LITERAL_CSTRING(CRLF);
 
   return NS_OK;
 }
 
 nsresult
-nsFSMultipartFormData::AddNameBlobOrNullPair(const nsAString& aName,
-                                             Blob* aBlob)
+FSMultipartFormData::AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob)
 {
   // Encode the control name
   nsAutoCString nameStr;
   nsresult rv = EncodeVal(aName, nameStr, true);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString filename;
   nsAutoCString contentType;
@@ -558,18 +559,18 @@ nsFSMultipartFormData::AddNameBlobOrNull
 
   // CRLF after file
   mPostDataChunk.AppendLiteral(CRLF);
 
   return NS_OK;
 }
 
 nsresult
-nsFSMultipartFormData::GetEncodedSubmission(nsIURI* aURI,
-                                            nsIInputStream** aPostDataStream)
+FSMultipartFormData::GetEncodedSubmission(nsIURI* aURI,
+                                          nsIInputStream** aPostDataStream)
 {
   nsresult rv;
 
   // Make header
   nsCOMPtr<nsIMIMEInputStream> mimeStream
     = do_CreateInstance("@mozilla.org/network/mime-input-stream;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -581,17 +582,17 @@ nsFSMultipartFormData::GetEncodedSubmiss
   mimeStream->SetData(GetSubmissionBody(&unused));
 
   mimeStream.forget(aPostDataStream);
 
   return NS_OK;
 }
 
 nsresult
-nsFSMultipartFormData::AddPostDataStream()
+FSMultipartFormData::AddPostDataStream()
 {
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIInputStream> postDataChunkStream;
   rv = NS_NewCStringInputStream(getter_AddRefs(postDataChunkStream),
                                 mPostDataChunk);
   NS_ASSERTION(postDataChunkStream, "Could not open a stream for POST!");
   if (postDataChunkStream) {
@@ -601,62 +602,63 @@ nsFSMultipartFormData::AddPostDataStream
 
   mPostDataChunk.Truncate();
 
   return rv;
 }
 
 // --------------------------------------------------------------------------
 
-class nsFSTextPlain : public nsEncodingFormSubmission
+namespace {
+
+class FSTextPlain : public EncodingFormSubmission
 {
 public:
-  nsFSTextPlain(const nsACString& aCharset, nsIContent* aOriginatingElement)
-    : nsEncodingFormSubmission(aCharset, aOriginatingElement)
+  FSTextPlain(const nsACString& aCharset, nsIContent* aOriginatingElement)
+    : EncodingFormSubmission(aCharset, aOriginatingElement)
   {
   }
 
-  virtual nsresult AddNameValuePair(const nsAString& aName,
-                                    const nsAString& aValue) override;
-  virtual nsresult AddNameBlobOrNullPair(const nsAString& aName,
-                                         Blob* aBlob) override;
-  virtual nsresult GetEncodedSubmission(nsIURI* aURI,
-                                        nsIInputStream** aPostDataStream)
-                                                                       override;
+  virtual nsresult
+  AddNameValuePair(const nsAString& aName, const nsAString& aValue) override;
+
+  virtual nsresult
+  AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob) override;
+
+  virtual nsresult
+  GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override;
 
 private:
   nsString mBody;
 };
 
 nsresult
-nsFSTextPlain::AddNameValuePair(const nsAString& aName,
-                                const nsAString& aValue)
+FSTextPlain::AddNameValuePair(const nsAString& aName, const nsAString& aValue)
 {
   // XXX This won't work well with a name like "a=b" or "a\nb" but I suppose
   // text/plain doesn't care about that.  Parsers aren't built for escaped
   // values so we'll have to live with it.
   mBody.Append(aName + NS_LITERAL_STRING("=") + aValue +
                NS_LITERAL_STRING(CRLF));
 
   return NS_OK;
 }
 
 nsresult
-nsFSTextPlain::AddNameBlobOrNullPair(const nsAString& aName,
-                                     Blob* aBlob)
+FSTextPlain::AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob)
 {
   nsAutoString filename;
   RetrieveFileName(aBlob, filename);
   AddNameValuePair(aName, filename);
   return NS_OK;
 }
 
 nsresult
-nsFSTextPlain::GetEncodedSubmission(nsIURI* aURI,
-                                    nsIInputStream** aPostDataStream)
+FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
+                                  nsIInputStream** aPostDataStream)
 {
   nsresult rv = NS_OK;
 
   // XXX HACK We are using the standard URL mechanism to give the body to the
   // mailer instead of passing the post data stream to it, since that sounds
   // hard.
   bool isMailto = false;
   aURI->SchemeIs("mailto", &isMailto);
@@ -706,42 +708,44 @@ nsFSTextPlain::GetEncodedSubmission(nsIU
     mimeStream->SetAddContentLength(true);
     mimeStream->SetData(bodyStream);
     CallQueryInterface(mimeStream, aPostDataStream);
   }
 
   return rv;
 }
 
+} // anonymous namespace
+
 // --------------------------------------------------------------------------
 
-nsEncodingFormSubmission::nsEncodingFormSubmission(const nsACString& aCharset,
-                                                   nsIContent* aOriginatingElement)
-  : nsFormSubmission(aCharset, aOriginatingElement)
+EncodingFormSubmission::EncodingFormSubmission(const nsACString& aCharset,
+                                               nsIContent* aOriginatingElement)
+  : HTMLFormSubmission(aCharset, aOriginatingElement)
   , mEncoder(aCharset)
 {
   if (!(aCharset.EqualsLiteral("UTF-8") || aCharset.EqualsLiteral("gb18030"))) {
     NS_ConvertUTF8toUTF16 charsetUtf16(aCharset);
     const char16_t* charsetPtr = charsetUtf16.get();
     SendJSWarning(aOriginatingElement ? aOriginatingElement->GetOwnerDocument()
                                       : nullptr,
                   "CannotEncodeAllUnicode",
                   &charsetPtr,
                   1);
   }
 }
 
-nsEncodingFormSubmission::~nsEncodingFormSubmission()
+EncodingFormSubmission::~EncodingFormSubmission()
 {
 }
 
 // i18n helper routines
 nsresult
-nsEncodingFormSubmission::EncodeVal(const nsAString& aStr, nsCString& aOut,
-                                    bool aHeaderEncode)
+EncodingFormSubmission::EncodeVal(const nsAString& aStr, nsCString& aOut,
+                                  bool aHeaderEncode)
 {
   if (!mEncoder.Encode(aStr, aOut)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   if (aHeaderEncode) {
     aOut.Adopt(nsLinebreakConverter::
                ConvertLineBreaks(aOut.get(),
@@ -752,17 +756,19 @@ nsEncodingFormSubmission::EncodeVal(cons
   }
 
 
   return NS_OK;
 }
 
 // --------------------------------------------------------------------------
 
-static void
+namespace {
+
+void
 GetSubmitCharset(nsGenericHTMLElement* aForm,
                  nsACString& oCharset)
 {
   oCharset.AssignLiteral("UTF-8"); // default to utf-8
 
   nsAutoString acceptCharsetValue;
   aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::acceptcharset,
                  acceptCharsetValue);
@@ -788,30 +794,32 @@ GetSubmitCharset(nsGenericHTMLElement* a
   // if there are no accept-charset or all the charset are not supported
   // Get the charset from document
   nsIDocument* doc = aForm->GetComposedDoc();
   if (doc) {
     oCharset = doc->GetDocumentCharacterSet();
   }
 }
 
-static void
+void
 GetEnumAttr(nsGenericHTMLElement* aContent,
             nsIAtom* atom, int32_t* aValue)
 {
   const nsAttrValue* value = aContent->GetParsedAttr(atom);
   if (value && value->Type() == nsAttrValue::eEnum) {
     *aValue = value->GetEnumValue();
   }
 }
 
-nsresult
-GetSubmissionFromForm(nsGenericHTMLElement* aForm,
-                      nsGenericHTMLElement* aOriginatingElement,
-                      nsFormSubmission** aFormSubmission)
+} // anonymous namespace
+
+/* static */ nsresult
+HTMLFormSubmission::GetFromForm(nsGenericHTMLElement* aForm,
+                                nsGenericHTMLElement* aOriginatingElement,
+                                HTMLFormSubmission** aFormSubmission)
 {
   // Get all the information necessary to encode the form data
   NS_ASSERTION(aForm->GetComposedDoc(),
                "Should have doc if we're building submission!");
 
   // Get encoding type (default: urlencoded)
   int32_t enctype = NS_FORM_ENCTYPE_URLENCODED;
   if (aOriginatingElement &&
@@ -841,20 +849,20 @@ GetSubmissionFromForm(nsGenericHTMLEleme
   // MS IE/Opera).
   if (StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-16"))) {
     charset.AssignLiteral("UTF-8");
   }
 
   // Choose encoder
   if (method == NS_FORM_METHOD_POST &&
       enctype == NS_FORM_ENCTYPE_MULTIPART) {
-    *aFormSubmission = new nsFSMultipartFormData(charset, aOriginatingElement);
+    *aFormSubmission = new FSMultipartFormData(charset, aOriginatingElement);
   } else if (method == NS_FORM_METHOD_POST &&
              enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
-    *aFormSubmission = new nsFSTextPlain(charset, aOriginatingElement);
+    *aFormSubmission = new FSTextPlain(charset, aOriginatingElement);
   } else {
     nsIDocument* doc = aForm->OwnerDoc();
     if (enctype == NS_FORM_ENCTYPE_MULTIPART ||
         enctype == NS_FORM_ENCTYPE_TEXTPLAIN) {
       nsAutoString enctypeStr;
       if (aOriginatingElement &&
           aOriginatingElement->HasAttr(kNameSpaceID_None,
                                        nsGkAtoms::formenctype)) {
@@ -862,14 +870,17 @@ GetSubmissionFromForm(nsGenericHTMLEleme
                                      enctypeStr);
       } else {
         aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::enctype, enctypeStr);
       }
       const char16_t* enctypeStrPtr = enctypeStr.get();
       SendJSWarning(doc, "ForgotPostWarning",
                     &enctypeStrPtr, 1);
     }
-    *aFormSubmission = new nsFSURLEncoded(charset, method, doc,
-                                          aOriginatingElement);
+    *aFormSubmission = new FSURLEncoded(charset, method, doc,
+                                        aOriginatingElement);
   }
 
   return NS_OK;
 }
+
+} // dom namespace
+} // mozilla namespace
rename from dom/html/nsFormSubmission.h
rename to dom/html/HTMLFormSubmission.h
--- a/dom/html/nsFormSubmission.h
+++ b/dom/html/HTMLFormSubmission.h
@@ -1,64 +1,77 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
-#ifndef nsIFormSubmission_h___
-#define nsIFormSubmission_h___
+
+#ifndef mozilla_dom_HTMLFormSubmission_h
+#define mozilla_dom_HTMLFormSubmission_h
 
 #include "mozilla/Attributes.h"
-#include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
 #include "nsNCRFallbackEncoderWrapper.h"
+#include "nsString.h"
 
 class nsIURI;
 class nsIInputStream;
 class nsGenericHTMLElement;
 class nsIMultiplexInputStream;
 
 namespace mozilla {
 namespace dom {
+
 class Blob;
-} // namespace dom
-} // namespace mozilla
 
 /**
  * Class for form submissions; encompasses the function to call to submit as
  * well as the form submission name/value pairs
  */
-class nsFormSubmission
+class HTMLFormSubmission
 {
 public:
-  virtual ~nsFormSubmission()
+  /**
+   * Get a submission object based on attributes in the form (ENCTYPE and
+   * METHOD)
+   *
+   * @param aForm the form to get a submission object based on
+   * @param aOriginatingElement the originating element (can be null)
+   * @param aFormSubmission the form submission object (out param)
+   */
+  static nsresult
+  GetFromForm(nsGenericHTMLElement* aForm,
+              nsGenericHTMLElement* aOriginatingElement,
+              HTMLFormSubmission** aFormSubmission);
+
+  virtual ~HTMLFormSubmission()
   {
-    MOZ_COUNT_DTOR(nsFormSubmission);
+    MOZ_COUNT_DTOR(HTMLFormSubmission);
   }
 
   /**
    * Submit a name/value pair
    *
    * @param aName the name of the parameter
    * @param aValue the value of the parameter
    */
-  virtual nsresult AddNameValuePair(const nsAString& aName,
-                                    const nsAString& aValue) = 0;
+  virtual nsresult
+  AddNameValuePair(const nsAString& aName, const nsAString& aValue) = 0;
 
   /**
    * Submit a name/blob pair
    *
    * @param aName the name of the parameter
    * @param aBlob the blob to submit. The file's name will be used if the Blob
    * is actually a File, otherwise 'blob' string is used instead if the aBlob is
    * not null.
    */
-  virtual nsresult AddNameBlobOrNullPair(const nsAString& aName,
-                                         mozilla::dom::Blob* aBlob) = 0;
+  virtual nsresult
+  AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob) = 0;
 
   /**
    * Reports whether the instance supports AddIsindex().
    *
    * @return true if supported.
    */
   virtual bool SupportsIsindexSubmission()
   {
@@ -78,18 +91,18 @@ public:
 
   /**
    * Given a URI and the current submission, create the final URI and data
    * stream that will be submitted.  Subclasses *must* implement this.
    *
    * @param aURI the URI being submitted to [INOUT]
    * @param aPostDataStream a data stream for POST data [OUT]
    */
-  virtual nsresult GetEncodedSubmission(nsIURI* aURI,
-                                        nsIInputStream** aPostDataStream) = 0;
+  virtual nsresult
+  GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) = 0;
 
   /**
    * Get the charset that will be used for submission.
    */
   void GetCharset(nsACString& aCharset)
   {
     aCharset = mCharset;
   }
@@ -101,37 +114,38 @@ public:
 
 protected:
   /**
    * Can only be constructed by subclasses.
    *
    * @param aCharset the charset of the form as a string
    * @param aOriginatingElement the originating element (can be null)
    */
-  nsFormSubmission(const nsACString& aCharset, nsIContent* aOriginatingElement)
+  HTMLFormSubmission(const nsACString& aCharset,
+                     nsIContent* aOriginatingElement)
     : mCharset(aCharset)
     , mOriginatingElement(aOriginatingElement)
   {
-    MOZ_COUNT_CTOR(nsFormSubmission);
+    MOZ_COUNT_CTOR(HTMLFormSubmission);
   }
 
   // The name of the encoder charset
   nsCString mCharset;
 
   // Originating element.
   nsCOMPtr<nsIContent> mOriginatingElement;
 };
 
-class nsEncodingFormSubmission : public nsFormSubmission
+class EncodingFormSubmission : public HTMLFormSubmission
 {
 public:
-  nsEncodingFormSubmission(const nsACString& aCharset,
-                           nsIContent* aOriginatingElement);
+  EncodingFormSubmission(const nsACString& aCharset,
+                         nsIContent* aOriginatingElement);
 
-  virtual ~nsEncodingFormSubmission();
+  virtual ~EncodingFormSubmission();
 
   /**
    * Encode a Unicode string to bytes using the encoder (or just copy the input
    * if there is no encoder).
    * @param aStr the string to encode
    * @param aResult the encoded string [OUT]
    * @param aHeaderEncode If true, turns all linebreaks into spaces and escapes
    *                      all quotes
@@ -144,32 +158,34 @@ private:
   // The encoder that will encode Unicode names and values
   nsNCRFallbackEncoderWrapper mEncoder;
 };
 
 /**
  * Handle multipart/form-data encoding, which does files as well as normal
  * inputs.  This always does POST.
  */
-class nsFSMultipartFormData : public nsEncodingFormSubmission
+class FSMultipartFormData : public EncodingFormSubmission
 {
 public:
   /**
    * @param aCharset the charset of the form as a string
    */
-  nsFSMultipartFormData(const nsACString& aCharset,
-                        nsIContent* aOriginatingElement);
-  ~nsFSMultipartFormData();
+  FSMultipartFormData(const nsACString& aCharset,
+                      nsIContent* aOriginatingElement);
+  ~FSMultipartFormData();
  
-  virtual nsresult AddNameValuePair(const nsAString& aName,
-                                    const nsAString& aValue) override;
-  virtual nsresult AddNameBlobOrNullPair(const nsAString& aName,
-                                         mozilla::dom::Blob* aBlob) override;
-  virtual nsresult GetEncodedSubmission(nsIURI* aURI,
-                                        nsIInputStream** aPostDataStream) override;
+  virtual nsresult
+  AddNameValuePair(const nsAString& aName, const nsAString& aValue) override;
+
+  virtual nsresult
+  AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob) override;
+
+  virtual nsresult
+  GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override;
 
   void GetContentType(nsACString& aContentType)
   {
     aContentType =
       NS_LITERAL_CSTRING("multipart/form-data; boundary=") + mBoundary;
   }
 
   nsIInputStream* GetSubmissionBody(uint64_t* aContentLength);
@@ -206,20 +222,12 @@ private:
   nsCString mBoundary;
 
   /**
    * The total length in bytes of the streams that make up mPostDataStream
    */
   uint64_t mTotalLength;
 };
 
-/**
- * Get a submission object based on attributes in the form (ENCTYPE and METHOD)
- *
- * @param aForm the form to get a submission object based on
- * @param aOriginatingElement the originating element (can be null)
- * @param aFormSubmission the form submission object (out param)
- */
-nsresult GetSubmissionFromForm(nsGenericHTMLElement* aForm,
-                               nsGenericHTMLElement* aOriginatingElement,
-                               nsFormSubmission** aFormSubmission);
+} // namespace dom
+} // namespace mozilla
 
-#endif /* nsIFormSubmission_h___ */
+#endif /* mozilla_dom_HTMLFormSubmission_h */
rename from dom/html/nsFormSubmissionConstants.h
rename to dom/html/HTMLFormSubmissionConstants.h
--- a/dom/html/nsFormSubmissionConstants.h
+++ b/dom/html/HTMLFormSubmissionConstants.h
@@ -1,28 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-#ifndef nsFormSubmissionConstants_h__
-#define nsFormSubmissionConstants_h__
+#ifndef mozilla_dom_HTMLFormSubmissionConstants_h
+#define mozilla_dom_HTMLFormSubmissionConstants_h
+
+#include "nsIForm.h"
 
 static const nsAttrValue::EnumTable kFormMethodTable[] = {
   { "get", NS_FORM_METHOD_GET },
   { "post", NS_FORM_METHOD_POST },
   { 0 }
 };
+
 // Default method is 'get'.
 static const nsAttrValue::EnumTable* kFormDefaultMethod = &kFormMethodTable[0];
 
 static const nsAttrValue::EnumTable kFormEnctypeTable[] = {
   { "multipart/form-data", NS_FORM_ENCTYPE_MULTIPART },
   { "application/x-www-form-urlencoded", NS_FORM_ENCTYPE_URLENCODED },
   { "text/plain", NS_FORM_ENCTYPE_TEXTPLAIN },
   { 0 }
 };
+
 // Default method is 'application/x-www-form-urlencoded'.
 static const nsAttrValue::EnumTable* kFormDefaultEnctype = &kFormEnctypeTable[1];
 
-#endif // nsFormSubmissionConstants_h__
-
+#endif // mozilla_dom_HTMLFormSubmissionConstants_h
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -6,26 +6,28 @@
 
 #include "mozilla/dom/HTMLInputElement.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/dom/Date.h"
 #include "mozilla/dom/Directory.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/FileSystemUtils.h"
 #include "nsAttrValueInlines.h"
 #include "nsCRTGlue.h"
 
 #include "nsIDOMHTMLInputElement.h"
 #include "nsITextControlElement.h"
 #include "nsIDOMNSEditableElement.h"
 #include "nsIRadioVisitor.h"
 #include "nsIPhonetic.h"
 
+#include "HTMLFormSubmissionConstants.h"
 #include "mozilla/Telemetry.h"
 #include "nsIControllers.h"
 #include "nsIStringBundle.h"
 #include "nsFocusManager.h"
 #include "nsColorControlFrame.h"
 #include "nsNumberControlFrame.h"
 #include "nsPIDOMWindow.h"
 #include "nsRepeatService.h"
@@ -33,19 +35,16 @@
 #include "nsIComponentManager.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "mozilla/dom/ProgressEvent.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsIFormControl.h"
-#include "nsIForm.h"
-#include "nsFormSubmission.h"
-#include "nsFormSubmissionConstants.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsIFormControlFrame.h"
 #include "nsITextControlFrame.h"
 #include "nsIFrame.h"
 #include "nsRangeFrame.h"
 #include "nsIServiceManager.h"
 #include "nsError.h"
@@ -6177,17 +6176,17 @@ HTMLInputElement::Reset()
       return NS_OK;
     case VALUE_MODE_DEFAULT:
     default:
       return NS_OK;
   }
 }
 
 NS_IMETHODIMP
-HTMLInputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLInputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
 {
   // Disabled elements don't submit
   // For type=reset, and type=button, we just never submit, period.
   // For type=image and type=button, we only submit if we were the button
   // pressed
   // For type=radio and type=checkbox, we only submit if checked=true
   if (IsDisabled() || mType == NS_FORM_INPUT_RESET ||
       mType == NS_FORM_INPUT_BUTTON ||
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -149,17 +149,17 @@ public:
     return nsGenericHTMLElement::GetEditor(aEditor);
   }
 
   NS_IMETHOD SetUserInput(const nsAString& aInput) override;
 
   // Overriden nsIFormControl methods
   NS_IMETHOD_(uint32_t) GetType() const override { return mType; }
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   virtual bool RestoreState(nsPresState* aState) override;
   virtual bool AllowDrop() override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
   // nsIContent
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -1,25 +1,25 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "mozilla/EventStates.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/HTMLObjectElement.h"
 #include "mozilla/dom/HTMLObjectElementBinding.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "nsAttrValueInlines.h"
 #include "nsGkAtoms.h"
 #include "nsError.h"
 #include "nsIDocument.h"
 #include "nsIPluginDocument.h"
 #include "nsIDOMDocument.h"
-#include "nsFormSubmission.h"
 #include "nsIObjectFrame.h"
 #include "nsNPAPIPluginInstance.h"
 #include "nsIWidget.h"
 #include "nsContentUtils.h"
 #ifdef XP_MACOSX
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/dom/Event.h"
 #include "nsFocusManager.h"
@@ -402,17 +402,17 @@ HTMLObjectElement::GetDesiredIMEState()
 
 NS_IMETHODIMP
 HTMLObjectElement::Reset()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLObjectElement::SubmitNamesValues(nsFormSubmission *aFormSubmission)
+HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission)
 {
   nsAutoString name;
   if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
     // No name, don't submit.
 
     return NS_OK;
   }
 
--- a/dom/html/HTMLObjectElement.h
+++ b/dom/html/HTMLObjectElement.h
@@ -11,16 +11,18 @@
 #include "nsGenericHTMLElement.h"
 #include "nsObjectLoadingContent.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIConstraintValidation.h"
 
 namespace mozilla {
 namespace dom {
 
+class HTMLFormSubmission;
+
 class HTMLObjectElement final : public nsGenericHTMLFormElement
                               , public nsObjectLoadingContent
                               , public nsIDOMHTMLObjectElement
                               , public nsIConstraintValidation
 {
 public:
   explicit HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
@@ -65,17 +67,17 @@ public:
 
   // Overriden nsIFormControl methods
   NS_IMETHOD_(uint32_t) GetType() const override
   {
     return NS_FORM_OBJECT;
   }
 
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission *aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission *aFormSubmission) override;
 
   virtual bool IsDisabled() const override { return false; }
 
   virtual void DoneAddingChildren(bool aHaveNotified) override;
   virtual bool IsDoneAddingChildren() override;
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsIAtom *aAttribute,
--- a/dom/html/HTMLOptionsCollection.cpp
+++ b/dom/html/HTMLOptionsCollection.cpp
@@ -5,22 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/HTMLOptionsCollection.h"
 
 #include "HTMLOptGroupElement.h"
 #include "mozAutoDocUpdate.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/HTMLOptionElement.h"
 #include "mozilla/dom/HTMLOptionsCollectionBinding.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsError.h"
-#include "nsFormSubmission.h"
 #include "nsGkAtoms.h"
 #include "nsIComboboxControlFrame.h"
 #include "nsIDocument.h"
 #include "nsIDOMHTMLOptGroupElement.h"
 #include "nsIFormControlFrame.h"
 #include "nsIForm.h"
 #include "nsIFormProcessor.h"
 #include "nsIListControlFrame.h"
--- a/dom/html/HTMLOutputElement.cpp
+++ b/dom/html/HTMLOutputElement.cpp
@@ -4,20 +4,20 @@
  * 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 "mozilla/dom/HTMLOutputElement.h"
 
 #include "mozAutoDocUpdate.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/HTMLFormElement.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/HTMLOutputElementBinding.h"
 #include "nsContentUtils.h"
 #include "nsDOMTokenList.h"
-#include "nsFormSubmission.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output)
 
 namespace mozilla {
 namespace dom {
 
 HTMLOutputElement::HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                      FromParser aFromParser)
@@ -70,17 +70,17 @@ HTMLOutputElement::SetCustomValidity(con
 NS_IMETHODIMP
 HTMLOutputElement::Reset()
 {
   mValueModeFlag = eModeDefault;
   return nsContentUtils::SetNodeTextContent(this, mDefaultValue, true);
 }
 
 NS_IMETHODIMP
-HTMLOutputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLOutputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
 {
   // The output element is not submittable.
   return NS_OK;
 }
 
 bool
 HTMLOutputElement::ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
                                   const nsAString& aValue, nsAttrValue& aResult)
--- a/dom/html/HTMLOutputElement.h
+++ b/dom/html/HTMLOutputElement.h
@@ -10,33 +10,35 @@
 #include "mozilla/Attributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsStubMutationObserver.h"
 #include "nsIConstraintValidation.h"
 
 namespace mozilla {
 namespace dom {
 
+class HTMLFormSubmission;
+
 class HTMLOutputElement final : public nsGenericHTMLFormElement,
                                 public nsStubMutationObserver,
                                 public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
   explicit HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIFormControl
   NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_OUTPUT; }
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
 
   virtual bool IsDisabled() const override { return false; }
 
   nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
 
   bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
                         const nsAString& aValue, nsAttrValue& aResult) override;
 
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -7,24 +7,24 @@
 #include "mozilla/dom/HTMLSelectElement.h"
 
 #include "mozAutoDocUpdate.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/HTMLOptGroupElement.h"
 #include "mozilla/dom/HTMLOptionElement.h"
 #include "mozilla/dom/HTMLSelectElementBinding.h"
 #include "mozilla/dom/UnionTypes.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentList.h"
 #include "nsError.h"
-#include "nsFormSubmission.h"
 #include "nsGkAtoms.h"
 #include "nsIComboboxControlFrame.h"
 #include "nsIDocument.h"
 #include "nsIFormControlFrame.h"
 #include "nsIForm.h"
 #include "nsIFormProcessor.h"
 #include "nsIFrame.h"
 #include "nsIListControlFrame.h"
@@ -1651,17 +1651,17 @@ HTMLSelectElement::Reset()
   DispatchContentReset();
 
   return NS_OK;
 }
 
 static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
 
 NS_IMETHODIMP
-HTMLSelectElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLSelectElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
 {
   // Disabled elements don't submit
   if (IsDisabled()) {
     return NS_OK;
   }
 
   //
   // Get the name (if no name, no submit)
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -28,16 +28,17 @@ class nsPresState;
 
 namespace mozilla {
 
 class EventChainPostVisitor;
 class EventChainPreVisitor;
 
 namespace dom {
 
+class HTMLFormSubmission;
 class HTMLSelectElement;
 
 #define NS_SELECT_STATE_IID                        \
 { /* 4db54c7c-d159-455f-9d8e-f60ee466dbf3 */       \
   0x4db54c7c,                                      \
   0xd159,                                          \
   0x455f,                                          \
   {0x9d, 0x8e, 0xf6, 0x0e, 0xe4, 0x66, 0xdb, 0xf3} \
@@ -284,17 +285,17 @@ public:
   virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, int32_t* aTabIndex) override;
   virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
                                  bool aNotify) override;
   virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
 
   // Overriden nsIFormControl methods
   NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_SELECT; }
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   virtual bool RestoreState(nsPresState* aState) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
   EventStates IntrinsicState() const override;
 
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -4,26 +4,26 @@
  * 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 "mozilla/dom/HTMLTextAreaElement.h"
 
 #include "mozAutoDocUpdate.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/HTMLTextAreaElementBinding.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/MouseEvents.h"
 #include "nsAttrValueInlines.h"
 #include "nsContentCID.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsError.h"
 #include "nsFocusManager.h"
-#include "nsFormSubmission.h"
 #include "nsIComponentManager.h"
 #include "nsIConstraintValidation.h"
 #include "nsIControllers.h"
 #include "nsIDocument.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIFormControlFrame.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
@@ -1035,17 +1035,17 @@ HTMLTextAreaElement::Reset()
   rv = SetValue(resetVal);
   NS_ENSURE_SUCCESS(rv, rv);
 
   SetValueChanged(false);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLTextAreaElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLTextAreaElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
 {
   // Disabled elements don't submit
   if (IsDisabled()) {
     return NS_OK;
   }
 
   //
   // Get the name (if no name, no submit)
--- a/dom/html/HTMLTextAreaElement.h
+++ b/dom/html/HTMLTextAreaElement.h
@@ -16,30 +16,31 @@
 #include "nsStubMutationObserver.h"
 #include "nsIConstraintValidation.h"
 #include "mozilla/dom/HTMLFormElement.h"
 #include "mozilla/dom/HTMLInputElementBinding.h"
 #include "nsGkAtoms.h"
 
 #include "nsTextEditorState.h"
 
-class nsFormSubmission;
 class nsIControllers;
 class nsIDocument;
 class nsPresContext;
 class nsPresState;
 
 namespace mozilla {
 
 class EventChainPostVisitor;
 class EventChainPreVisitor;
 class EventStates;
 
 namespace dom {
 
+class HTMLFormSubmission;
+
 class HTMLTextAreaElement final : public nsGenericHTMLFormElementWithState,
                                   public nsIDOMHTMLTextAreaElement,
                                   public nsITextControlElement,
                                   public nsIDOMNSEditableElement,
                                   public nsStubMutationObserver,
                                   public nsIConstraintValidation
 {
 public:
@@ -67,17 +68,17 @@ public:
   {
     return nsGenericHTMLElement::GetEditor(aEditor);
   }
   NS_IMETHOD SetUserInput(const nsAString& aInput) override;
 
   // nsIFormControl
   NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_TEXTAREA; }
   NS_IMETHOD Reset() override;
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override;
+  NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   virtual bool RestoreState(nsPresState* aState) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
   virtual EventStates IntrinsicState() const override;
 
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -23,17 +23,16 @@ XPIDL_SOURCES += [
     'nsIImageDocument.idl',
     'nsIMenuBuilder.idl',
     'nsIPhonetic.idl',
 ]
 
 XPIDL_MODULE = 'content_html'
 
 EXPORTS += [
-    'nsFormSubmission.h',
     'nsGenericHTMLElement.h',
     'nsHTMLDNSPrefetch.h',
     'nsIConstraintValidation.h',
     'nsIForm.h',
     'nsIFormControl.h',
     'nsIFormProcessor.h',
     'nsIHTMLCollection.h',
     'nsIHTMLDocument.h',
@@ -56,16 +55,17 @@ EXPORTS.mozilla.dom += [
     'HTMLDataElement.h',
     'HTMLDataListElement.h',
     'HTMLDetailsElement.h',
     'HTMLDivElement.h',
     'HTMLFieldSetElement.h',
     'HTMLFontElement.h',
     'HTMLFormControlsCollection.h',
     'HTMLFormElement.h',
+    'HTMLFormSubmission.h',
     'HTMLFrameElement.h',
     'HTMLFrameSetElement.h',
     'HTMLHeadingElement.h',
     'HTMLHRElement.h',
     'HTMLIFrameElement.h',
     'HTMLImageElement.h',
     'HTMLInputElement.h',
     'HTMLLabelElement.h',
@@ -135,16 +135,17 @@ UNIFIED_SOURCES += [
     'HTMLDataListElement.cpp',
     'HTMLDetailsElement.cpp',
     'HTMLDivElement.cpp',
     'HTMLElement.cpp',
     'HTMLFieldSetElement.cpp',
     'HTMLFontElement.cpp',
     'HTMLFormControlsCollection.cpp',
     'HTMLFormElement.cpp',
+    'HTMLFormSubmission.cpp',
     'HTMLFrameElement.cpp',
     'HTMLFrameSetElement.cpp',
     'HTMLHeadingElement.cpp',
     'HTMLHRElement.cpp',
     'HTMLIFrameElement.cpp',
     'HTMLImageElement.cpp',
     'HTMLInputElement.cpp',
     'HTMLLabelElement.cpp',
@@ -190,17 +191,16 @@ UNIFIED_SOURCES += [
     'HTMLTrackElement.cpp',
     'HTMLUnknownElement.cpp',
     'HTMLVideoElement.cpp',
     'ImageDocument.cpp',
     'MediaDocument.cpp',
     'MediaError.cpp',
     'nsBrowserElement.cpp',
     'nsDOMStringMap.cpp',
-    'nsFormSubmission.cpp',
     'nsGenericHTMLElement.cpp',
     'nsGenericHTMLFrameElement.cpp',
     'nsHTMLContentSink.cpp',
     'nsHTMLDNSPrefetch.cpp',
     'nsHTMLDocument.cpp',
     'nsIConstraintValidation.cpp',
     'nsRadioVisitor.cpp',
     'nsTextEditorState.cpp',
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -333,17 +333,17 @@ nsGenericHTMLElement::GetOffsetRect(CSSI
   nsIFrame* frame = GetStyledFrame();
   if (!frame) {
     return nullptr;
   }
 
   nsIFrame* parent = frame->GetParent();
   nsPoint origin(0, 0);
 
-  if (parent && parent->GetType() == nsGkAtoms::tableOuterFrame &&
+  if (parent && parent->GetType() == nsGkAtoms::tableWrapperFrame &&
       frame->GetType() == nsGkAtoms::tableFrame) {
     origin = parent->GetPositionIgnoringScrolling();
     parent = parent->GetParent();
   }
 
   nsIContent* offsetParent = nullptr;
   Element* docElement = GetComposedDoc()->GetRootElement();
   nsIContent* content = frame->GetContent();
--- a/dom/html/nsIFormControl.h
+++ b/dom/html/nsIFormControl.h
@@ -6,22 +6,22 @@
 #ifndef nsIFormControl_h___
 #define nsIFormControl_h___
 
 #include "mozilla/EventForwards.h"
 #include "nsISupports.h"
 
 class nsIDOMHTMLFormElement;
 class nsPresState;
-class nsFormSubmission;
 
 namespace mozilla {
 namespace dom {
 class Element;
 class HTMLFieldSetElement;
+class HTMLFormSubmission;
 } // namespace dom
 } // namespace mozilla
 
 enum FormControlsTypes {
   NS_FORM_FIELDSET = 1,
   NS_FORM_OUTPUT,
   NS_FORM_SELECT,
   NS_FORM_TEXTAREA,
@@ -136,17 +136,18 @@ public:
   NS_IMETHOD Reset() = 0;
 
   /**
    * Tells the form control to submit its names and values to the form
    * submission object
    * @param aFormSubmission the form submission to notify of names/values/files
    *                       to submit
    */
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) = 0;
+  NS_IMETHOD
+  SubmitNamesValues(mozilla::dom::HTMLFormSubmission* aFormSubmission) = 0;
 
   /**
    * Save to presentation state.  The form control will determine whether it
    * has anything to save and if so, create an entry in the layout history for
    * its pres context.
    */
   NS_IMETHOD SaveState() = 0;
 
--- a/dom/media/omx/MediaOmxCommonDecoder.cpp
+++ b/dom/media/omx/MediaOmxCommonDecoder.cpp
@@ -220,23 +220,24 @@ MediaOmxCommonDecoder::ChangeState(PlayS
   status_t err = mAudioOffloadPlayer->ChangeState(aState);
   if (err != OK) {
     ResumeStateMachine();
     return;
   }
 }
 
 void
-MediaOmxCommonDecoder::CallSeek(const SeekTarget& aTarget)
+MediaOmxCommonDecoder::CallSeek(const SeekTarget& aTarget, dom::Promise* aPromise)
 {
   if (!mAudioOffloadPlayer) {
-    MediaDecoder::CallSeek(aTarget);
+    MediaDecoder::CallSeek(aTarget, aPromise);
     return;
   }
 
+  mSeekDOMPromise = aPromise;
   mSeekRequest.DisconnectIfExists();
   mSeekRequest.Begin(mAudioOffloadPlayer->Seek(aTarget)
     ->Then(AbstractThread::MainThread(), __func__, static_cast<MediaDecoder*>(this),
            &MediaDecoder::OnSeekResolved, &MediaDecoder::OnSeekRejected));
 }
 
 int64_t
 MediaOmxCommonDecoder::CurrentPosition()
--- a/dom/media/omx/MediaOmxCommonDecoder.h
+++ b/dom/media/omx/MediaOmxCommonDecoder.h
@@ -22,17 +22,17 @@ class MediaOmxCommonReader;
 class MediaOmxCommonDecoder : public MediaDecoder
 {
 public:
   explicit MediaOmxCommonDecoder(MediaDecoderOwner* aOwner);
 
   void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
                         MediaDecoderEventVisibility aEventVisibility) override;
   void ChangeState(PlayState aState) override;
-  void CallSeek(const SeekTarget& aTarget) override;
+  void CallSeek(const SeekTarget& aTarget, dom::Promise* aPromise) override;
   void SetVolume(double aVolume) override;
   int64_t CurrentPosition() override;
   MediaDecoderOwner::NextFrameStatus NextFrameStatus() override;
   void SetElementVisibility(bool aIsVisible) override;
   void SetPlatformCanOffloadAudio(bool aCanOffloadAudio) override;
   void AddOutputStream(ProcessedMediaStream* aStream,
                        bool aFinishWhenEnded) override;
   void SetPlaybackRate(double aPlaybackRate) override;
--- a/dom/presentation/Presentation.cpp
+++ b/dom/presentation/Presentation.cpp
@@ -1,14 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 <ctype.h>
 #include "mozilla/dom/PresentationBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIDocShell.h"
 #include "nsIPresentationService.h"
 #include "nsServiceManagerUtils.h"
 #include "Presentation.h"
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -1355,17 +1355,17 @@ class MOZ_STACK_CLASS OriginParser final
     return false;
   }
 
   typedef nsCCharSeparatedTokenizerTemplate<IgnoreWhitespace> Tokenizer;
 
   enum SchemaType {
     eNone,
     eFile,
-    eMozSafeAbout
+    eAbout
   };
 
   enum State {
     eExpectingAppIdOrSchema,
     eExpectingInMozBrowser,
     eExpectingSchema,
     eExpectingEmptyToken1,
     eExpectingEmptyToken2,
@@ -6623,17 +6623,17 @@ OriginParser::Parse(nsACString& aSpec, P
       spec.Append(mPathnameComponents[index]);
     }
 
     aSpec = spec;
 
     return true;
   }
 
-  if (mSchemaType == eMozSafeAbout) {
+  if (mSchemaType == eAbout) {
     spec.Append(':');
   } else {
     spec.AppendLiteral("://");
   }
 
   spec.Append(mHost);
 
   if (!mPort.IsNull()) {
@@ -6647,29 +6647,30 @@ OriginParser::Parse(nsACString& aSpec, P
 }
 
 void
 OriginParser::HandleSchema(const nsDependentCSubstring& aToken)
 {
   MOZ_ASSERT(!aToken.IsEmpty());
   MOZ_ASSERT(mState == eExpectingAppIdOrSchema || mState == eExpectingSchema);
 
-  bool isMozSafeAbout = false;
+  bool isAbout = false;
   bool isFile = false;
   if (aToken.EqualsLiteral("http") ||
       aToken.EqualsLiteral("https") ||
-      (isMozSafeAbout = aToken.EqualsLiteral("moz-safe-about")) ||
+      (isAbout = aToken.EqualsLiteral("about") ||
+                 aToken.EqualsLiteral("moz-safe-about")) ||
       aToken.EqualsLiteral("indexeddb") ||
       (isFile = aToken.EqualsLiteral("file")) ||
       aToken.EqualsLiteral("app") ||
       aToken.EqualsLiteral("resource")) {
     mSchema = aToken;
 
-    if (isMozSafeAbout) {
-      mSchemaType = eMozSafeAbout;
+    if (isAbout) {
+      mSchemaType = eAbout;
       mState = eExpectingHost;
     } else {
       if (isFile) {
         mSchemaType = eFile;
       }
       mState = eExpectingEmptyToken1;
     }
 
--- a/dom/system/gonk/moz.build
+++ b/dom/system/gonk/moz.build
@@ -123,16 +123,18 @@ if CONFIG['MOZ_B2G_RIL']:
             'DataCallInterfaceService.js',
             'DataCallInterfaceService.manifest',
             'RadioInterfaceLayer.js',
             'RadioInterfaceLayer.manifest',
         ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
+DEFINES['HAVE_ANDROID_OS'] = True
+
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/bluetooth/common',
     '/dom/geolocation',
     '/dom/wifi',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -1030,25 +1030,25 @@ var interfaceNamesInGlobalScope =
     "SimpleGestureEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "SimpleTest", xbl: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "SourceBuffer",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "SourceBufferList",
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "SpeechSynthesisErrorEvent", android: false, nightly: true},
-// IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "SpeechSynthesisEvent", android: false, nightly: true},
-// IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "SpeechSynthesis", android: false, nightly: true},
-// IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "SpeechSynthesisUtterance", android: false, nightly: true},
-// IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "SpeechSynthesisVoice", android: false, nightly: true},
+    {name: "SpeechSynthesisErrorEvent", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+    {name: "SpeechSynthesisEvent", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+    {name: "SpeechSynthesis", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+    {name: "SpeechSynthesisUtterance", android: false},
+// IMPORTANT: Do not change this list without review from a DOM peer!
+    {name: "SpeechSynthesisVoice", android: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "SpecialPowers", xbl: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "StereoPannerNode",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "Storage",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "StorageEvent",
--- a/editor/libeditor/nsHTMLEditor.h
+++ b/editor/libeditor/nsHTMLEditor.h
@@ -43,17 +43,17 @@
 
 class nsDocumentFragment;
 class nsIDOMKeyEvent;
 class nsITransferable;
 class nsIClipboard;
 class TypeInState;
 class nsIContentFilter;
 class nsILinkHandler;
-class nsTableOuterFrame;
+class nsTableWrapperFrame;
 class nsIDOMRange;
 class nsRange;
 struct PropItem;
 
 namespace mozilla {
 template<class T> class OwningNonNull;
 namespace dom {
 class DocumentFragment;
@@ -449,18 +449,18 @@ protected:
 
   // Move all contents from aCellToMerge into aTargetCell (append at end)
   NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, bool aDeleteCellToMerge);
 
   nsresult DeleteTable2(nsIDOMElement* aTable, Selection* aSelection);
   NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan);
   NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan);
 
-  // Helper used to get nsTableOuterFrame for a table.
-  nsTableOuterFrame* GetTableFrame(nsIDOMElement* aTable);
+  // Helper used to get nsTableWrapperFrame for a table.
+  nsTableWrapperFrame* GetTableFrame(nsIDOMElement* aTable);
   // Needed to do appropriate deleting when last cell or row is about to be deleted
   // This doesn't count cells that don't start in the given row (are spanning from row above)
   int32_t  GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIndex);
   // Test if all cells in row or column at given index are selected
   bool AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns);
   bool AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows);
 
   bool IsEmptyCell(Element* aCell);
--- a/editor/libeditor/nsTableEditor.cpp
+++ b/editor/libeditor/nsTableEditor.cpp
@@ -31,17 +31,17 @@
 #include "nsITableCellLayout.h" // For efficient access to table cell
 #include "nsITableEditor.h"
 #include "nsLiteralString.h"
 #include "nsQueryFrame.h"
 #include "nsRange.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsTableCellFrame.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 #include "nscore.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 /***************************************************************************
  * stack based helper class for restoring selection after table edit
@@ -2573,17 +2573,17 @@ nsHTMLEditor::GetCellIndexes(nsIDOMEleme
   nsIFrame *layoutObject = nodeAsContent->GetPrimaryFrame();
   NS_ENSURE_TRUE(layoutObject, NS_ERROR_FAILURE);
 
   nsITableCellLayout *cellLayoutObject = do_QueryFrame(layoutObject);
   NS_ENSURE_TRUE(cellLayoutObject, NS_ERROR_FAILURE);
   return cellLayoutObject->GetCellIndexes(*aRowIndex, *aColIndex);
 }
 
-nsTableOuterFrame*
+nsTableWrapperFrame*
 nsHTMLEditor::GetTableFrame(nsIDOMElement* aTable)
 {
   NS_ENSURE_TRUE(aTable, nullptr);
 
   nsCOMPtr<nsIContent> nodeAsContent( do_QueryInterface(aTable) );
   NS_ENSURE_TRUE(nodeAsContent, nullptr);
   return do_QueryFrame(nodeAsContent->GetPrimaryFrame());
 }
@@ -2632,17 +2632,17 @@ nsHTMLEditor::GetTableSize(nsIDOMElement
   *aRowCount = 0;
   *aColCount = 0;
   nsCOMPtr<nsIDOMElement> table;
   // Get the selected talbe or the table enclosing the selection anchor
   res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), aTable, getter_AddRefs(table));
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
 
-  nsTableOuterFrame* tableFrame = GetTableFrame(table.get());
+  nsTableWrapperFrame* tableFrame = GetTableFrame(table.get());
   NS_ENSURE_TRUE(tableFrame, NS_ERROR_FAILURE);
 
   *aRowCount = tableFrame->GetRowCount();
   *aColCount = tableFrame->GetColCount();
 
   return NS_OK;
 }
 
@@ -2681,17 +2681,17 @@ nsHTMLEditor::GetCellDataAt(nsIDOMElemen
     res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), nullptr, getter_AddRefs(table));
     NS_ENSURE_SUCCESS(res, res);
     if (table)
       aTable = table;
     else
       return NS_ERROR_FAILURE;
   }
 
-  nsTableOuterFrame* tableFrame = GetTableFrame(aTable);
+  nsTableWrapperFrame* tableFrame = GetTableFrame(aTable);
   NS_ENSURE_TRUE(tableFrame, NS_ERROR_FAILURE);
 
   nsTableCellFrame* cellFrame =
     tableFrame->GetCellFrameAt(aRowIndex, aColIndex);
   if (!cellFrame)
     return NS_ERROR_FAILURE;
 
   *aIsSelected = cellFrame->IsSelected();
@@ -2719,17 +2719,17 @@ nsHTMLEditor::GetCellAt(nsIDOMElement* a
     // Get the selected table or the table enclosing the selection anchor
     nsCOMPtr<nsIDOMElement> table;
     nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), nullptr, getter_AddRefs(table));
     NS_ENSURE_SUCCESS(res, res);
     NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
     aTable = table;
   }
 
-  nsTableOuterFrame* tableFrame = GetTableFrame(aTable);
+  nsTableWrapperFrame* tableFrame = GetTableFrame(aTable);
   if (!tableFrame) {
     *aCell = nullptr;
     return NS_EDITOR_ELEMENT_NOT_FOUND;
   }
 
   nsCOMPtr<nsIDOMElement> domCell =
     do_QueryInterface(tableFrame->GetCellAt(aRowIndex, aColIndex));
   domCell.forget(aCell);
@@ -2737,17 +2737,17 @@ nsHTMLEditor::GetCellAt(nsIDOMElement* a
   return NS_OK;
 }
 
 // When all you want are the rowspan and colspan (not exposed in nsITableEditor)
 NS_IMETHODIMP
 nsHTMLEditor::GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
                              int32_t& aActualRowSpan, int32_t& aActualColSpan)
 {
-  nsTableOuterFrame* tableFrame = GetTableFrame(aTable);
+  nsTableWrapperFrame* tableFrame = GetTableFrame(aTable);
   if (!tableFrame)
     return NS_ERROR_FAILURE;
 
   aActualRowSpan = tableFrame->GetEffectiveRowSpanAt(aRowIndex, aColIndex);
   aActualColSpan = tableFrame->GetEffectiveColSpanAt(aRowIndex, aColIndex);
 
   return NS_OK;
 }
--- a/gfx/thebes/PrintTarget.cpp
+++ b/gfx/thebes/PrintTarget.cpp
@@ -47,33 +47,59 @@ PrintTarget::~PrintTarget()
 
 already_AddRefed<DrawTarget>
 PrintTarget::MakeDrawTarget(const IntSize& aSize,
                             DrawEventRecorder* aRecorder)
 {
   MOZ_ASSERT(mCairoSurface,
              "We shouldn't have been constructed without a cairo surface");
 
-  MOZ_ASSERT(!aRecorder,
-             "aRecorder should only be passed to an instance of "
-             "PrintTargetRecording");
-
   if (cairo_surface_status(mCairoSurface)) {
     return nullptr;
   }
 
   // Note than aSize may not be the same as mSize (the size of mCairoSurface).
   // See the comments in our header.  If the sizes are different a clip will
   // be applied to mCairoSurface.
   RefPtr<DrawTarget> dt =
     Factory::CreateDrawTargetForCairoSurface(mCairoSurface, aSize);
   if (!dt || !dt->IsValid()) {
     return nullptr;
   }
 
+  if (aRecorder) {
+    dt = CreateRecordingDrawTarget(aRecorder, dt);
+    if (!dt || !dt->IsValid()) {
+      return nullptr;
+    }
+  }
+
+  return dt.forget();
+}
+
+already_AddRefed<DrawTarget>
+PrintTarget::CreateRecordingDrawTarget(DrawEventRecorder* aRecorder,
+                                       DrawTarget* aDrawTarget)
+{
+  MOZ_ASSERT(aRecorder);
+  MOZ_ASSERT(aDrawTarget);
+
+  RefPtr<DrawTarget> dt;
+
+  if (aRecorder) {
+    // It doesn't really matter what we pass as the DrawTarget here.
+    dt = gfx::Factory::CreateRecordingDrawTarget(aRecorder, aDrawTarget);
+  }
+
+  if (!dt || !dt->IsValid()) {
+    gfxCriticalNote
+      << "Failed to create a recording DrawTarget for PrintTarget";
+    return nullptr;
+  }
+
   return dt.forget();
 }
 
 void
 PrintTarget::Finish()
 {
   if (mIsFinished) {
     return;
--- a/gfx/thebes/PrintTarget.h
+++ b/gfx/thebes/PrintTarget.h
@@ -94,16 +94,18 @@ public:
    * is the only platform where we get passed an aRecorder.  Probably the
    * issue is that we get called more than once with a different aRecorder, so
    * storing one recording DrawTarget for our lifetime doesn't currently work.
    *
    * XXX Could we pass aRecorder to our subclass's CreateOrNull factory methods?
    * We'd need to check that our consumers always pass the same aRecorder for
    * our entire lifetime.
    *
+   * XXX Once PrintTargetThebes is removed this can become non-virtual.
+   *
    * XXX In the long run, this class and its sub-classes should be converted to
    * use STL classes and mozilla::RefCounted<> so the can be moved to Moz2D.
    *
    * TODO: Consider adding a SetDPI method that calls
    * cairo_surface_set_fallback_resolution.
    */
   virtual already_AddRefed<DrawTarget>
   MakeDrawTarget(const IntSize& aSize,
@@ -112,16 +114,20 @@ public:
 protected:
 
   // Only created via subclass's constructors
   explicit PrintTarget(cairo_surface_t* aCairoSurface, const IntSize& aSize);
 
   // Protected because we're refcounted
   virtual ~PrintTarget();
 
+  already_AddRefed<DrawTarget>
+  CreateRecordingDrawTarget(DrawEventRecorder* aRecorder,
+                            DrawTarget* aDrawTarget);
+
   cairo_surface_t* mCairoSurface;
   IntSize mSize;
   bool mIsFinished;
 };
 
 } // namespace gfx
 } // namespace mozilla
 
new file mode 100644
--- /dev/null
+++ b/gfx/thebes/PrintTargetThebes.cpp
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 20; 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/. */
+
+#include "PrintTargetThebes.h"
+
+#include "gfxASurface.h"
+#include "gfxPlatform.h"
+#include "mozilla/gfx/Logging.h"
+
+namespace mozilla {
+namespace gfx {
+
+/* static */ already_AddRefed<PrintTargetThebes>
+PrintTargetThebes::CreateOrNull(gfxASurface* aSurface)
+{
+  MOZ_ASSERT(aSurface);
+
+  if (!aSurface || aSurface->CairoStatus()) {
+    return nullptr;
+  }
+
+  RefPtr<PrintTargetThebes> target = new PrintTargetThebes(aSurface);
+
+  return target.forget();
+}
+
+PrintTargetThebes::PrintTargetThebes(gfxASurface* aSurface)
+  : PrintTarget(nullptr, aSurface->GetSize())
+  , mGfxSurface(aSurface)
+{
+}
+
+already_AddRefed<DrawTarget>
+PrintTargetThebes::MakeDrawTarget(const IntSize& aSize,
+                                  DrawEventRecorder* aRecorder)
+{
+  RefPtr<gfx::DrawTarget> dt =
+    gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(mGfxSurface, aSize);
+  if (!dt || !dt->IsValid()) {
+    return nullptr;
+  }
+
+  if (aRecorder) {
+    dt = CreateRecordingDrawTarget(aRecorder, dt);
+    if (!dt || !dt->IsValid()) {
+      return nullptr;
+    }
+  }
+
+  return dt.forget();
+}
+
+nsresult
+PrintTargetThebes::BeginPrinting(const nsAString& aTitle,
+                                 const nsAString& aPrintToFileName)
+{
+  return mGfxSurface->BeginPrinting(aTitle, aPrintToFileName);
+}
+
+nsresult
+PrintTargetThebes::EndPrinting()
+{
+  return mGfxSurface->EndPrinting();
+}
+
+nsresult
+PrintTargetThebes::AbortPrinting()
+{
+  return mGfxSurface->AbortPrinting();
+}
+
+nsresult
+PrintTargetThebes::BeginPage()
+{
+  return mGfxSurface->BeginPage();
+}
+
+nsresult
+PrintTargetThebes::EndPage()
+{
+  return mGfxSurface->EndPage();
+}
+
+void
+PrintTargetThebes::Finish()
+{
+  return mGfxSurface->Finish();
+}
+
+} // namespace gfx
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/gfx/thebes/PrintTargetThebes.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 20; 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/. */
+
+#ifndef MOZILLA_GFX_PRINTTARGETTHEBES_H
+#define MOZILLA_GFX_PRINTTARGETTHEBES_H
+
+#include "mozilla/gfx/PrintTarget.h"
+
+class gfxASurface;
+
+namespace mozilla {
+namespace gfx {
+
+/**
+ * XXX Remove this class.
+ *
+ * This class should go away once all the logic from the gfxASurface subclasses
+ * has been moved to new PrintTarget subclasses and we no longer need to
+ * wrap a gfxASurface.
+ *
+ * When removing this class, be sure to make PrintTarget::MakeDrawTarget
+ * non-virtual!
+ */
+class PrintTargetThebes final : public PrintTarget {
+public:
+
+  static already_AddRefed<PrintTargetThebes>
+  CreateOrNull(gfxASurface* aSurface);
+
+  virtual nsresult BeginPrinting(const nsAString& aTitle,
+                                 const nsAString& aPrintToFileName) override;
+  virtual nsresult EndPrinting() override;
+  virtual nsresult AbortPrinting() override;
+  virtual nsresult BeginPage() override;
+  virtual nsresult EndPage() override;
+  virtual void Finish() override;
+
+  virtual already_AddRefed<DrawTarget>
+  MakeDrawTarget(const IntSize& aSize,
+                 DrawEventRecorder* aRecorder = nullptr) override;
+
+private:
+
+  // Only created via CreateOrNull
+  explicit PrintTargetThebes(gfxASurface* aSurface);
+
+  RefPtr<gfxASurface> mGfxSurface;
+};
+
+} // namespace gfx
+} // namespace mozilla
+
+#endif /* MOZILLA_GFX_PRINTTARGETTHEBES_H */
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -348,16 +348,46 @@ gfxASurface::CairoStatus()
 /* static */
 int32_t
 gfxASurface::FormatStrideForWidth(gfxImageFormat format, int32_t width)
 {
     cairo_format_t cformat = GfxFormatToCairoFormat(format);
     return cairo_format_stride_for_width(cformat, (int)width);
 }
 
+nsresult
+gfxASurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName)
+{
+    return NS_OK;
+}
+
+nsresult
+gfxASurface::EndPrinting()
+{
+    return NS_OK;
+}
+
+nsresult
+gfxASurface::AbortPrinting()
+{
+    return NS_OK;
+}
+
+nsresult
+gfxASurface::BeginPage()
+{
+    return NS_OK;
+}
+
+nsresult
+gfxASurface::EndPage()
+{
+    return NS_OK;
+}
+
 gfxContentType
 gfxASurface::ContentFromFormat(gfxImageFormat format)
 {
     switch (format) {
         case SurfaceFormat::A8R8G8B8_UINT32:
             return gfxContentType::COLOR_ALPHA;
         case SurfaceFormat::X8R8G8B8_UINT32:
         case SurfaceFormat::R5G6B5_UINT16:
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -59,16 +59,23 @@ public:
 
     void SetDeviceOffset(const gfxPoint& offset);
     gfxPoint GetDeviceOffset() const;
 
     void Flush() const;
     void MarkDirty();
     void MarkDirty(const gfxRect& r);
 
+    /* Printing backend functions */
+    virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
+    virtual nsresult EndPrinting();
+    virtual nsresult AbortPrinting();
+    virtual nsresult BeginPage();
+    virtual nsresult EndPage();
+
     void SetData(const cairo_user_data_key_t *key,
                  void *user_data,
                  thebes_destroy_func_t destroy);
     void *GetData(const cairo_user_data_key_t *key);
 
     virtual void Finish();
 
     /**
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -765,33 +765,42 @@ public:
           MonitorAutoLock lock(mVsyncEnabledLock);
           if (!mVsyncEnabled) {
             mVsyncTask = nullptr;
             return;
           }
         }
 
         TimeStamp lastVsync = TimeStamp::Now();
+        bool useSoftware = false;
+
         // Wait until the video sync counter reaches the next value by waiting
         // until the parity of the counter value changes.
         unsigned int nextSync = syncCounter + 1;
-        if (gl::sGLXLibrary.xWaitVideoSync(2, nextSync % 2,
-                                           &syncCounter) == 0) {
-          if (syncCounter == (nextSync - 1)) {
-            gfxWarning() << "GLX sync counter failed to increment after glXWaitVideoSync!\n";
-            // If we failed to block until the next sync, fallback to software.
-            double remaining = (1000.f / 60.f) -
-                               (TimeStamp::Now() - lastVsync).ToMilliseconds();
-            if (remaining > 0) {
-              PlatformThread::Sleep(remaining);
-            }
+        int status;
+        if ((status = gl::sGLXLibrary.xWaitVideoSync(2, nextSync % 2, &syncCounter)) != 0) {
+          gfxWarningOnce() << "glXWaitVideoSync returned " << status;
+          useSoftware = true;
+        }
+
+        if (syncCounter == (nextSync - 1)) {
+          gfxWarningOnce() << "glXWaitVideoSync failed to increment the sync counter.";
+          useSoftware = true;
+        }
+
+        if (useSoftware) {
+          double remaining = (1000.f / 60.f) -
+            (TimeStamp::Now() - lastVsync).ToMilliseconds();
+          if (remaining > 0) {
+            PlatformThread::Sleep(remaining);
           }
-          lastVsync = TimeStamp::Now();
-          NotifyVsync(lastVsync);
         }
+
+        lastVsync = TimeStamp::Now();
+        NotifyVsync(lastVsync);
       }
     }
 
     void Cleanup() {
       MOZ_ASSERT(!NS_IsMainThread());
 
       mGLContext = nullptr;
       XCloseDisplay(mXDisplay);
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -135,17 +135,17 @@ private:
   DECL_GFX_PREF(Live, "apz.allow_checkerboarding",             APZAllowCheckerboarding, bool, true);
   DECL_GFX_PREF(Live, "apz.allow_immediate_handoff",           APZAllowImmediateHandoff, bool, true);
   DECL_GFX_PREF(Live, "apz.allow_zooming",                     APZAllowZooming, bool, false);
   DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle",          APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
   DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold",      APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
   DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle",        APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
   DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle",              APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
   DECL_GFX_PREF(Live, "apz.axis_lock.mode",                    APZAxisLockMode, int32_t, 0);
-  DECL_GFX_PREF(Live, "apz.content_response_timeout",          APZContentResponseTimeout, int32_t, 300);
+  DECL_GFX_PREF(Live, "apz.content_response_timeout",          APZContentResponseTimeout, int32_t, 400);
   DECL_GFX_PREF(Live, "apz.danger_zone_x",                     APZDangerZoneX, int32_t, 50);
   DECL_GFX_PREF(Live, "apz.danger_zone_y",                     APZDangerZoneY, int32_t, 100);
   DECL_GFX_PREF(Live, "apz.disable_for_scroll_linked_effects", APZDisableForScrollLinkedEffects, bool, false);
   DECL_GFX_PREF(Live, "apz.displayport_expiry_ms",             APZDisplayPortExpiryTime, uint32_t, 15000);
   DECL_GFX_PREF(Live, "apz.drag.enabled",                      APZDragEnabled, bool, false);
   DECL_GFX_PREF(Live, "apz.enlarge_displayport_when_clipped",  APZEnlargeDisplayPortWhenClipped, bool, false);
   DECL_GFX_PREF(Live, "apz.fling_accel_base_mult",             APZFlingAccelBaseMultiplier, float, 1.0f);
   DECL_GFX_PREF(Live, "apz.fling_accel_interval_ms",           APZFlingAccelInterval, int32_t, 500);
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -47,17 +47,17 @@ EXPORTS += [
     'gfxUtils.h',
     'RoundedRect.h',
     'SoftwareVsyncSource.h',
     'VsyncSource.h',
 ]
 
 EXPORTS.mozilla.gfx += [
     'PrintTarget.h',
-    'PrintTargetRecording.h',
+    'PrintTargetThebes.h',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     EXPORTS += [
         'gfxAndroidPlatform.h',
         'gfxFT2FontBase.h',
         'gfxFT2Fonts.h',
     ]
@@ -214,17 +214,17 @@ SOURCES += [
     # on X11, gfxDrawable.cpp includes X headers for an old workaround which
     # we could consider removing soon (affects Ubuntus older than 10.04 LTS)
     # which currently prevent it from joining UNIFIED_SOURCES.
     'gfxDrawable.cpp',
     # gfxPlatform.cpp includes mac system header conflicting with point/size
     'gfxPlatform.cpp',
     'gfxPrefs.cpp',
     'PrintTarget.cpp',
-    'PrintTargetRecording.cpp',
+    'PrintTargetThebes.cpp',
 ]
 
 UNIFIED_SOURCES += [
     'CJKCompatSVS.cpp',
     'gfxAlphaRecovery.cpp',
     'gfxBaseSharedMemorySurface.cpp',
     'gfxBlur.cpp',
     'gfxContext.cpp',
--- a/hal/gonk/GonkFMRadio.cpp
+++ b/hal/gonk/GonkFMRadio.cpp
@@ -24,20 +24,20 @@
 #include <fcntl.h>
 #include <linux/videodev2.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/epoll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
-
 /* Bionic might not have the newer version of the v4l2 headers that
  * define these controls, so we define them here if they're not found.
  */
+
 #ifndef V4L2_CTRL_CLASS_FM_RX
 #define V4L2_CTRL_CLASS_FM_RX 0x00a10000
 #define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
 #define V4L2_CID_TUNE_DEEMPHASIS  (V4L2_CID_FM_RX_CLASS_BASE + 1)
 #define V4L2_DEEMPHASIS_DISABLED  0
 #define V4L2_DEEMPHASIS_50_uS     1
 #define V4L2_DEEMPHASIS_75_uS     2
 #define V4L2_CID_RDS_RECEPTION    (V4L2_CID_FM_RX_CLASS_BASE + 2)
@@ -55,16 +55,30 @@ struct v4l2_rds_data {
 #define V4L2_RDS_BLOCK_C 2
 #define V4L2_RDS_BLOCK_D 3
 #define V4L2_RDS_BLOCK_C_ALT 4
 #define V4L2_RDS_BLOCK_INVALID 7
 #define V4L2_RDS_BLOCK_CORRECTED 0x40
 #define V4L2_RDS_BLOCK_ERROR 0x80
 #endif
 
+#ifndef VIDIOC_S_HW_FREQ_SEEK
+struct v4l2_hw_freq_seek {
+ __u32 tuner;
+ __u32 type;
+ __u32 seek_upward;
+ __u32 wrap_around;
+ __u32 spacing;
+ __u32 rangelow;
+ __u32 rangehigh;
+ __u32 reserved[5];
+};
+#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
+#endif
+
 namespace mozilla {
 namespace hal_impl {
 
 uint32_t GetFMRadioFrequency();
 
 static int sRadioFD;
 static bool sRadioEnabled;
 static bool sRDSEnabled;
@@ -258,17 +272,17 @@ runMsmFMRadio(void *)
       break;
     }
 
     /* The tavarua driver reports a number of things asynchronously.
      * In those cases, the status update comes from this thread. */
     for (unsigned int i = 0; i < buffer.bytesused; i++) {
       switch (buf[i]) {
       case TAVARUA_EVT_RADIO_READY:
-        // The driver sends RADIO_READY both when we turn the radio on and when we turn 
+        // The driver sends RADIO_READY both when we turn the radio on and when we turn
         // the radio off.
         if (sRadioEnabled) {
           NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_ENABLE,
                                                   hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
         }
         break;
 
       case TAVARUA_EVT_SEEK_COMPLETE:
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -130,16 +130,18 @@ if os_linux:
         'src/base/time_posix.cc',
     ]
     if CONFIG['OS_TARGET'] == 'Android':
         UNIFIED_SOURCES += [
             'src/base/message_pump_android.cc',
         ]
         DEFINES['ANDROID'] = True
         DEFINES['_POSIX_MONOTONIC_CLOCK'] = 0
+        if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+            DEFINES['HAVE_ANDROID_OS'] = True
 
 if os_bsd or os_linux:
     if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
         SOURCES += [
             'src/base/message_pump_glib.cc',
         ]
     if CONFIG['MOZ_ENABLE_QT']:
         SOURCES += [
--- a/js/src/asmjs/WasmStubs.cpp
+++ b/js/src/asmjs/WasmStubs.cpp
@@ -342,24 +342,38 @@ FillArgumentArray(MacroAssembler& masm, 
 #ifdef JS_CODEGEN_REGISTER_PAIR
           case ABIArg::GPR_PAIR:
             MOZ_CRASH("AsmJS uses hardfp for function calls.");
             break;
 #endif
           case ABIArg::FPU: {
             MOZ_ASSERT(IsFloatingPointType(type));
             FloatRegister srcReg = i->fpu();
-            if (toValue) {
-                if (type == MIRType::Float32) {
-                    masm.convertFloat32ToDouble(i->fpu(), ScratchDoubleReg);
+            if (type == MIRType::Double) {
+                if (toValue) {
+                    // Preserve the NaN pattern in the input.
+                    masm.moveDouble(srcReg, ScratchDoubleReg);
                     srcReg = ScratchDoubleReg;
+                    masm.canonicalizeDouble(srcReg);
                 }
-                masm.canonicalizeDouble(srcReg);
+                masm.storeDouble(srcReg, dstAddr);
+            } else {
+                MOZ_ASSERT(type == MIRType::Float32);
+                if (toValue) {
+                    // JS::Values can't store Float32, so convert to a Double.
+                    masm.convertFloat32ToDouble(srcReg, ScratchDoubleReg);
+                    masm.canonicalizeDouble(ScratchDoubleReg);
+                    masm.storeDouble(ScratchDoubleReg, dstAddr);
+                } else {
+                    // Preserve the NaN pattern in the input.
+                    masm.moveFloat32(srcReg, ScratchFloat32Reg);
+                    masm.canonicalizeFloat(ScratchFloat32Reg);
+                    masm.storeFloat32(ScratchFloat32Reg, dstAddr);
+                }
             }
-            masm.storeDouble(srcReg, dstAddr);
             break;
           }
           case ABIArg::Stack:
             if (type == MIRType::Int32) {
                 Address src(masm.getStackPointer(), offsetToCallerStackArgs + i->offsetFromArgBase());
                 masm.load32(src, scratch);
                 if (toValue)
                     masm.storeValue(JSVAL_TYPE_INT32, scratch, dstAddr);
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -1939,16 +1939,18 @@ SetJitCompilerOption(JSContext* cx, unsi
     }
 
     if (!args[1].isInt32()) {
         ReportUsageError(cx, callee, "Second argument must be an Int32.");
         return false;
     }
 
     JSFlatString* strArg = JS_FlattenString(cx, args[0].toString());
+    if (!strArg)
+        return false;
 
 #define JIT_COMPILER_MATCH(key, string)                 \
     else if (JS_FlatStringEqualsAscii(strArg, string))  \
         opt = JSJITCOMPILER_ ## key;
 
     JSJitCompilerOption opt = JSJITCOMPILER_NOT_AN_OPTION;
     if (false) {}
     JIT_COMPILER_OPTIONS(JIT_COMPILER_MATCH);
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug1278839.js
@@ -0,0 +1,4 @@
+if (!('oomTest' in this))
+    quit();
+for (var i=0; i<2; i++)
+    oomTest(() => eval("setJitCompilerOption(eval + Function, 0);"));
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -977,17 +977,17 @@ JSContext::currentlyRunning() const
     }
 
     return false;
 }
 
 static bool
 ComputeIsJITBroken()
 {
-#if !defined(ANDROID) || defined(GONK)
+#if !defined(ANDROID)
     return false;
 #else  // ANDROID
     if (getenv("JS_IGNORE_JIT_BROKENNESS")) {
         return false;
     }
 
     std::string line;
 
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -77,39 +77,20 @@ MOZ_DEFAULT_COMPILER
 if test -z "$JS_STANDALONE"; then
   autoconfmk=autoconf-js.mk
   #DIST is exported from top-level configure
 else
   DIST="$MOZ_BUILD_ROOT/dist"
 fi
 AC_SUBST(autoconfmk)
 
-if test -n "$gonkdir" ; then
-    kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
-    dnl Default to ICS
-    ANDROID_VERSION=15
-    if test -n "${PLATFORM_SDK_VERSION}"; then
-        ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
-    fi
-
-    STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
-    STLPORT_LIBS="-lstlport"
+MOZ_ANDROID_NDK
 
-    CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic $CPPFLAGS -I$gonkdir/external/valgrind/fxos-include"
-    CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS"
-    CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
-    LIBS="$LIBS $STLPORT_LIBS"
-
-    dnl Add -llog by default, since we use it all over the place.
+if test -n "$gonkdir" ; then
     LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
-
-    AC_DEFINE(ANDROID)
-    AC_DEFINE(GONK)
-else
-    MOZ_ANDROID_NDK
 fi
 
 case "$target" in
 *-apple-darwin*)
     MOZ_IOS_SDK
     ;;
 esac
 
--- a/layout/base/GeometryUtils.cpp
+++ b/layout/base/GeometryUtils.cpp
@@ -182,17 +182,17 @@ public:
     }
   }
 
   virtual void AddBox(nsIFrame* aFrame) override
   {
     nsIFrame* f = aFrame;
     if (mBoxType == CSSBoxType::Margin &&
         f->GetType() == nsGkAtoms::tableFrame) {
-      // Margin boxes for table frames should be taken from the outer table
+      // Margin boxes for table frames should be taken from the table wrapper
       // frame, since that has the margin.
       f = f->GetParent();
     }
     nsRect box = GetBoxRectForFrame(&f, mBoxType);
     nsPoint appUnits[4] =
       { box.TopLeft(), box.TopRight(), box.BottomRight(), box.BottomLeft() };
     CSSPoint points[4];
     for (uint32_t i = 0; i < 4; ++i) {
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -394,18 +394,19 @@ ApplyRenderingChangeToTree(nsPresContext
   gInApplyRenderingChangeToTree = false;
 #endif
 }
 
 bool
 RestyleManager::RecomputePosition(nsIFrame* aFrame)
 {
   // Don't process position changes on table frames, since we already handle
-  // the dynamic position change on the outer table frame, and the reflow-based
-  // fallback code path also ignores positions on inner table frames.
+  // the dynamic position change on the table wrapper frame, and the
+  // reflow-based fallback code path also ignores positions on inner table
+  // frames.
   if (aFrame->GetType() == nsGkAtoms::tableFrame) {
     return true;
   }
 
   const nsStyleDisplay* display = aFrame->StyleDisplay();
   // Changes to the offsets of a non-positioned element can safely be ignored.
   if (display->mPosition == NS_STYLE_POSITION_STATIC) {
     return true;
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -612,19 +612,19 @@ public:
   };
   ElementRestyler(const ElementRestyler& aParentRestyler,
                   nsIFrame* aFrame,
                   uint32_t aConstructorFlags);
 
   // Construct for a frame whose parent is being restyled, but whose
   // style context is the parent style context for its parent frame.
   // (This is only used for table frames, whose style contexts are used
-  // as the parent style context for their outer table frame (table
-  // wrapper frame).  We should probably try to get rid of this
-  // exception and have the inheritance go the other way.)
+  // as the parent style context for their table wrapper frame. We should
+  // probably try to get rid of this exception and have the inheritance go
+  // the other way.)
   enum ParentContextFromChildFrame { PARENT_CONTEXT_FROM_CHILD_FRAME };
   ElementRestyler(ParentContextFromChildFrame,
                   const ElementRestyler& aParentFrameRestyler,
                   nsIFrame* aFrame);
 
   // For restyling undisplayed content only (mFrame==null).
   ElementRestyler(nsPresContext* aPresContext,
                   nsIContent* aContent,
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -86,17 +86,17 @@
 #include "nsFieldSetFrame.h"
 #include "nsInlineFrame.h"
 #include "nsBlockFrame.h"
 #include "nsCanvasFrame.h"
 #include "nsFirstLetterFrame.h"
 #include "nsGfxScrollFrame.h"
 #include "nsPageFrame.h"
 #include "nsSimplePageSequenceFrame.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsBackdropFrame.h"
 #include "nsTransitionManager.h"
 #include "DetailsFrame.h"
 
 #ifdef MOZ_XUL
 #include "nsIRootBox.h"
 #endif
@@ -1109,17 +1109,17 @@ nsFrameConstructorState::GetGeometricPar
   // brought to you by the letter T: tables, since other roots don't
   // even call into this code.  See bug 178855.
   //
   // XXX Disabling positioning in this case is a hack.  If one was so inclined,
   // one could support this either by (1) inserting a dummy block between the
   // table and the canvas or (2) teaching the canvas how to reflow positioned
   // elements. (1) has the usual problems when multiple frames share the same
   // content (notice all the special cases in this file dealing with inner
-  // tables and outer tables which share the same content). (2) requires some
+  // tables and table wrappers which share the same content). (2) requires some
   // work and possible factoring.
   //
   // XXXbz couldn't we just force position to "static" on roots and
   // float to "none"?  That's OK per CSS 2.1, as far as I can tell.
 
   if (aContentParentFrame && aContentParentFrame->IsSVGText()) {
     return aContentParentFrame;
   }
@@ -1914,38 +1914,38 @@ nsCSSFrameConstructor::CreateGeneratedCo
 
 /****************************************************
  **  BEGIN TABLE SECTION
  ****************************************************/
 
 // The term pseudo frame is being used instead of anonymous frame, since anonymous
 // frame has been used elsewhere to refer to frames that have generated content
 
-// Return whether the given frame is a table pseudo-frame.  Note that
+// Return whether the given frame is a table pseudo-frame. Note that
 // cell-content and table-outer frames have pseudo-types, but are always
 // created, even for non-anonymous cells and tables respectively.  So for those
 // we have to examine the cell or table frame to see whether it's a pseudo
-// frame.  In particular, a lone table caption will have an outer table as its
+// frame. In particular, a lone table caption will have a table wrapper as its
 // parent, but will also trigger construction of an empty inner table, which
-// will be the one we can examine to see whether the outer was a pseudo-frame.
+// will be the one we can examine to see whether the wrapper was a pseudo-frame.
 static bool
 IsTablePseudo(nsIFrame* aFrame)
 {
   nsIAtom* pseudoType = aFrame->StyleContext()->GetPseudo();
   return pseudoType &&
     (pseudoType == nsCSSAnonBoxes::table ||
      pseudoType == nsCSSAnonBoxes::inlineTable ||
      pseudoType == nsCSSAnonBoxes::tableColGroup ||
      pseudoType == nsCSSAnonBoxes::tableRowGroup ||
      pseudoType == nsCSSAnonBoxes::tableRow ||
      pseudoType == nsCSSAnonBoxes::tableCell ||
      (pseudoType == nsCSSAnonBoxes::cellContent &&
       aFrame->GetParent()->StyleContext()->GetPseudo() ==
         nsCSSAnonBoxes::tableCell) ||
-     (pseudoType == nsCSSAnonBoxes::tableOuter &&
+     (pseudoType == nsCSSAnonBoxes::tableWrapper &&
       (aFrame->PrincipalChildList().FirstChild()->StyleContext()->GetPseudo() ==
          nsCSSAnonBoxes::table ||
        aFrame->PrincipalChildList().FirstChild()->StyleContext()->GetPseudo() ==
          nsCSSAnonBoxes::inlineTable)));
 }
 
 static bool
 IsRubyPseudo(nsIFrame* aFrame)
@@ -2064,33 +2064,33 @@ nsCSSFrameConstructor::ConstructTable(ns
   NS_PRECONDITION(aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE ||
                   aDisplay->mDisplay == NS_STYLE_DISPLAY_INLINE_TABLE,
                   "Unexpected call");
 
   nsIContent* const content = aItem.mContent;
   nsStyleContext* const styleContext = aItem.mStyleContext;
   const uint32_t nameSpaceID = aItem.mNameSpaceID;
 
-  // create the pseudo SC for the outer table as a child of the inner SC
+  // create the pseudo SC for the table wrapper as a child of the inner SC
   RefPtr<nsStyleContext> outerStyleContext;
   outerStyleContext = mPresShell->StyleSet()->
-    ResolveAnonymousBoxStyle(nsCSSAnonBoxes::tableOuter, styleContext);
-
-  // Create the outer table frame which holds the caption and inner table frame
+    ResolveAnonymousBoxStyle(nsCSSAnonBoxes::tableWrapper, styleContext);
+
+  // Create the table wrapper frame which holds the caption and inner table frame
   nsContainerFrame* newFrame;
   if (kNameSpaceID_MathML == nameSpaceID)
     newFrame = NS_NewMathMLmtableOuterFrame(mPresShell, outerStyleContext);
   else
-    newFrame = NS_NewTableOuterFrame(mPresShell, outerStyleContext);
+    newFrame = NS_NewTableWrapperFrame(mPresShell, outerStyleContext);
 
   nsContainerFrame* geometricParent =
     aState.GetGeometricParent(outerStyleContext->StyleDisplay(),
                               aParentFrame);
 
-  // Init the table outer frame
+  // Init the table wrapper frame
   InitAndRestoreFrame(aState, content, geometricParent, newFrame);
 
   // Create the inner table frame
   nsContainerFrame* innerFrame;
   if (kNameSpaceID_MathML == nameSpaceID)
     innerFrame = NS_NewMathMLmtableFrame(mPresShell, styleContext);
   else
     innerFrame = NS_NewTableFrame(mPresShell, styleContext);
@@ -2132,17 +2132,17 @@ nsCSSFrameConstructor::ConstructTable(ns
   }
 
   nsFrameItems captionItems;
   PullOutCaptionFrames(childItems, captionItems);
 
   // Set the inner table frame's initial primary list
   innerFrame->SetInitialChildList(kPrincipalList, childItems);
 
-  // Set the outer table frame's secondary childlist lists
+  // Set the table wrapper frame's secondary childlist lists
   if (captionItems.NotEmpty()) {
     newFrame->SetInitialChildList(nsIFrame::kCaptionList, captionItems);
   }
 
   return newFrame;
 }
 
 static void
@@ -2718,44 +2718,44 @@ nsCSSFrameConstructor::SetUpDocElementCo
     how the root frame hierarchy should look
 
   Galley presentation, non-XUL, with scrolling:
 
       ViewportFrame [fixed-cb]
         nsHTMLScrollFrame
           nsCanvasFrame [abs-cb]
             root element frame (nsBlockFrame, nsSVGOuterSVGFrame,
-                                nsTableOuterFrame, nsPlaceholderFrame)
+                                nsTableWrapperFrame, nsPlaceholderFrame)
 
   Galley presentation, XUL
 
       ViewportFrame [fixed-cb]
         nsRootBoxFrame
           root element frame (nsDocElementBoxFrame)
 
   Print presentation, non-XUL
 
       ViewportFrame
         nsSimplePageSequenceFrame
           nsPageFrame
             nsPageContentFrame [fixed-cb]
               nsCanvasFrame [abs-cb]
                 root element frame (nsBlockFrame, nsSVGOuterSVGFrame,
-                                    nsTableOuterFrame, nsPlaceholderFrame)
+                                    nsTableWrapperFrame, nsPlaceholderFrame)
 
   Print-preview presentation, non-XUL
 
       ViewportFrame
         nsHTMLScrollFrame
           nsSimplePageSequenceFrame
             nsPageFrame
               nsPageContentFrame [fixed-cb]
                 nsCanvasFrame [abs-cb]
                   root element frame (nsBlockFrame, nsSVGOuterSVGFrame,
-                                      nsTableOuterFrame, nsPlaceholderFrame)
+                                      nsTableWrapperFrame, nsPlaceholderFrame)
 
   Print/print preview of XUL is not supported.
   [fixed-cb]: the default containing block for fixed-pos content
   [abs-cb]: the default containing block for abs-pos content
 
   Meaning of nsCSSFrameConstructor fields:
     mRootElementFrame is "root element frame".  This is the primary frame for
       the root element.
@@ -6161,21 +6161,21 @@ nsCSSFrameConstructor::GetAbsoluteContai
     }
     // Only first continuations can be containing blocks.
     absPosCBCandidate = absPosCBCandidate->FirstContinuation();
     // Is the frame really an absolute container?
     if (!absPosCBCandidate->IsAbsoluteContainer()) {
       continue;
     }
 
-    // For tables, skip the inner frame and consider the outer table frame.
+    // For tables, skip the inner frame and consider the table wrapper frame.
     if (type == nsGkAtoms::tableFrame) {
       continue;
     }
-    // For outer table frames, we can just return absPosCBCandidate.
+    // For table wrapper frames, we can just return absPosCBCandidate.
     MOZ_ASSERT((nsContainerFrame*)do_QueryFrame(absPosCBCandidate),
                "abs.pos. containing block must be nsContainerFrame sub-class");
     return static_cast<nsContainerFrame*>(absPosCBCandidate);
   }
 
   MOZ_ASSERT(aType != FIXED_POS, "no ICB in this frame tree?");
 
   // It is possible for the search for the containing block to fail, because
@@ -6654,17 +6654,17 @@ nsCSSFrameConstructor::FindNextSibling(F
 }
 
 // For fieldsets, returns the area frame, if the child is not a legend.
 static nsContainerFrame*
 GetAdjustedParentFrame(nsContainerFrame* aParentFrame,
                        nsIAtom*          aParentFrameType,
                        nsIContent*       aChildContent)
 {
-  NS_PRECONDITION(nsGkAtoms::tableOuterFrame != aParentFrameType,
+  NS_PRECONDITION(nsGkAtoms::tableWrapperFrame != aParentFrameType,
                   "Shouldn't be happening!");
 
   nsContainerFrame* newParent = nullptr;
 
   if (nsGkAtoms::fieldSetFrame == aParentFrameType) {
     // If the parent is a fieldSet, use the fieldSet's area frame as the
     // parent unless the new content is a legend.
     if (!aChildContent->IsHTMLElement(nsGkAtoms::legend)) {
@@ -7411,18 +7411,18 @@ nsCSSFrameConstructor::ContentAppended(n
     // Invalidate now instead of before the WipeContainingBlock call, just in
     // case we do wipe; in that case we don't need to do this walk at all.
     // XXXbz does that matter?  Would it make more sense to save some virtual
     // GetChildAt calls instead and do this during construction of our
     // FrameConstructionItemList?
     InvalidateCanvasIfNeeded(mPresShell, child);
   }
 
-  // if the container is a table and a caption was appended, it needs to be put
-  // in the outer table frame's additional child list.
+  // If the container is a table and a caption was appended, it needs to be put
+  // in the table wrapper frame's additional child list.
   nsFrameItems captionItems;
   if (nsGkAtoms::tableFrame == frameType) {
     // Pull out the captions.  Note that we don't want to do that as we go,
     // because processing a single caption can add a whole bunch of things to
     // the frame items due to pseudoframe processing.  So we'd have to pull
     // captions from a list anyway; might as well do that here.
     // XXXbz this is no longer true; we could pull captions directly out of the
     // FrameConstructionItemList now.
@@ -7434,17 +7434,17 @@ nsCSSFrameConstructor::ContentAppended(n
     // first-line frame. Look at them and see...
     AppendFirstLineFrames(state, containingBlock->GetContent(),
                           containingBlock, frameItems);
   }
 
   // Notify the parent frame passing it the list of new frames
   // Append the flowed frames to the principal child list; captions
   // need special treatment
-  if (captionItems.NotEmpty()) { // append the caption to the outer table
+  if (captionItems.NotEmpty()) { // append the caption to the table wrapper
     NS_ASSERTION(nsGkAtoms::tableFrame == frameType, "how did that happen?");
     nsContainerFrame* outerTable = parentFrame->GetParent();
     AppendFrames(outerTable, nsIFrame::kCaptionList, captionItems);
   }
 
   if (frameItems.NotEmpty()) { // append the in-flow kids
     AppendFramesToParent(state, parentFrame, frameItems, prevSibling);
   }
@@ -7936,44 +7936,44 @@ nsCSSFrameConstructor::ContentRangeInser
   if (WipeContainingBlock(state, containingBlock, insertion.mParentFrame, items,
                           isAppend, prevSibling)) {
     LAYOUT_PHASE_TEMP_REENTER();
     return NS_OK;
   }
   LAYOUT_PHASE_TEMP_REENTER();
 
   // If the container is a table and a caption will be appended, it needs to be
-  // put in the outer table frame's additional child list.
+  // put in the table wrapper frame's additional child list.
   // We make no attempt here to set flags to indicate whether the list
   // will be at the start or end of a block. It doesn't seem worthwhile.
   nsFrameItems frameItems, captionItems;
   ConstructFramesFromItemList(state, items, insertion.mParentFrame, frameItems);
 
   if (frameItems.NotEmpty()) {
     for (nsIContent* child = aStartChild;
          child != aEndChild;
          child = child->GetNextSibling()){
       InvalidateCanvasIfNeeded(mPresShell, child);
     }
 
     if (nsGkAtoms::tableFrame == frameType ||
-        nsGkAtoms::tableOuterFrame == frameType) {
+        nsGkAtoms::tableWrapperFrame == frameType) {
       PullOutCaptionFrames(frameItems, captionItems);
     }
   }
 
   // If the parent of our current prevSibling is different from the frame we'll
   // actually use as the parent, then the calculated insertion point is now
   // invalid and as it is unknown where to insert correctly we append instead
   // (bug 341858).
   // This can affect our prevSibling and isAppend, but should not have any
   // effect on the WipeContainingBlock above, since this should only happen
   // when neither parent is a ib-split frame and should not affect whitespace
   // handling inside table-related frames (and in fact, can only happen when
-  // one of the parents is an outer table and one is an inner table or when the
+  // one of the parents is a table wrapper and one is an inner table or when the
   // parent is a fieldset or fieldset content frame).  So it won't affect the
   // {ib} or XUL box cases in WipeContainingBlock(), and the table pseudo
   // handling will only be affected by us maybe thinking we're not inserting
   // at the beginning, whereas we really are.  That would have made us reframe
   // unnecessarily, but that's ok.
   // XXXbz we should push our frame construction item code up higher, so we
   // know what our items are by the time we start figuring out previous
   // siblings
@@ -7981,18 +7981,18 @@ nsCSSFrameConstructor::ContentRangeInser
       frameItems.FirstChild()->GetParent() != prevSibling->GetParent()) {
 #ifdef DEBUG
     nsIFrame* frame1 = frameItems.FirstChild()->GetParent();
     nsIFrame* frame2 = prevSibling->GetParent();
     NS_ASSERTION(!IsFramePartOfIBSplit(frame1) &&
                  !IsFramePartOfIBSplit(frame2),
                  "Neither should be ib-split");
     NS_ASSERTION((frame1->GetType() == nsGkAtoms::tableFrame &&
-                  frame2->GetType() == nsGkAtoms::tableOuterFrame) ||
-                 (frame1->GetType() == nsGkAtoms::tableOuterFrame &&
+                  frame2->GetType() == nsGkAtoms::tableWrapperFrame) ||
+                 (frame1->GetType() == nsGkAtoms::tableWrapperFrame &&
                   frame2->GetType() == nsGkAtoms::tableFrame) ||
                  frame1->GetType() == nsGkAtoms::fieldSetFrame ||
                  (frame1->GetParent() &&
                   frame1->GetParent()->GetType() == nsGkAtoms::fieldSetFrame),
                  "Unexpected frame types");
 #endif
     isAppend = true;
     nsIFrame* appendAfterFrame;
@@ -8017,20 +8017,20 @@ nsCSSFrameConstructor::ContentRangeInser
       // here to make no sense without anyone noticing...  If it ever stops
       // being a no-op, vet them carefully!
       InsertFirstLineFrames(state, container, containingBlock, &insertion.mParentFrame,
                             prevSibling, frameItems);
     }
   }
 
   // We might have captions; put them into the caption list of the
-  // outer table frame.
+  // table wrapper frame.
   if (captionItems.NotEmpty()) {
     NS_ASSERTION(nsGkAtoms::tableFrame == frameType ||
-                 nsGkAtoms::tableOuterFrame == frameType,
+                 nsGkAtoms::tableWrapperFrame == frameType,
                  "parent for caption is not table?");
     // We need to determine where to put the caption items; start with the
     // the parent frame that has already been determined and get the insertion
     // prevsibling of the first caption item.
     bool captionIsAppend;
     nsIFrame* captionPrevSibling = nullptr;
 
     // aIsRangeInsertSafe is ignored on purpose because it is irrelevant here.
@@ -8050,22 +8050,22 @@ nsCSSFrameConstructor::ContentRangeInser
                                 &captionIsAppend, &ignored,
                                 aStartChild, aEndChild);
     }
 
     nsContainerFrame* outerTable = nullptr;
     if (GetCaptionAdjustedParent(captionInsertion.mParentFrame,
                                  captionItems.FirstChild(),
                                  &outerTable)) {
-      // If the parent is not an outer table frame we will try to add frames
-      // to a named child list that the parent does not honour and the frames
-      // will get lost
-      NS_ASSERTION(nsGkAtoms::tableOuterFrame == outerTable->GetType(),
+      // If the parent is not a table wrapper frame we will try to add frames
+      // to a named child list that the parent does not honor and the frames
+      // will get lost.
+      NS_ASSERTION(nsGkAtoms::tableWrapperFrame == outerTable->GetType(),
                    "Pseudo frame construction failure; "
-                   "a caption can be only a child of an outer table frame");
+                   "a caption can be only a child of a table wrapper frame");
 
       // If the parent of our current prevSibling is different from the frame
       // we'll actually use as the parent, then the calculated insertion
       // point is now invalid (bug 341382).
       if (captionPrevSibling &&
           captionPrevSibling->GetParent() != outerTable) {
           captionPrevSibling = nullptr;
       }
@@ -8684,34 +8684,34 @@ void nsCSSFrameConstructor::GetAlternate
 nsIFrame*
 nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell*     aPresShell,
                                                        nsPresContext*    aPresContext,
                                                        nsIFrame*         aFrame,
                                                        nsContainerFrame* aParentFrame,
                                                        nsIContent*       aContent,
                                                        nsStyleContext*   aStyleContext)
 {
-  nsTableOuterFrame* newFrame = NS_NewTableOuterFrame(aPresShell, aStyleContext);
+  nsTableWrapperFrame* newFrame = NS_NewTableWrapperFrame(aPresShell, aStyleContext);
 
   newFrame->Init(aContent, aParentFrame, aFrame);
 
   // Create a continuing inner table frame, and if there's a caption then
   // replicate the caption
   nsFrameItems  newChildFrames;
 
   nsIFrame* childFrame = aFrame->PrincipalChildList().FirstChild();
   if (childFrame) {
     nsIFrame* continuingTableFrame =
       CreateContinuingFrame(aPresContext, childFrame, newFrame);
     newChildFrames.AddChild(continuingTableFrame);
 
     NS_ASSERTION(!childFrame->GetNextSibling(),"there can be only one inner table frame");
   }
 
-  // Set the outer table's initial child list
+  // Set the table wrapper's initial child list
   newFrame->SetInitialChildList(kPrincipalList, newChildFrames);
 
   return newFrame;
 }
 
 nsIFrame*
 nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell*     aPresShell,
                                                   nsIFrame*         aFrame,
@@ -8816,17 +8816,17 @@ nsCSSFrameConstructor::CreateContinuingF
   } else if (nsGkAtoms::columnSetFrame == frameType) {
     MOZ_ASSERT(!aFrame->IsTableCaption(),
                "no support for fragmenting table captions yet");
     newFrame = NS_NewColumnSetFrame(shell, styleContext, nsFrameState(0));
     newFrame->Init(content, aParentFrame, aFrame);
   } else if (nsGkAtoms::pageFrame == frameType) {
     nsContainerFrame* canvasFrame;
     newFrame = ConstructPageFrame(shell, aParentFrame, aFrame, canvasFrame);
-  } else if (nsGkAtoms::tableOuterFrame == frameType) {
+  } else if (nsGkAtoms::tableWrapperFrame == frameType) {
     newFrame =
       CreateContinuingOuterTableFrame(shell, aPresContext, aFrame, aParentFrame,
                                       content, styleContext);
 
   } else if (nsGkAtoms::tableFrame == frameType) {
     newFrame =
       CreateContinuingTableFrame(shell, aFrame, aParentFrame,
                                  content, styleContext);
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -462,17 +462,17 @@ private:
   nsresult AppendFramesToParent(nsFrameConstructorState&       aState,
                                 nsContainerFrame*              aParentFrame,
                                 nsFrameItems&                  aFrameList,
                                 nsIFrame*                      aPrevSibling,
                                 bool                           aIsRecursiveCall = false);
 
   // BEGIN TABLE SECTION
   /**
-   * Construct an outer table frame.  This is the FrameConstructionData
+   * Construct a table wrapper frame. This is the FrameConstructionData
    * callback used for the job.
    */
   nsIFrame* ConstructTable(nsFrameConstructorState& aState,
                            FrameConstructionItem&   aItem,
                            nsContainerFrame*        aParentFrame,
                            const nsStyleDisplay*    aDisplay,
                            nsFrameItems&            aFrameItems);
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1592,17 +1592,17 @@ nsLayoutUtils::GetClosestFrameOfType(nsI
   }
   return nullptr;
 }
 
 // static
 nsIFrame*
 nsLayoutUtils::GetStyleFrame(nsIFrame* aFrame)
 {
-  if (aFrame->GetType() == nsGkAtoms::tableOuterFrame) {
+  if (aFrame->GetType() == nsGkAtoms::tableWrapperFrame) {
     nsIFrame* inner = aFrame->PrincipalChildList().FirstChild();
     // inner may be null, if aFrame is mid-destruction
     return inner;
   }
 
   return aFrame;
 }
 
@@ -3806,17 +3806,17 @@ nsLayoutUtils::BinarySearchForPosition(D
 }
 
 static void
 AddBoxesForFrame(nsIFrame* aFrame,
                  nsLayoutUtils::BoxCallback* aCallback)
 {
   nsIAtom* pseudoType = aFrame->StyleContext()->GetPseudo();
 
-  if (pseudoType == nsCSSAnonBoxes::tableOuter) {
+  if (pseudoType == nsCSSAnonBoxes::tableWrapper) {
     AddBoxesForFrame(aFrame->PrincipalChildList().FirstChild(), aCallback);
     if (aCallback->mIncludeCaptionBoxForTable) {
       nsIFrame* kid = aFrame->GetChildList(nsIFrame::kCaptionList).FirstChild();
       if (kid) {
         AddBoxesForFrame(kid, aCallback);
       }
     }
   } else if (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock ||
@@ -3841,17 +3841,17 @@ nsLayoutUtils::GetAllInFlowBoxes(nsIFram
 }
 
 nsIFrame*
 nsLayoutUtils::GetFirstNonAnonymousFrame(nsIFrame* aFrame)
 {
   while (aFrame) {
     nsIAtom* pseudoType = aFrame->StyleContext()->GetPseudo();
 
-    if (pseudoType == nsCSSAnonBoxes::tableOuter) {
+    if (pseudoType == nsCSSAnonBoxes::tableWrapper) {
       nsIFrame* f = GetFirstNonAnonymousFrame(aFrame->PrincipalChildList().FirstChild());
       if (f) {
         return f;
       }
       nsIFrame* kid = aFrame->GetChildList(nsIFrame::kCaptionList).FirstChild();
       if (kid) {
         f = GetFirstNonAnonymousFrame(kid);
         if (f) {
@@ -6164,17 +6164,17 @@ nsLayoutUtils::GetFirstLinePosition(Writ
                                     const nsIFrame* aFrame,
                                     LinePosition* aResult)
 {
   const nsBlockFrame* block = nsLayoutUtils::GetAsBlock(const_cast<nsIFrame*>(aFrame));
   if (!block) {
     // For the first-line baseline we also have to check for a table, and if
     // so, use the baseline of its first row.
     nsIAtom* fType = aFrame->GetType();
-    if (fType == nsGkAtoms::tableOuterFrame) {
+    if (fType == nsGkAtoms::tableWrapperFrame) {
       aResult->mBStart = 0;
       aResult->mBaseline = aFrame->GetLogicalBaseline(aWM);
       // This is what we want for the list bullet caller; not sure if
       // other future callers will want the same.
       aResult->mBEnd = aFrame->BSize(aWM);
       return true;
     }
 
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -341,48 +341,48 @@ public:
    */
   static nsIFrame* GetPageFrame(nsIFrame* aFrame)
   {
     return GetClosestFrameOfType(aFrame, nsGkAtoms::pageFrame);
   }
 
   /**
    * Given a frame which is the primary frame for an element,
-   * return the frame that has the non-psuedoelement style context for
+   * return the frame that has the non-pseudoelement style context for
    * the content.
-   * This is aPrimaryFrame itself except for tableOuter frames.
+   * This is aPrimaryFrame itself except for tableWrapper frames.
    *
    * Given a non-null input, this will return null if and only if its
-   * argument is a table outer frame that is mid-destruction (and its
+   * argument is a table wrapper frame that is mid-destruction (and its
    * table frame has been destroyed).
    */
   static nsIFrame* GetStyleFrame(nsIFrame* aPrimaryFrame);
 
   /**
    * Given a content node,
-   * return the frame that has the non-psuedoelement style context for
+   * return the frame that has the non-pseudoelement style context for
    * the content.  May return null.
-   * This is aContent->GetPrimaryFrame() except for tableOuter frames.
+   * This is aContent->GetPrimaryFrame() except for tableWrapper frames.
    */
   static nsIFrame* GetStyleFrame(const nsIContent* aContent);
 
   /**
    * Gets the real primary frame associated with the content object.
    *
    * In the case of absolutely positioned elements and floated elements,
    * the real primary frame is the frame that is out of the flow and not the
    * placeholder frame.
    */
   static nsIFrame* GetRealPrimaryFrameFor(const nsIContent* aContent);
 
   /**
    * IsGeneratedContentFor returns true if aFrame is the outermost
    * frame for generated content of type aPseudoElement for aContent.
    * aFrame *might not* have the aPseudoElement pseudo-style! For example
-   * it might be a table outer frame and the inner table frame might
+   * it might be a table wrapper frame and the inner table frame might
    * have the pseudo-style.
    *
    * @param aContent the content node we're looking at.  If this is
    *        null, then we just assume that aFrame has the right content
    *        pointer.
    * @param aFrame the frame we're looking at
    * @param aPseudoElement the pseudo type we're interested in
    * @return whether aFrame is the generated aPseudoElement frame for aContent
@@ -1128,17 +1128,17 @@ public:
   class BoxCallback {
   public:
     BoxCallback() : mIncludeCaptionBoxForTable(true) {}
     virtual void AddBox(nsIFrame* aFrame) = 0;
     bool mIncludeCaptionBoxForTable;
   };
   /**
    * Collect all CSS boxes associated with aFrame and its
-   * continuations, "drilling down" through outer table frames and
+   * continuations, "drilling down" through table wrapper frames and
    * some anonymous blocks since they're not real CSS boxes.
    * If aFrame is null, no boxes are returned.
    * SVG frames return a single box, themselves.
    */
   static void GetAllInFlowBoxes(nsIFrame* aFrame, BoxCallback* aCallback);
 
   /**
    * Find the first frame descendant of aFrame (including aFrame) which is
@@ -1176,17 +1176,17 @@ public:
     // With neither bit set (default), use the border box.
     RECTS_USE_CONTENT_BOX = 0x02,
     RECTS_USE_PADDING_BOX = 0x04,
     RECTS_USE_MARGIN_BOX = 0x06, // both bits set
     RECTS_WHICH_BOX_MASK = 0x06 // bitmask for these two bits
   };
   /**
    * Collect all CSS boxes (content, padding, border, or margin) associated
-   * with aFrame and its continuations, "drilling down" through outer table
+   * with aFrame and its continuations, "drilling down" through table wrapper
    * frames and some anonymous blocks since they're not real CSS boxes.
    * The boxes are positioned relative to aRelativeTo (taking scrolling
    * into account) and passed to the callback in frame-tree order.
    * If aFrame is null, no boxes are returned.
    * For SVG frames, returns one rectangle, the bounding box.
    * If aFlags includes RECTS_ACCOUNT_FOR_TRANSFORMS, then when converting
    * the boxes into aRelativeTo coordinates, transforms (including CSS
    * and SVG transforms) are taken into account.
--- a/layout/doc/frame_reflow_debug.html
+++ b/layout/doc/frame_reflow_debug.html
@@ -85,17 +85,17 @@ VP 00B97C30 d=9180,4470
 VP 00B97C30 r=1 a=9180,4470 c=9180,4470 cnt=863 
  scroll 00B97EE0 r=1 a=9180,4470 c=9180,4470 cnt=864 
  scroll 00B97EE0 r=1 a=9180,4470 c=9180,4470 cnt=865 
   canvas 00B97C6C r=1 a=9180,UC c=9180,4470 cnt=866 
    area 02D7AFE4 r=1 a=9180,UC c=9180,UC cnt=867 
     block 02D7B210 r=1 a=9180,UC c=8940,UC cnt=868 
      text 02D7B3F8 r=0 a=8940,UC c=UC,UC cnt=869 
      text 02D7B3F8 d=0,0 
-     tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870 
+     tblW 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870 
       tbl 02D7B7EC r=0 a=8940,UC c=1500,UC cnt=871 
        rowG 00B984A4 r=0 a=UC,UC c=UC,UC cnt=872 
         row 02D7BAF8 r=0 a=UC,UC c=UC,UC cnt=873 
          cell 02D7BC98 r=0 a=UC,UC c=UC,UC cnt=874 
           block 02D7BCF8 r=0 a=UC,UC c=UC,UC cnt=875 
            text 02D7BE84 r=0 a=UC,UC c=UC,UC cnt=876 
            text 02D7BE84 d=300,285 me=300 
           block 02D7BCF8 d=300,300 me=300 
@@ -114,17 +114,17 @@ VP 00B97C30 r=1 a=9180,4470 c=9180,4470 
          cell 02D7BC98 d=1440,330 
         row 02D7BAF8 d=1500,330 
        rowG 00B984A4 d=1500,330 
        colG 02D7BFB0 r=2 a=1500,UC c=1500,UC cnt=883 
         col 02D7C0D8 r=0 a=0,0 c=1500,UC cnt=884 
         col 02D7C0D8 d=0,0 
        colG 02D7BFB0 d=0,0 
       tbl 02D7B7EC d=1500,390 
-     tblO 02D7B5F0 d=1500,390 
+     tblW 02D7B5F0 d=1500,390 
      text 02D7C130 r=0 a=8940,UC c=UC,UC cnt=885 
      text 02D7C130 d=0,0 
     block 02D7B210 d=8940,390 
    area 02D7AFE4 d=9180,630 
   canvas 00B97C6C d=9180,4470 
  scroll 00B97EE0 d=9180,4470 
  scroll 00B97EE0 d=9180,4470 
 VP 00B97C30 d=9180,4470 
@@ -136,17 +136,17 @@ The first line shows the reflow of the v
 <tr><td>1</td><td>incremental reflow</td></tr>
 <tr><td>2</td><td>resize reflow</td></tr>
 <tr><td>3</td><td>style change reflow</td></tr>
 <tr><td>4</td><td>dirty reflow.</td></tr>
 </table>
 
 <p>The available width is 9180 twips. The available height is 4470 twips (<code class="log">a=9180,4470</code>). The computed width is 9180 twips. The computed height is 4470 twips (<code class="log">c=9180,4470</code>). The line count is 856 (<code  class="log">cnt=856</code>).
 <p>
-Below this is a line that reads:<p><code class="log">tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870</code></p><p> Here the <code class="log">UC</code> shows that on initial reflow the available height for the outer table frame is unconstrained.
+Below this is a line that reads:<p><code class="log">tblW 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870</code></p><p> Here the <code class="log">UC</code> shows that on initial reflow the available height for the table wrapper frame is unconstrained.
 <p>
 The table cell requires its children to compute the MES. It is reported back from the block as:
 <p><code class="log">block 02D7BCF8 d=300,300 me=300</code></p>
 <p>The  block max. element size is 300 twips.
 <p> The second table reflow is started at 
 <p><code class="log">rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879</code></p>
 <p>where the previous information is used. 
 The block has been required to compute the max. element size only once and it reports now:
@@ -181,17 +181,17 @@ The entries in the reflow log can be con
  <tr><td>root</td><td>root</td></tr>
  <tr><td>scroll</td><td>scroll</td></tr>
  <tr><td>caption</td><td>tableCaption</td></tr>
  <tr><td>cell</td><td>tableCell</td></tr>
  <tr><td>bcCell</td><td>bcTableCell</td></tr>
  <tr><td>col</td><td>tableCol</td></tr>
  <tr><td>colG</td><td>tableColGroup</td></tr>
  <tr><td> tbl</td><td>table</td></tr>
- <tr><td>tblO</td><td>tableOuter</td></tr>
+ <tr><td>tblW</td><td>tableWrapper</td></tr>
  <tr><td>rowG</td><td>tableRowGroup</td></tr>
  <tr><td>row</td><td>tableRow</td></tr>
  <tr><td>textCtl</td><td>textInput</td></tr>
  <tr><td>text</td><td>text</td></tr>
  <tr><td>VP</td><td>viewport</td></tr>
 </table>
 <p>Once the problem is reduced to a single frame level, placing a breakpoint at <code>DisplayReflowEnterPrint</code> in <a href="http://lxr.mozilla.org/seamonkey/source/layout/html/base/src/nsFrame.cpp"><code>nsFrame.cpp</code></a> is a very efficient way to step through
  the reflow tree.
--- a/layout/doc/table_reflow_slides.html
+++ b/layout/doc/table_reflow_slides.html
@@ -370,17 +370,17 @@
 
 <div class="slide" id="s10">
   <div class="nav">
     <a href="#s9">&lt;</a>
     <a href="#s11">&gt;</a>
   </div>
   <h1>Table Reflow</h1>
   <ul>
-    <li>Outer table reflows table and caption (if present)</li>
+    <li>table wrapper reflows table and caption (if present)</li>
 	<li>Table reflows row groups in multiple passes</li> 
 	 <ul class=nested>
       <li>Pass 1 - unconstrained width, height and requests max elem width.</li>
       <li>The table figures out the column widths (balances) given the style width constraints
 	  on the table, col groups, cols, cells the preferred and max element sizes of the cells 
 	  (from the pass 1 reflow), and considers colspans</li> 
       <li>Pass 2 - cell widths are constrained by the column widths (heights are only 
 	  constrained in paginated mode).</li> 
@@ -412,17 +412,17 @@
     <a href="#s11">&lt;</a>
     <a href="#s13">&gt;</a>
   </div>
   <h1>Table Reflow Example</h1>
   <table width=100%>
    <tr>
     <td width=100%>
 	 <pre style="font-size:.6em;">
-tblO 030176CC r=0 a=8940,UC c=0,0 cnt=429
+tblW 030176CC r=0 a=8940,UC c=0,0 cnt=429
   tbl 030178C4 r=0 a=8940,UC c=4470,UC cnt=430
    rowG 03017A7C r=0 a=UC,UC c=UC,UC cnt=431 
     row 03017C08 r=0 a=UC,UC c=UC,UC cnt=432
      cell 03017DA8 r=0 a=UC,UC c=UC,UC cnt=433
       block 03017E08 r=0 a=UC,UC c=UC,UC cnt=434
       block 03017E08 d=870,300 me=480
      cell 03017DA8 d=930,360 me=540
      cell 0301A8CC r=0 a=UC,UC c=UC,UC cnt=436
@@ -439,17 +439,17 @@ tblO 030176CC r=0 a=8940,UC c=0,0 cnt=42
      cell 03017DA8 d=1755,360
      cell 0301A8CC r=2 a=2625,UC c=2565,UC cnt=446
       block 0301A92C r=2 a=2565,UC c=2565,UC cnt=447
       block 0301A92C d=2565,300
      cell 0301A8CC d=2625,360
     row 03017C08 d=4470,360
    rowG 03017A7C d=4470,360
   tbl 030178C4 d=4500,450
- tblO 030176CC d=4500,450
+ tblW 030176CC d=4500,450
 
  <a href="frame_reflow_debug.html">frame reflow debugging</a> gives instructions 
  for turning this on.
  </pre>
    </td>
    <td>
      <pre style="font-size:.7em;">
 &lt;<span class=html>table</span> width=300&gt;
@@ -483,31 +483,31 @@ Key:
     <a href="#s14">&gt;</a>
   </div>
   <h1>Table reflow optimizations</h1>
   <ul>
     <li>If the table is already balanced, pass 1 constrains the width (like a normal pass 2) based on the current
 	column widths. The pass 2 will get skipped if the table doesn't need to rebalance. <!--<span class="comment">please clarify when can this happen</span>--></li> 
     <li>Nested table reflowed with an unconstrained width (i.e. an ancestor is doing a pass 1 reflow)
 	will only do a pass 1 reflow on its children</li>
-    <li>Outer table caches last avail width and avoids reflowing children if resize reflow is the same as previous</li>
+    <li>table wrapper caches last avail width and avoids reflowing children if resize reflow is the same as previous</li>
     <li>Table caches max element, preferred widths in case they are requested and it isn't rebalanced</li>
     <li>Cell caches prior avail width. if this doesn't change, the row may not have to reflow the cell</li>
   </ul>
 
 </div>
 
 <div class="slide" id="s14">
   <div class="nav">
     <a href="#s13">&lt;</a>
     <a href="#s15">&gt;</a>
   </div>
   <h1>Table incremental reflow</h1>
   <ul>
-    <li>Outer table is a target when a caption is added or removed (dirty) or the table or caption margin 
+    <li>table wrapper is a target when a caption is added or removed (dirty) or the table or caption margin 
   changes (style changed).</li> 
     <li>Caption is a target when it changes stylistically (style changed).</li>
     <li>Table, row group, row, col group, col is a target when a child is added or removed (dirty) or it changes
   stylistically (style changed). <!--<span class="comment">please show how the column style change is propagated 
                into the cell reflows as the cells are reflowed by their parent rows and not cols</span>--></li>
     <li>In the dirty cases, a target posted the reflow command in AppendFrames, InsertFrames, or DeleteFrame.</li>
   </ul>
 </div>
@@ -675,17 +675,17 @@ Key:
 	        <tr><td class=title>areaFrame (html)</td></tr>
 	        <tr>
 	         <td class=box>
 			  <table class=box style="height:100%; border-bottom:hidden">
 	           <tr><td class=title>blockFrame (body)</td></tr>
 	           <tr>
 	            <td class=box>
 			     <table class=box style="height:100%; border-bottom:hidden">
-	              <tr><td class=title>nsTableOuterFrame</td></tr>
+	              <tr><td class=title>nsTableWrapperFrame</td></tr>
 	              <tr>
 	               <td class=box></td>
 	              </tr>
 	             </table>
 				</td>
 	           </tr>
 	          </table>
              </td>
@@ -708,17 +708,17 @@ Key:
 	         <td class=box>
 			  <table class=box style="height:100%; border-top:hidden">
 	           <tr>
 	            <td class=box>
 			     <table class=box style="height:100%; border-top:hidden">
 	              <tr>
 	               <td class=box></td>
 	              </tr>
-	              <tr><td class=title2>nsTableOuterFrame</td></tr>
+	              <tr><td class=title2>nsTableWrapperFrame</td></tr>
 	             </table>
 				</td>
 	           </tr>
 	           <tr><td class=title2>blockFrame (body)</td></tr>
 	          </table>
              </td>
 	        </tr>
 	        <tr><td class=title2>areaFrame (html)</td></tr>
@@ -795,23 +795,23 @@ Key:
 
 <div class="slide" id="s25">
   <div class="nav">
     <a href="#s24">&lt;</a>
     <a href="#s26">&gt;</a>
   </div>
   <h1>Table paginated reflow</h1>
   <ul>
-	<li>The block containing the outer table reflows it. If it is incomplete, the block will
+	<li>The block containing the table wrapper reflows it. If it is incomplete, the block will
 	  <ul>
-	    <li>create a continuation for the outer table (which also creates a continuation for the table).</li>
+	    <li>create a continuation for the table wrapper (which also creates a continuation for the table).</li>
 	    <li>put the continuation on a new line and place that line on its overflow lines property.</li>
 	  </ul>
 	</li>
-    <li>The outer table reflows the table and just returns the status of the table.</li>
+    <li>The table wrapper reflows the table and just returns the status of the table.</li>
     <li>The table does a pass 1 reflow and balances. If it is incomplete,</li>
 	  <ul>
 	    <li>it will become the first-in-flow</li>
 		<li>it will be the only frame among its continuations to ever balance or calc the cell map, and it only
 		does this once</li>
 	  </ul>
 	</li>
   </ul>
@@ -869,20 +869,20 @@ Key:
 	<li>The row and cells (getting the constrained height reflow) just reflow their children with a constrained height.  
     They don't need an overflow list for continued children because the continuations were created when the
     row group created the row's continutation.</li>
     <li>A cell is incomplete because its block is incomplete. The block uses the overflow lines mechanism 
     (mentioned above) for its continued children</li>
 	</li>
 	<li>There are two splitting scenarios for a table
 	  <ul>
-	    <li>An incomplete cells block causes the cell, row, row group, table, outer table to
+	    <li>An incomplete cells block causes the cell, row, row group, table, table wrapper to
 	    be incomplete</li>
 	    <li>A truncated row or a row that started too far down the page causes the row group, 
-		table, outer table to be incomplete.</li>
+		table, table wrapper to be incomplete.</li>
 	  </ul>
 	</li>
   </ul>
 </div>
 
 
 </body>
 </html>
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -828,17 +828,17 @@ nsBlockReflowState::FlowAndPlaceFloat(ns
           break;
         }
         prevFrame = fc->mFloat;
         fc = fc->Next();
       }
       
       if(prevFrame) {
         //get the frame type
-        if (nsGkAtoms::tableOuterFrame == prevFrame->GetType()) {
+        if (nsGkAtoms::tableWrapperFrame == prevFrame->GetType()) {
           //see if it has "align="
           // IE makes a difference between align and he float property
           nsIContent* content = prevFrame->GetContent();
           if (content) {
             // we're interested only if previous frame is align=left
             // IE messes things up when "right" (overlapping frames) 
             if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::align,
                                      NS_LITERAL_STRING("left"), eIgnoreCase)) {
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1022,17 +1022,17 @@ GetFirstNonAnonBoxDescendant(nsIFrame* a
 
     // SPECIAL CASE: if we're dealing with an anonymous table, then it might
     // be wrapping something non-anonymous in its caption or col-group lists
     // (instead of its principal child list), so we have to look there.
     // (Note: For anonymous tables that have a non-anon cell *and* a non-anon
     // column, we'll always return the column. This is fine; we're really just
     // looking for a handle to *anything* with a meaningful content node inside
     // the table, for use in DOM comparisons to things outside of the table.)
-    if (MOZ_UNLIKELY(aFrame->GetType() == nsGkAtoms::tableOuterFrame)) {
+    if (MOZ_UNLIKELY(aFrame->GetType() == nsGkAtoms::tableWrapperFrame)) {
       nsIFrame* captionDescendant =
         GetFirstNonAnonBoxDescendant(aFrame->GetChildList(kCaptionList).FirstChild());
       if (captionDescendant) {
         return captionDescendant;
       }
     } else if (MOZ_UNLIKELY(aFrame->GetType() == nsGkAtoms::tableFrame)) {
       nsIFrame* colgroupDescendant =
         GetFirstNonAnonBoxDescendant(aFrame->GetChildList(kColGroupList).FirstChild());
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -24,17 +24,17 @@
 #include "nsPlaceholderFrame.h"
 #include "nsIContent.h"
 #include "nsContentUtils.h"
 #include "nsCSSPseudoElements.h"
 #include "nsIAtom.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsStyleContext.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsPresContext.h"
 #include "nsStyleConsts.h"
 #include "nsIPresShell.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Snprintf.h"
@@ -3062,17 +3062,17 @@ nsFrame::GetDataForTableSelection(const 
       //      for row and column selection, this is the place to do it
       break;
     }
     else
     {
       // If not a cell, check for table
       // This will happen when starting frame is the table or child of a table,
       //  such as a row (we were inbetween cells or in table border)
-      nsTableOuterFrame *tableFrame = do_QueryFrame(frame);
+      nsTableWrapperFrame *tableFrame = do_QueryFrame(frame);
       if (tableFrame)
       {
         foundTable = true;
         //TODO: How can we select row when along left table edge
         //  or select column when along top edge?
         break;
       } else {
         frame = frame->GetParent();
@@ -6774,17 +6774,17 @@ nsFrame::GetNextPrevLineFromeBlockFrame(
         //otherwise there is no way to get and click signal to fall before a table (it being a line iterator itself)
         nsIPresShell *shell = aPresContext->GetPresShell();
         if (!shell)
           return NS_ERROR_FAILURE;
         int16_t isEditor = shell->GetSelectionFlags();
         isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL;
         if ( isEditor )
         {
-          if (resultFrame->GetType() == nsGkAtoms::tableOuterFrame)
+          if (resultFrame->GetType() == nsGkAtoms::tableWrapperFrame)
           {
             if (((point.x - offset.x + tempRect.x)<0) ||  ((point.x - offset.x+ tempRect.x)>tempRect.width))//off left/right side
             {
               nsIContent* content = resultFrame->GetContent();
               if (content)
               {
                 nsIContent* parent = content->GetParent();
                 if (parent)
@@ -7239,90 +7239,90 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct*
       while (NS_FAILED(result)){
         int32_t thisLine = nsFrame::GetLineNumber(blockFrame, aPos->mScrollViewStop, &blockFrame);
         if (thisLine < 0) 
           return  NS_ERROR_FAILURE;
         iter = blockFrame->GetLineIterator();
         NS_ASSERTION(iter, "GetLineNumber() succeeded but no block frame?");
         result = NS_OK;
 
-        int edgeCase = 0;//no edge case. this should look at thisLine
+        int edgeCase = 0; // no edge case. this should look at thisLine
         
-        bool doneLooping = false;//tells us when no more block frames hit.
-        //this part will find a frame or a block frame. if it's a block frame
-        //it will "drill down" to find a viable frame or it will return an error.
+        bool doneLooping = false; // tells us when no more block frames hit.
+        // this part will find a frame or a block frame. if it's a block frame
+        // it will "drill down" to find a viable frame or it will return an error.
         nsIFrame *lastFrame = this;
         do {
           result = nsFrame::GetNextPrevLineFromeBlockFrame(PresContext(),
                                                            aPos, 
                                                            blockFrame, 
                                                            thisLine, 
-                                                           edgeCase //start from thisLine
-            );
-          if (NS_SUCCEEDED(result) && (!aPos->mResultFrame || aPos->mResultFrame == lastFrame))//we came back to same spot! keep going
-          {
+                                                           edgeCase); // start from thisLine
+
+          // we came back to same spot! keep going
+          if (NS_SUCCEEDED(result) &&
+              (!aPos->mResultFrame || aPos->mResultFrame == lastFrame)) {
             aPos->mResultFrame = nullptr;
             if (aPos->mDirection == eDirPrevious)
               thisLine--;
             else
               thisLine++;
-          }
-          else //if failure or success with different frame.
-            doneLooping = true; //do not continue with while loop
-
-          lastFrame = aPos->mResultFrame; //set last frame 
-
-          if (NS_SUCCEEDED(result) && aPos->mResultFrame 
-            && blockFrame != aPos->mResultFrame)// make sure block element is not the same as the one we had before
-          {
-/* SPECIAL CHECK FOR TABLE NAVIGATION
-  tables need to navigate also and the frame that supports it is nsTableRowGroupFrame which is INSIDE
-  nsTableOuterFrame.  if we have stumbled onto an nsTableOuter we need to drill into nsTableRowGroup
-  if we hit a header or footer that's ok just go into them,
-*/
+          } else // if failure or success with different frame.
+            doneLooping = true; // do not continue with while loop
+
+          lastFrame = aPos->mResultFrame; // set last frame
+
+          // make sure block element is not the same as the one we had before
+          if (NS_SUCCEEDED(result) &&
+              aPos->mResultFrame &&
+              blockFrame != aPos->mResultFrame) {
+            /* SPECIAL CHECK FOR TABLE NAVIGATION
+               tables need to navigate also and the frame that supports it is
+               nsTableRowGroupFrame which is INSIDE nsTableWrapperFrame.
+               If we have stumbled onto an nsTableWrapperFrame we need to drill
+               into nsTableRowGroup if we hit a header or footer that's ok just
+               go into them.
+             */
             bool searchTableBool = false;
-            if (aPos->mResultFrame->GetType() == nsGkAtoms::tableOuterFrame ||
-                aPos->mResultFrame->GetType() == nsGkAtoms::tableCellFrame)
-            {
-              nsIFrame *frame = aPos->mResultFrame->PrincipalChildList().FirstChild();
-              //got the table frame now
-              while(frame) //ok time to drill down to find iterator
-              {
+            if (aPos->mResultFrame->GetType() == nsGkAtoms::tableWrapperFrame ||
+                aPos->mResultFrame->GetType() == nsGkAtoms::tableCellFrame) {
+              nsIFrame* frame = aPos->mResultFrame->PrincipalChildList().FirstChild();
+              // got the table frame now
+              // ok time to drill down to find iterator
+              while (frame) {
                 iter = frame->GetLineIterator();
-                if (iter)
-                {
+                if (iter) {
                   aPos->mResultFrame = frame;
                   searchTableBool = true;
                   result = NS_OK;
-                  break; //while(frame)
+                  break; // while(frame)
                 }
                 result = NS_ERROR_FAILURE;
                 frame = frame->PrincipalChildList().FirstChild();
               }
             }
 
             if (!searchTableBool) {
               iter = aPos->mResultFrame->GetLineIterator();
               result = iter ? NS_OK : NS_ERROR_FAILURE;
             }
-            if (NS_SUCCEEDED(result) && iter)//we've struck another block element!
-            {
+
+            // we've struck another block element!
+            if (NS_SUCCEEDED(result) && iter) {
               doneLooping = false;
               if (aPos->mDirection == eDirPrevious)
-                edgeCase = 1;//far edge, search from end backwards
+                edgeCase = 1; // far edge, search from end backwards
               else
-                edgeCase = -1;//near edge search from beginning onwards
-              thisLine=0;//this line means nothing now.
-              //everything else means something so keep looking "inside" the block
+                edgeCase = -1; // near edge search from beginning onwards
+              thisLine = 0; // this line means nothing now.
+              // everything else means something so keep looking "inside" the block
               blockFrame = aPos->mResultFrame;
-
-            }
-            else
-            {
-              result = NS_OK;//THIS is to mean that everything is ok to the containing while loop
+            } else {
+              // THIS is to mean that everything is ok to the containing while loop
+              result = NS_OK;
               break;
             }
           }
         } while (!doneLooping);
       }
       return result;
     }
 
@@ -7432,18 +7432,21 @@ nsFrame::PeekOffsetCharacter(bool aForwa
     // skip to the other side and we're done.
     *aOffset = 1 - startOffset;
     return FOUND;
   }
   return CONTINUE;
 }
 
 nsIFrame::FrameSearchResult
-nsFrame::PeekOffsetWord(bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
-                        int32_t* aOffset, PeekWordState* aState)
+nsFrame::PeekOffsetWord(bool            aForward,
+                        bool            aWordSelectEatSpace,
+                        bool            aIsKeyboardSelect,
+                        int32_t*        aOffset,
+                        PeekWordState*  aState)
 {
   NS_ASSERTION (aOffset && *aOffset <= 1, "aOffset out of range");
   int32_t startOffset = *aOffset;
   // This isn't text, so truncate the context
   aState->mContext.Truncate();
   if (startOffset < 0)
     startOffset = 1;
   if (aForward == (startOffset == 0)) {
@@ -8345,21 +8348,21 @@ GetCorrectedParent(const nsIFrame* aFram
   // as the style parent.
   if (aFrame->IsTableCaption()) {
     nsIFrame* innerTable = parent->PrincipalChildList().FirstChild();
     if (!innerTable->StyleContext()->GetPseudo()) {
       return innerTable;
     }
   }
 
-  // Outer tables are always anon boxes; if we're in here for an outer
+  // Table wrappers are always anon boxes; if we're in here for an outer
   // table, that actually means its the _inner_ table that wants to
-  // know its parent.  So get the pseudo of the inner in that case.
+  // know its parent. So get the pseudo of the inner in that case.
   nsIAtom* pseudo = aFrame->StyleContext()->GetPseudo();
-  if (pseudo == nsCSSAnonBoxes::tableOuter) {
+  if (pseudo == nsCSSAnonBoxes::tableWrapper) {
     pseudo = aFrame->PrincipalChildList().FirstChild()->StyleContext()->GetPseudo();
   }
   return nsFrame::CorrectStyleParentFrame(parent, pseudo);
 }
 
 /* static */
 nsIFrame*
 nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
@@ -8434,17 +8437,17 @@ nsFrame::DoGetParentStyleContext(nsIFram
       if (!pseudo || !mContent->IsElement() ||
           (!nsCSSAnonBoxes::IsAnonBox(pseudo) &&
            // Ensure that we don't return the display:contents style
            // of the parent content for pseudos that have the same content
            // as their primary frame (like -moz-list-bullets do):
            mContent->GetPrimaryFrame() == this) ||
           /* if next is true then it's really a request for the table frame's
              parent context, see nsTable[Outer]Frame::GetParentStyleContext. */
-          pseudo == nsCSSAnonBoxes::tableOuter) {
+          pseudo == nsCSSAnonBoxes::tableWrapper) {
         nsStyleContext* sc = fm->GetDisplayContentsStyleFor(parentContent);
         if (MOZ_UNLIKELY(sc)) {
           return sc;
         }
       }
     } else {
       if (!StyleContext()->GetPseudo()) {
         // we're a frame for the root.  We have no style context parent.
@@ -10110,29 +10113,29 @@ void DR_State::InitFrameTypeTable()
   AddFrameTypeInfo(nsGkAtoms::canvasFrame,           "canvas",    "canvas");
   AddFrameTypeInfo(nsGkAtoms::rootFrame,             "root",      "root");
   AddFrameTypeInfo(nsGkAtoms::scrollFrame,           "scroll",    "scroll");
   AddFrameTypeInfo(nsGkAtoms::tableCellFrame,        "cell",      "tableCell");
   AddFrameTypeInfo(nsGkAtoms::bcTableCellFrame,      "bcCell",    "bcTableCell");
   AddFrameTypeInfo(nsGkAtoms::tableColFrame,         "col",       "tableCol");
   AddFrameTypeInfo(nsGkAtoms::tableColGroupFrame,    "colG",      "tableColGroup");
   AddFrameTypeInfo(nsGkAtoms::tableFrame,            "tbl",       "table");
-  AddFrameTypeInfo(nsGkAtoms::tableOuterFrame,       "tblO",      "tableOuter");
+  AddFrameTypeInfo(nsGkAtoms::tableWrapperFrame,     "tblW",      "tableWrapper");
   AddFrameTypeInfo(nsGkAtoms::tableRowGroupFrame,    "rowG",      "tableRowGroup");
   AddFrameTypeInfo(nsGkAtoms::tableRowFrame,         "row",       "tableRow");
   AddFrameTypeInfo(nsGkAtoms::textInputFrame,        "textCtl",   "textInput");
   AddFrameTypeInfo(nsGkAtoms::textFrame,             "text",      "text");
   AddFrameTypeInfo(nsGkAtoms::viewportFrame,         "VP",        "viewport");
 #ifdef MOZ_XUL
   AddFrameTypeInfo(nsGkAtoms::XULLabelFrame,         "XULLabel",  "XULLabel");
   AddFrameTypeInfo(nsGkAtoms::boxFrame,              "Box",       "Box");
   AddFrameTypeInfo(nsGkAtoms::sliderFrame,           "Slider",    "Slider");
   AddFrameTypeInfo(nsGkAtoms::popupSetFrame,         "PopupSet",  "PopupSet");
 #endif
-  AddFrameTypeInfo(nullptr,                               "unknown",   "unknown");
+  AddFrameTypeInfo(nullptr,                          "unknown",   "unknown");
 }
 
 
 void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame,
                                     int32_t   aIndent)
 { 
   DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(aFrame->GetType());
   if (frameTypeInfo) {
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -86,17 +86,17 @@ FRAME_ID(nsMathMLmoFrame)
 FRAME_ID(nsMathMLmoverFrame)
 FRAME_ID(nsMathMLmpaddedFrame)
 FRAME_ID(nsMathMLmrootFrame)
 FRAME_ID(nsMathMLmrowFrame)
 FRAME_ID(nsMathMLmspaceFrame)
 FRAME_ID(nsMathMLmsqrtFrame)
 FRAME_ID(nsMathMLmstyleFrame)
 FRAME_ID(nsMathMLmtableFrame)
-FRAME_ID(nsMathMLmtableOuterFrame)
+FRAME_ID(nsMathMLmtableWrapperFrame)
 FRAME_ID(nsMathMLmtdFrame)
 FRAME_ID(nsMathMLmtdInnerFrame)
 FRAME_ID(nsMathMLmtrFrame)
 FRAME_ID(nsMathMLmunderFrame)
 FRAME_ID(nsMathMLmunderoverFrame)
 FRAME_ID(nsMathMLsemanticsFrame)
 FRAME_ID(nsMathMLTokenFrame)
 FRAME_ID(nsMenuBarFrame)
@@ -159,17 +159,17 @@ FRAME_ID(nsSVGStopFrame)
 FRAME_ID(nsSVGSwitchFrame)
 FRAME_ID(SVGTextFrame)
 FRAME_ID(nsSVGUseFrame)
 FRAME_ID(SVGViewFrame)
 FRAME_ID(nsTableCellFrame)
 FRAME_ID(nsTableColFrame)
 FRAME_ID(nsTableColGroupFrame)
 FRAME_ID(nsTableFrame)
-FRAME_ID(nsTableOuterFrame)
+FRAME_ID(nsTableWrapperFrame)
 FRAME_ID(nsTableRowFrame)
 FRAME_ID(nsTableRowGroupFrame)
 FRAME_ID(nsTextBoxFrame)
 FRAME_ID(nsTextControlFrame)
 FRAME_ID(nsTextFrame)
 FRAME_ID(nsTitleBarFrame)
 FRAME_ID(nsTreeBodyFrame)
 FRAME_ID(nsTreeColFrame)
--- a/layout/generic/nsHTMLParts.h
+++ b/layout/generic/nsHTMLParts.h
@@ -175,19 +175,19 @@ nsIFrame*
 NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 nsIFrame*
 NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 class DetailsFrame;
 DetailsFrame*
 NS_NewDetailsFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 // Table frame factories
-class nsTableOuterFrame;
-nsTableOuterFrame*
-NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
+class nsTableWrapperFrame;
+nsTableWrapperFrame*
+NS_NewTableWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 class nsTableFrame;
 nsTableFrame*
 NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 nsTableColFrame*
 NS_NewTableColFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 class nsTableColGroupFrame;
 nsTableColGroupFrame*
 NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -2552,18 +2552,18 @@ nsCSSOffsetState::InitOffsets(WritingMod
       // only part of their border.  We need to do this here before we
       // try to do anything like handling 'auto' widths,
       // 'box-sizing', or 'auto' margins.
       ComputedPhysicalPadding().SizeTo(0,0,0,0);
       SetComputedLogicalBorderPadding(
         tableFrame->GetIncludedOuterBCBorder(mWritingMode));
     }
 
-    // The margin is inherited to the outer table frame via
-    // the ::-moz-table-outer rule in ua.css.
+    // The margin is inherited to the table wrapper frame via
+    // the ::-moz-table-wrapper rule in ua.css.
     ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
   } else if (aFrameType == nsGkAtoms::scrollbarFrame) {
     // scrollbars may have had their width or height smashed to zero
     // by the associated scrollframe, in which case we must not report
     // any padding or border.
     nsSize size(frame->GetSize());
     if (size.width == 0 || size.height == 0) {
       ComputedPhysicalPadding().SizeTo(0,0,0,0);
@@ -2641,20 +2641,20 @@ nsHTMLReflowState::CalculateBlockSideMar
   bool isAutoEndMargin = eStyleUnit_Auto == styleSides.GetIEndUnit(cbWM);
   if (!isAutoStartMargin && !isAutoEndMargin) {
     // Neither margin is 'auto' so we're over constrained. Use the
     // 'direction' property of the parent to tell which margin to
     // ignore
     // First check if there is an HTML alignment that we should honor
     const nsHTMLReflowState* prs = mParentReflowState;
     if (aFrameType == nsGkAtoms::tableFrame) {
-      NS_ASSERTION(prs->frame->GetType() == nsGkAtoms::tableOuterFrame,
-                   "table not inside outer table");
-      // Center the table within the outer table based on the alignment
-      // of the outer table's parent.
+      NS_ASSERTION(prs->frame->GetType() == nsGkAtoms::tableWrapperFrame,
+                   "table not inside table wrapper");
+      // Center the table within the table wrapper based on the alignment
+      // of the table wrapper's parent.
       prs = prs->mParentReflowState;
     }
     if (prs &&
         (prs->mStyleText->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_LEFT ||
          prs->mStyleText->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_CENTER ||
          prs->mStyleText->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_RIGHT)) {
       if (prs->mWritingMode.IsBidiLTR()) {
         isAutoStartMargin =
--- a/layout/generic/nsIFrameInlines.h
+++ b/layout/generic/nsIFrameInlines.h
@@ -34,17 +34,17 @@ nsIFrame::IsFlexOrGridItem() const
          GetParent() &&
          GetParent()->IsFlexOrGridContainer();
 }
 
 bool
 nsIFrame::IsTableCaption() const
 {
   return StyleDisplay()->mDisplay == NS_STYLE_DISPLAY_TABLE_CAPTION &&
-    GetParent()->StyleContext()->GetPseudo() == nsCSSAnonBoxes::tableOuter;
+    GetParent()->StyleContext()->GetPseudo() == nsCSSAnonBoxes::tableWrapper;
 }
 
 bool
 nsIFrame::IsFloating() const
 {
   return StyleDisplay()->IsFloating(this);
 }
 
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -20,17 +20,17 @@
 #include "nsContentCID.h"
 #include "nsDeviceContext.h"
 #include "nsIContent.h"
 #include "nsIDOMNode.h"
 #include "nsRange.h"
 #include "nsCOMArray.h"
 #include "nsITableCellLayout.h"
 #include "nsTArray.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsIContentIterator.h"
 #include "nsIDocumentEncoder.h"
 #include "nsTextFragment.h"
 #include <algorithm>
 
@@ -2798,17 +2798,17 @@ nsFrameSelection::UnselectCells(nsIConte
                                 int32_t aEndRowIndex,
                                 int32_t aEndColumnIndex,
                                 bool aRemoveOutsideOfCellRange)
 {
   int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
-  nsTableOuterFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
   if (!tableFrame)
     return NS_ERROR_FAILURE;
 
   int32_t minRowIndex = std::min(aStartRowIndex, aEndRowIndex);
   int32_t maxRowIndex = std::max(aStartRowIndex, aEndRowIndex);
   int32_t minColIndex = std::min(aStartColumnIndex, aEndColumnIndex);
   int32_t maxColIndex = std::max(aStartColumnIndex, aEndColumnIndex);
 
@@ -2878,17 +2878,17 @@ nsFrameSelection::AddCellsToSelection(ns
                                       int32_t aStartColumnIndex,
                                       int32_t aEndRowIndex,
                                       int32_t aEndColumnIndex)
 {
   int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
-  nsTableOuterFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
   if (!tableFrame) // Check that |table| is a table.
     return NS_ERROR_FAILURE;
 
   nsresult result = NS_OK;
   int32_t row = aStartRowIndex;
   while(true)
   {
     int32_t col = aStartColumnIndex;
@@ -2949,25 +2949,25 @@ nsFrameSelection::RestrictCellsToSelecti
 nsresult
 nsFrameSelection::SelectRowOrColumn(nsIContent *aCellContent, uint32_t aTarget)
 {
   if (!aCellContent) return NS_ERROR_NULL_POINTER;
 
   nsIContent* table = GetParentTable(aCellContent);
   if (!table) return NS_ERROR_NULL_POINTER;
 
-  // Get table and cell layout interfaces to access 
-  //   cell data based on cellmap location
+  // Get table and cell layout interfaces to access
+  // cell data based on cellmap location
   // Frames are not ref counted, so don't use an nsCOMPtr
-  nsTableOuterFrame* tableFrame = do_QueryFrame(table->GetPrimaryFrame());
+  nsTableWrapperFrame* tableFrame = do_QueryFrame(table->GetPrimaryFrame());
   if (!tableFrame) return NS_ERROR_FAILURE;
   nsITableCellLayout *cellLayout = GetCellLayout(aCellContent);
   if (!cellLayout) return NS_ERROR_FAILURE;
 
-  // Get location of target cell:      
+  // Get location of target cell:
   int32_t rowIndex, colIndex;
   nsresult result = cellLayout->GetCellIndexes(rowIndex, colIndex);
   if (NS_FAILED(result)) return result;
 
   // Be sure we start at proper beginning
   // (This allows us to select row or col given ANY cell!)
   if (aTarget == nsISelectionPrivate::TABLESELECTION_ROW)
     colIndex = 0;
--- a/layout/mathml/nsMathMLmrowFrame.cpp
+++ b/layout/mathml/nsMathMLmrowFrame.cpp
@@ -40,17 +40,17 @@ nsMathMLmrowFrame::AttributeChanged(int3
 {
   // Special for <mtable>: In the frame construction code, we also use
   // this frame class as a wrapper for mtable. Hence, we should pass the
   // notification to the real mtable
   if (mContent->IsMathMLElement(nsGkAtoms::mtable_)) {
     nsIFrame* frame = mFrames.FirstChild();
     for ( ; frame; frame = frame->PrincipalChildList().FirstChild()) {
       // drill down to the real mtable
-      if (frame->GetType() == nsGkAtoms::tableOuterFrame)
+      if (frame->GetType() == nsGkAtoms::tableWrapperFrame)
         return frame->AttributeChanged(aNameSpaceID, aAttribute, aModType);
     }
     NS_NOTREACHED("mtable wrapper without the real table frame");
   }
 
   return nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
 
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -60,17 +60,18 @@ ParseStyleValue(nsIAtom* aAttribute, con
   } else {
     MOZ_CRASH("Unrecognized attribute.");
   }
 
   return -1;
 }
 
 static nsTArray<int8_t>*
-ExtractStyleValues(const nsAString& aString, nsIAtom* aAttribute,
+ExtractStyleValues(const nsAString& aString,
+                   nsIAtom* aAttribute,
                    bool aAllowMultiValues)
 {
   nsTArray<int8_t>* styleArray = nullptr;
 
   const char16_t* start = aString.BeginReading();
   const char16_t* end = aString.EndReading();
 
   int32_t startIndex = 0;
@@ -107,18 +108,20 @@ ExtractStyleValues(const nsAString& aStr
 
       startIndex += count;
       count = 0;
     }
   }
   return styleArray;
 }
 
-static nsresult ReportParseError(nsIFrame* aFrame, const char16_t* aAttribute,
-                                 const char16_t* aValue)
+static nsresult
+ReportParseError(nsIFrame* aFrame,
+                 const char16_t* aAttribute,
+                 const char16_t* aValue)
 {
   nsIContent* content = aFrame->GetContent();
 
   const char16_t* params[] =
     { aValue, aAttribute, content->NodeInfo()->NameAtom()->GetUTF16String() };
 
   return nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,
                                          NS_LITERAL_CSTRING("Layout: MathML"),
@@ -147,17 +150,17 @@ AttributeToProperty(nsIAtom* aAttribute)
   if (aAttribute == nsGkAtoms::columnalign_)
     return ColumnAlignProperty();
   NS_ASSERTION(aAttribute == nsGkAtoms::columnlines_, "Invalid attribute");
   return ColumnLinesProperty();
 }
 
 /* This method looks for a property that applies to a cell, but it looks
  * recursively because some cell properties can come from the cell, a row,
- * a table, etc. This function searches through the heirarchy for a property
+ * a table, etc. This function searches through the hierarchy for a property
  * and returns its value. The function stops searching after checking a <mtable>
  * frame.
  */
 static nsTArray<int8_t>*
 FindCellProperty(const nsIFrame* aCellFrame,
                  const FramePropertyDescriptor<nsTArray<int8_t>>* aFrameProperty)
 {
   const nsIFrame* currentFrame = aCellFrame;
@@ -222,17 +225,18 @@ ApplyBorderToStyle(const nsMathMLmtdFram
       aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
                     columnLinesList->ElementAt(listLength - 1));
     }
     aStyleBorder.SetBorderWidth(NS_SIDE_LEFT, borderWidth);
   }
 }
 
 static nsMargin
-ComputeBorderOverflow(nsMathMLmtdFrame* aFrame, const nsStyleBorder& aStyleBorder)
+ComputeBorderOverflow(nsMathMLmtdFrame* aFrame,
+                      const nsStyleBorder& aStyleBorder)
 {
   nsMargin overflow;
   int32_t rowIndex;
   int32_t columnIndex;
   nsTableFrame* table = aFrame->GetTableFrame();
   aFrame->GetCellIndexes(rowIndex, columnIndex);
   if (!columnIndex) {
     overflow.left = table->GetColSpacing(-1);
@@ -257,17 +261,18 @@ ComputeBorderOverflow(nsMathMLmtdFrame* 
   return overflow;
 }
 
 /*
  * A variant of the nsDisplayBorder contains special code to render a border
  * around a nsMathMLmtdFrame based on the rowline and columnline properties
  * set on the cell frame.
  */
-class nsDisplaymtdBorder : public nsDisplayBorder {
+class nsDisplaymtdBorder : public nsDisplayBorder
+{
 public:
   nsDisplaymtdBorder(nsDisplayListBuilder* aBuilder, nsMathMLmtdFrame* aFrame)
     : nsDisplayBorder(aBuilder, aFrame)
   {
   }
 
   nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
   {
@@ -332,17 +337,18 @@ public:
 #ifdef DEBUG
 #define DEBUG_VERIFY_THAT_FRAME_IS(_frame, _expected) \
   NS_ASSERTION(NS_STYLE_DISPLAY_##_expected == _frame->StyleDisplay()->mDisplay, "internal error");
 #else
 #define DEBUG_VERIFY_THAT_FRAME_IS(_frame, _expected)
 #endif
 
 static void
-ParseFrameAttribute(nsIFrame* aFrame, nsIAtom* aAttribute,
+ParseFrameAttribute(nsIFrame* aFrame,
+                    nsIAtom* aAttribute,
                     bool aAllowMultiValues)
 {
   nsAutoString attrValue;
 
   nsIContent* frameContent = aFrame->GetContent();
   frameContent->GetAttr(kNameSpaceID_None, aAttribute, attrValue);
 
   if (!attrValue.IsEmpty()) {
@@ -555,17 +561,17 @@ ParseSpacingAttribute(nsMathMLmtableFram
 static void ParseSpacingAttributes(nsMathMLmtableFrame* aTableFrame)
 {
   ParseSpacingAttribute(aTableFrame, nsGkAtoms::rowspacing_);
   ParseSpacingAttribute(aTableFrame, nsGkAtoms::columnspacing_);
   ParseSpacingAttribute(aTableFrame, nsGkAtoms::framespacing_);
   aTableFrame->SetUseCSSSpacing();
 }
 
-// map all attribues within a table -- requires the indices of rows and cells.
+// map all attributes within a table -- requires the indices of rows and cells.
 // so it can only happen after they are made ready by the table base class.
 static void
 MapAllAttributesIntoCSS(nsMathMLmtableFrame* aTableFrame)
 {
   // Map mtable rowalign & rowlines.
   ParseFrameAttribute(aTableFrame, nsGkAtoms::rowalign_, true);
   ParseFrameAttribute(aTableFrame, nsGkAtoms::rowlines_, true);
 
@@ -676,38 +682,38 @@ ListMathMLTree(nsIFrame* atLeast)
       break;
   }
   if (!f) f = atLeast;
   f->List(stdout, 0);
 }
 #endif
 
 // --------
-// implementation of nsMathMLmtableOuterFrame
+// implementation of nsMathMLmtableWrapperFrame
 
-NS_QUERYFRAME_HEAD(nsMathMLmtableOuterFrame)
+NS_QUERYFRAME_HEAD(nsMathMLmtableWrapperFrame)
   NS_QUERYFRAME_ENTRY(nsIMathMLFrame)
-NS_QUERYFRAME_TAIL_INHERITING(nsTableOuterFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsTableWrapperFrame)
 
 nsContainerFrame*
 NS_NewMathMLmtableOuterFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
-  return new (aPresShell) nsMathMLmtableOuterFrame(aContext);
+  return new (aPresShell) nsMathMLmtableWrapperFrame(aContext);
 }
 
-NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableOuterFrame)
+NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtableWrapperFrame)
  
-nsMathMLmtableOuterFrame::~nsMathMLmtableOuterFrame()
+nsMathMLmtableWrapperFrame::~nsMathMLmtableWrapperFrame()
 {
 }
 
 nsresult
-nsMathMLmtableOuterFrame::AttributeChanged(int32_t  aNameSpaceID,
-                                           nsIAtom* aAttribute,
-                                           int32_t  aModType)
+nsMathMLmtableWrapperFrame::AttributeChanged(int32_t  aNameSpaceID,
+                                             nsIAtom* aAttribute,
+                                             int32_t  aModType)
 {
   // Attributes specific to <mtable>:
   // frame         : in mathml.css
   // framespacing  : here
   // groupalign    : not yet supported
   // equalrows     : not yet supported 
   // equalcolumns  : not yet supported 
   // displaystyle  : here and in mathml.css
@@ -774,17 +780,17 @@ nsMathMLmtableOuterFrame::AttributeChang
   // Explicitly request a reflow in our subtree to pick up any changes
   presContext->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
 
   return NS_OK;
 }
 
 nsIFrame*
-nsMathMLmtableOuterFrame::GetRowFrameAt(int32_t aRowIndex)
+nsMathMLmtableWrapperFrame::GetRowFrameAt(int32_t aRowIndex)
 {
   int32_t rowCount = GetRowCount();
 
   // Negative indices mean to find upwards from the end.
   if (aRowIndex < 0) {
     aRowIndex = rowCount + aRowIndex;
   } else {
     // aRowIndex is 1-based, so convert it to a 0-based index
@@ -809,25 +815,25 @@ nsMathMLmtableOuterFrame::GetRowFrameAt(
       }
       --aRowIndex;
     }
   }
   return nullptr;
 }
 
 void
-nsMathMLmtableOuterFrame::Reflow(nsPresContext*          aPresContext,
-                                 nsHTMLReflowMetrics&     aDesiredSize,
-                                 const nsHTMLReflowState& aReflowState,
-                                 nsReflowStatus&          aStatus)
+nsMathMLmtableWrapperFrame::Reflow(nsPresContext*           aPresContext,
+                                   nsHTMLReflowMetrics&     aDesiredSize,
+                                   const nsHTMLReflowState& aReflowState,
+                                   nsReflowStatus&          aStatus)
 {
   nsAutoString value;
   // we want to return a table that is anchored according to the align attribute
 
-  nsTableOuterFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
+  nsTableWrapperFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
   NS_ASSERTION(aDesiredSize.Height() >= 0, "illegal height for mtable");
   NS_ASSERTION(aDesiredSize.Width() >= 0, "illegal width for mtable");
 
   // see if the user has set the align attribute on the <mtable>
   int32_t rowIndex = 0;
   eAlign tableAlign = eAlign_axis;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::align, value);
   if (!value.IsEmpty()) {
@@ -966,17 +972,17 @@ nsMathMLmtableFrame::GetColSpacing(int32
   if ((uint32_t) aColIndex >= mColSpacing.Length()) {
     return mColSpacing.LastElement();
   }
   return mColSpacing.ElementAt(aColIndex);
 }
 
 nscoord
 nsMathMLmtableFrame::GetColSpacing(int32_t aStartColIndex,
-                                     int32_t aEndColIndex)
+                                  int32_t aEndColIndex)
 {
   if (mUseCSSSpacing) {
     return nsTableFrame::GetColSpacing(aStartColIndex, aEndColIndex);
   }
   if (aStartColIndex == aEndColIndex) {
     return 0;
   }
   if (!mColSpacing.Length()) {
@@ -1026,17 +1032,17 @@ nsMathMLmtableFrame::GetRowSpacing(int32
   if ((uint32_t) aRowIndex >= mRowSpacing.Length()) {
     return mRowSpacing.LastElement();
   }
   return mRowSpacing.ElementAt(aRowIndex);
 }
 
 nscoord
 nsMathMLmtableFrame::GetRowSpacing(int32_t aStartRowIndex,
-                                     int32_t aEndRowIndex)
+                                   int32_t aEndRowIndex)
 {
   if (mUseCSSSpacing) {
     return nsTableFrame::GetRowSpacing(aStartRowIndex, aEndRowIndex);
   }
   if (aStartRowIndex == aEndRowIndex) {
     return 0;
   }
   if (!mRowSpacing.Length()) {
@@ -1126,18 +1132,19 @@ nsMathMLmtrFrame::AttributeChanged(int32
 
   return NS_OK;
 }
 
 // --------
 // implementation of nsMathMLmtdFrame
 
 nsContainerFrame*
-NS_NewMathMLmtdFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
-                     nsTableFrame* aTableFrame)
+NS_NewMathMLmtdFrame(nsIPresShell*   aPresShell,
+                     nsStyleContext* aContext,
+                     nsTableFrame*   aTableFrame)
 {
   return new (aPresShell) nsMathMLmtdFrame(aContext, aTableFrame);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtdFrame)
 
 nsMathMLmtdFrame::~nsMathMLmtdFrame()
 {
@@ -1293,27 +1300,27 @@ NS_NewMathMLmtdInnerFrame(nsIPresShell* 
   return new (aPresShell) nsMathMLmtdInnerFrame(aContext);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmtdInnerFrame)
 
 nsMathMLmtdInnerFrame::nsMathMLmtdInnerFrame(nsStyleContext* aContext)
   : nsBlockFrame(aContext)
 {
-  // Make a copy of the parent nsStyleText for later modificaiton.
+  // Make a copy of the parent nsStyleText for later modification.
   mUniqueStyleText = new (PresContext()) nsStyleText(*StyleText());
 }
 
 nsMathMLmtdInnerFrame::~nsMathMLmtdInnerFrame()
 {
   mUniqueStyleText->Destroy(PresContext());
 }
 
 void
-nsMathMLmtdInnerFrame::Reflow(nsPresContext*          aPresContext,
+nsMathMLmtdInnerFrame::Reflow(nsPresContext*           aPresContext,
                               nsHTMLReflowMetrics&     aDesiredSize,
                               const nsHTMLReflowState& aReflowState,
                               nsReflowStatus&          aStatus)
 {
   // Let the base class do the reflow
   nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
 
   // more about <maligngroup/> and <malignmark/> later
--- a/layout/mathml/nsMathMLmtableFrame.h
+++ b/layout/mathml/nsMathMLmtableFrame.h
@@ -4,74 +4,77 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMathMLmtableFrame_h___
 #define nsMathMLmtableFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsMathMLContainerFrame.h"
 #include "nsBlockFrame.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 #include "nsTableRowFrame.h"
 #include "nsTableCellFrame.h"
 
 //
 // <mtable> -- table or matrix
 //
 
-class nsMathMLmtableOuterFrame : public nsTableOuterFrame,
-                                 public nsMathMLFrame
+class nsMathMLmtableWrapperFrame : public nsTableWrapperFrame,
+                                   public nsMathMLFrame
 {
 public:
-  friend nsContainerFrame* NS_NewMathMLmtableOuterFrame(nsIPresShell* aPresShell,
-                                                        nsStyleContext* aContext);
+  friend nsContainerFrame*
+  NS_NewMathMLmtableOuterFrame(nsIPresShell*   aPresShell,
+                               nsStyleContext* aContext);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
-  // overloaded nsTableOuterFrame methods
+  // overloaded nsTableWrapperFrame methods
 
   virtual void
-  Reflow(nsPresContext*          aPresContext,
+  Reflow(nsPresContext*           aPresContext,
          nsHTMLReflowMetrics&     aDesiredSize,
          const nsHTMLReflowState& aReflowState,
          nsReflowStatus&          aStatus) override;
 
   virtual nsresult
   AttributeChanged(int32_t  aNameSpaceID,
                    nsIAtom* aAttribute,
                    int32_t  aModType) override;
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
-    return nsTableOuterFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
+    return nsTableWrapperFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
   }
 
 protected:
-  explicit nsMathMLmtableOuterFrame(nsStyleContext* aContext) : nsTableOuterFrame(aContext) {}
-  virtual ~nsMathMLmtableOuterFrame();
+  explicit nsMathMLmtableWrapperFrame(nsStyleContext* aContext)
+    : nsTableWrapperFrame(aContext) {}
+  virtual ~nsMathMLmtableWrapperFrame();
 
   // helper to find the row frame at a given index, positive or negative, e.g.,
   // 1..n means the first row down to the last row, -1..-n means the last row
   // up to the first row. Used for alignments that are relative to a given row
   nsIFrame*
   GetRowFrameAt(int32_t aRowIndex);
-}; // class nsMathMLmtableOuterFrame
+}; // class nsMathMLmtableWrapperFrame
 
 // --------------
 
 class nsMathMLmtableFrame : public nsTableFrame
 {
 public:
   NS_DECL_QUERYFRAME_TARGET(nsMathMLmtableFrame)
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
-  friend nsContainerFrame* NS_NewMathMLmtableFrame(nsIPresShell* aPresShell,
-                                                   nsStyleContext* aContext);
+  friend nsContainerFrame*
+  NS_NewMathMLmtableFrame(nsIPresShell*   aPresShell,
+                          nsStyleContext* aContext);
 
   // Overloaded nsTableFrame methods
 
   virtual void
   SetInitialChildList(ChildListID  aListID,
                       nsFrameList& aChildList) override;
 
   virtual void
@@ -87,18 +90,17 @@ public:
                nsIFrame* aPrevFrame,
                nsFrameList& aFrameList) override
   {
     nsTableFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     RestyleTable();
   }
 
   virtual void
-  RemoveFrame(ChildListID aListID,
-              nsIFrame* aOldFrame) override
+  RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override
   {
     nsTableFrame::RemoveFrame(aListID, aOldFrame);
     RestyleTable();
   }
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsTableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
@@ -144,24 +146,21 @@ public:
   }
 
   /** Determines whether the placement of table cells is determined by CSS
    * spacing based on padding and border-spacing, or one based upon the
    * rowspacing, columnspacing and framespacing attributes.  The second
    * approach is used if the user specifies at least one of those attributes.
    */
   void SetUseCSSSpacing();
-
-  bool GetUseCSSSpacing()
-  {
-    return mUseCSSSpacing;
-  }
+  bool GetUseCSSSpacing() { return mUseCSSSpacing; }
 
 protected:
-  explicit nsMathMLmtableFrame(nsStyleContext* aContext) : nsTableFrame(aContext) {}
+  explicit nsMathMLmtableFrame(nsStyleContext* aContext)
+    : nsTableFrame(aContext) {}
   virtual ~nsMathMLmtableFrame();
 
 private:
   nsTArray<nscoord> mColSpacing;
   nsTArray<nscoord> mRowSpacing;
   nscoord mFrameSpacingX;
   nscoord mFrameSpacingY;
   bool mUseCSSSpacing;
@@ -169,18 +168,19 @@ private:
 
 // --------------
 
 class nsMathMLmtrFrame : public nsTableRowFrame
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
-  friend nsContainerFrame* NS_NewMathMLmtrFrame(nsIPresShell* aPresShell,
-                                                nsStyleContext* aContext);
+  friend nsContainerFrame*
+  NS_NewMathMLmtrFrame(nsIPresShell*   aPresShell,
+                       nsStyleContext* aContext);
 
   // overloaded nsTableRowFrame methods
 
   virtual nsresult
   AttributeChanged(int32_t  aNameSpaceID,
                    nsIAtom* aAttribute,
                    int32_t  aModType) override;
 
@@ -188,27 +188,26 @@ public:
   AppendFrames(ChildListID  aListID,
                nsFrameList& aFrameList) override
   {
     nsTableRowFrame::AppendFrames(aListID, aFrameList);
     RestyleTable();
   }
 
   virtual void
-  InsertFrames(ChildListID aListID,
-               nsIFrame* aPrevFrame,
+  InsertFrames(ChildListID  aListID,
+               nsIFrame*    aPrevFrame,
                nsFrameList& aFrameList) override
   {
     nsTableRowFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     RestyleTable();
   }
 
   virtual void
-  RemoveFrame(ChildListID aListID,
-              nsIFrame* aOldFrame) override
+  RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) override
   {
     nsTableRowFrame::RemoveFrame(aListID, aOldFrame);
     RestyleTable();
   }
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsTableRowFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
@@ -220,45 +219,47 @@ public:
     nsTableFrame* tableFrame = GetTableFrame();
     if (tableFrame && tableFrame->IsFrameOfType(nsIFrame::eMathML)) {
       // relayout the table
       ((nsMathMLmtableFrame*)tableFrame)->RestyleTable();
     }
   }
 
 protected:
-  explicit nsMathMLmtrFrame(nsStyleContext* aContext) : nsTableRowFrame(aContext) {}
+  explicit nsMathMLmtrFrame(nsStyleContext* aContext)
+    : nsTableRowFrame(aContext) {}
   virtual ~nsMathMLmtrFrame();
 }; // class nsMathMLmtrFrame
 
 // --------------
 
 class nsMathMLmtdFrame : public nsTableCellFrame
 {
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
-  friend nsContainerFrame* NS_NewMathMLmtdFrame(nsIPresShell* aPresShell,
-                                                nsStyleContext* aContext,
-                                                nsTableFrame* aTableFrame);
+  friend nsContainerFrame*
+  NS_NewMathMLmtdFrame(nsIPresShell*   aPresShell,
+                       nsStyleContext* aContext,
+                       nsTableFrame*   aTableFrame);
 
   // overloaded nsTableCellFrame methods
 
   virtual void Init(nsIContent*       aContent,
                     nsContainerFrame* aParent,
                     nsIFrame*         aPrevInFlow) override;
 
   virtual nsresult
   AttributeChanged(int32_t  aNameSpaceID,
                    nsIAtom* aAttribute,
                    int32_t  aModType) override;
 
   virtual uint8_t GetVerticalAlign() const override;
-  virtual nsresult ProcessBorders(nsTableFrame* aFrame,
-                                  nsDisplayListBuilder* aBuilder,
+  virtual nsresult ProcessBorders(nsTableFrame*           aFrame,
+                                  nsDisplayListBuilder*   aBuilder,
                                   const nsDisplayListSet& aLists) override;
 
   virtual int32_t GetRowSpan() override;
   virtual int32_t GetColSpan() override;
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
   }
@@ -271,54 +272,59 @@ protected:
   nsMathMLmtdFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame)
     : nsTableCellFrame(aContext, aTableFrame) {}
   virtual ~nsMathMLmtdFrame();
 }; // class nsMathMLmtdFrame
 
 // --------------
 
 class nsMathMLmtdInnerFrame : public nsBlockFrame,
-                              public nsMathMLFrame {
+                              public nsMathMLFrame
+{
 public:
-  friend nsContainerFrame* NS_NewMathMLmtdInnerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
+  friend nsContainerFrame*
+  NS_NewMathMLmtdInnerFrame(nsIPresShell*   aPresShell,
+                            nsStyleContext* aContext);
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // Overloaded nsIMathMLFrame methods
 
   NS_IMETHOD
-  UpdatePresentationDataFromChildAt(int32_t         aFirstIndex,
-                                    int32_t         aLastIndex,
-                                    uint32_t        aFlagsValues,
-                                    uint32_t        aFlagsToUpdate) override
+  UpdatePresentationDataFromChildAt(int32_t  aFirstIndex,
+                                    int32_t  aLastIndex,
+                                    uint32_t aFlagsValues,
+                                    uint32_t aFlagsToUpdate) override
   {
     nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(this,
       aFirstIndex, aLastIndex, aFlagsValues, aFlagsToUpdate);
     return NS_OK;
   }
 
   virtual void
-  Reflow(nsPresContext*          aPresContext,
+  Reflow(nsPresContext*           aPresContext,
          nsHTMLReflowMetrics&     aDesiredSize,
          const nsHTMLReflowState& aReflowState,
          nsReflowStatus&          aStatus) override;
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsBlockFrame::IsFrameOfType(aFlags &
       ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
   }
 
   virtual const nsStyleText* StyleTextForLineLayout() override;
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
 
   bool
-  IsMrowLike() override {
-    return mFrames.FirstChild() != mFrames.LastChild() ||
+  IsMrowLike() override
+  {
+    return mFrames.FirstChild() !=
+           mFrames.LastChild() ||
            !mFrames.FirstChild();
   }
 
 protected:
   explicit nsMathMLmtdInnerFrame(nsStyleContext* aContext);
   virtual ~nsMathMLmtdInnerFrame();
 
   nsStyleText* mUniqueStyleText;
--- a/layout/style/nsCSSAnonBoxList.h
+++ b/layout/style/nsCSSAnonBoxList.h
@@ -47,17 +47,17 @@ CSS_ANON_BOX(framesetBlank, ":-moz-frame
 CSS_ANON_BOX(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame")
 CSS_ANON_BOX(htmlCanvasContent, ":-moz-html-canvas-content")
 
 CSS_ANON_BOX(inlineTable, ":-moz-inline-table")
 CSS_ANON_BOX(table, ":-moz-table")
 CSS_ANON_BOX(tableCell, ":-moz-table-cell")
 CSS_ANON_BOX(tableColGroup, ":-moz-table-column-group")
 CSS_ANON_BOX(tableCol, ":-moz-table-column")
-CSS_ANON_BOX(tableOuter, ":-moz-table-outer")
+CSS_ANON_BOX(tableWrapper, ":-moz-table-wrapper")
 CSS_ANON_BOX(tableRowGroup, ":-moz-table-row-group")
 CSS_ANON_BOX(tableRow, ":-moz-table-row")
 
 CSS_ANON_BOX(canvas, ":-moz-canvas")
 CSS_ANON_BOX(pageBreak, ":-moz-pagebreak")
 CSS_ANON_BOX(page, ":-moz-page")
 CSS_ANON_BOX(pageContent, ":-moz-pagecontent")
 CSS_ANON_BOX(pageSequence, ":-moz-page-sequence")
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -216,22 +216,24 @@ nsComputedStyleMap::Update()
   }
   mExposedPropertyCount = index;
 }
 
 nsComputedDOMStyle::nsComputedDOMStyle(dom::Element* aElement,
                                        const nsAString& aPseudoElt,
                                        nsIPresShell* aPresShell,
                                        StyleType aStyleType)
-  : mDocumentWeak(nullptr), mOuterFrame(nullptr),
-    mInnerFrame(nullptr), mPresShell(nullptr),
-    mStyleType(aStyleType),
-    mStyleContextGeneration(0),
-    mExposeVisitedStyle(false),
-    mResolvedStyleContext(false)
+  : mDocumentWeak(nullptr)
+  , mOuterFrame(nullptr)
+  , mInnerFrame(nullptr)
+  , mPresShell(nullptr)
+  , mStyleType(aStyleType)
+  , mStyleContextGeneration(0)
+  , mExposeVisitedStyle(false)
+  , mResolvedStyleContext(false)
 {
   MOZ_ASSERT(aElement && aPresShell);
 
   mDocumentWeak = do_GetWeakReference(aPresShell->GetDocument());
 
   mContent = aElement;
 
   if (!DOMStringIsNull(aPseudoElt) && !aPseudoElt.IsEmpty() &&
@@ -258,17 +260,16 @@ nsComputedDOMStyle::nsComputedDOMStyle(d
       // the DOM spec sucks.
       mPseudo = nullptr;
     }
   }
 
   MOZ_ASSERT(aPresShell->GetPresContext());
 }
 
-
 nsComputedDOMStyle::~nsComputedDOMStyle()
 {
   ClearStyleContext();
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsComputedDOMStyle)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsComputedDOMStyle)
@@ -320,33 +321,30 @@ nsComputedDOMStyle::GetPropertyValue(con
 
 NS_IMETHODIMP
 nsComputedDOMStyle::SetPropertyValue(const nsCSSProperty aPropID,
                                      const nsAString& aValue)
 {
   return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::GetCssText(nsAString& aCssText)
 {
   aCssText.Truncate();
 
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::SetCssText(const nsAString& aCssText)
 {
   return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::GetLength(uint32_t* aLength)
 {
   NS_PRECONDITION(aLength, "Null aLength!  Prepare to die!");
 
   uint32_t length = GetComputedStyleMap()->Length();
 
   // Make sure we have up to date style so that we can include custom
@@ -358,26 +356,24 @@ nsComputedDOMStyle::GetLength(uint32_t* 
 
   *aLength = length;
 
   ClearCurrentStyleSources();
 
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule)
 {
   *aParentRule = nullptr;
 
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
                                      nsAString& aReturn)
 {
   aReturn.Truncate();
 
   ErrorResult error;
   RefPtr<CSSValue> val = GetPropertyCSSValue(aPropertyName, error);
@@ -671,23 +667,23 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
   // check is needed due to bug 135040 (to avoid using
   // mPrimaryFrame). Remove it once that's fixed.
   if (!mPseudo && mStyleType == eAll &&
       !mContent->IsHTMLElement(nsGkAtoms::area)) {
     mOuterFrame = mContent->GetPrimaryFrame();
     mInnerFrame = mOuterFrame;
     if (mOuterFrame) {
       nsIAtom* type = mOuterFrame->GetType();
-      if (type == nsGkAtoms::tableOuterFrame) {
-        // If the frame is an outer table frame then we should get the style
+      if (type == nsGkAtoms::tableWrapperFrame) {
+        // If the frame is a table wrapper frame then we should get the style
         // from the inner table frame.
         mInnerFrame = mOuterFrame->PrincipalChildList().FirstChild();
-        NS_ASSERTION(mInnerFrame, "Outer table must have an inner");
+        NS_ASSERTION(mInnerFrame, "table wrapper must have an inner");
         NS_ASSERTION(!mInnerFrame->GetNextSibling(),
-                     "Outer table frames should have just one child, "
+                     "table wrapper frames should have just one child, "
                      "the inner table");
       }
 
       SetFrameStyleContext(mInnerFrame->StyleContext());
       NS_ASSERTION(mStyleContext, "Frame without style context?");
     }
   }
 
@@ -819,17 +815,16 @@ nsComputedDOMStyle::GetPropertyCSSValue(
     val = (this->*getter)();
   }
 
   ClearCurrentStyleSources();
 
   return val.forget();
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::RemoveProperty(const nsAString& aPropertyName,
                                    nsAString& aReturn)
 {
   return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
 }
 
 
@@ -837,34 +832,33 @@ NS_IMETHODIMP
 nsComputedDOMStyle::GetPropertyPriority(const nsAString& aPropertyName,
                                         nsAString& aReturn)
 {
   aReturn.Truncate();
 
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::SetProperty(const nsAString& aPropertyName,
                                 const nsAString& aValue,
                                 const nsAString& aPriority)
 {
   return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
 }
 
-
 NS_IMETHODIMP
 nsComputedDOMStyle::Item(uint32_t aIndex, nsAString& aReturn)
 {
   return nsDOMCSSDeclaration::Item(aIndex, aReturn);
 }
 
 void
-nsComputedDOMStyle::IndexedGetter(uint32_t aIndex, bool& aFound,
+nsComputedDOMStyle::IndexedGetter(uint32_t   aIndex,
+                                  bool&      aFound,
                                   nsAString& aPropName)
 {
   nsComputedStyleMap* map = GetComputedStyleMap();
   uint32_t length = map->Length();
 
   if (aIndex < length) {
     aFound = true;
     CopyASCIItoUTF16(nsCSSProps::GetStringValue(map->PropertyAt(aIndex)),
@@ -1851,19 +1845,19 @@ nsComputedDOMStyle::DoGetBackgroundClip(
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBackgroundColor()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   SetToRGBAColor(val, StyleBackground()->mBackgroundColor);
   return val.forget();
 }
 
-
 static void
-SetValueToCalc(const nsStyleCoord::CalcValue *aCalc, nsROCSSPrimitiveValue *aValue)
+SetValueToCalc(const nsStyleCoord::CalcValue* aCalc,
+               nsROCSSPrimitiveValue*         aValue)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   nsAutoString tmp, result;
 
   result.AppendLiteral("calc(");
 
   val->SetAppUnits(aCalc->mLength);
   val->GetCssText(tmp);
@@ -1878,35 +1872,35 @@ SetValueToCalc(const nsStyleCoord::CalcV
   }
 
   result.Append(')');
 
   aValue->SetString(result); // not really SetString
 }
 
 static void
-AppendCSSGradientLength(const nsStyleCoord& aValue,
+AppendCSSGradientLength(const nsStyleCoord&    aValue,
                         nsROCSSPrimitiveValue* aPrimitive,
-                        nsAString& aString)
+                        nsAString&             aString)
 {
   nsAutoString tokenString;
   if (aValue.IsCalcUnit())
     SetValueToCalc(aValue.GetCalcValue(), aPrimitive);
   else if (aValue.GetUnit() == eStyleUnit_Coord)
     aPrimitive->SetAppUnits(aValue.GetCoordValue());
   else
     aPrimitive->SetPercent(aValue.GetPercentValue());
   aPrimitive->GetCssText(tokenString);
   aString.Append(tokenString);
 }
 
 static void
 AppendCSSGradientToBoxPosition(const nsStyleGradient* aGradient,
-                               nsAString& aString,
-                               bool& aNeedSep)
+                               nsAString&             aString,
+                               bool&                  aNeedSep)
 {
   float xValue = aGradient->mBgPosX.GetPercentValue();
   float yValue = aGradient->mBgPosY.GetPercentValue();
 
   if (yValue == 1.0f && xValue == 0.5f) {
     // omit "to bottom"
     return;
   }
@@ -5204,17 +5198,17 @@ nsComputedDOMStyle::GetMarginWidthFor(mo
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   if (!mInnerFrame) {
     SetValueToCoord(val, StyleMargin()->mMargin.Get(aSide), false);
   } else {
     AssertFlushedPendingReflows();
 
     // For tables, GetUsedMargin always returns an empty margin, so we
-    // should read the margin from the outer table frame instead.
+    // should read the margin from the table wrapper frame instead.
     val->SetAppUnits(mOuterFrame->GetUsedMargin().Side(aSide));
     NS_ASSERTION(mOuterFrame == mInnerFrame ||
                  mInnerFrame->GetUsedMargin() == nsMargin(0, 0, 0, 0),
                  "Inner tables must have zero margins");
   }
 
   return val.forget();
 }
--- a/layout/style/res/ua.css
+++ b/layout/style/res/ua.css
@@ -16,17 +16,17 @@
   box-sizing: border-box; /* XXX do we really want this? */
 }
 
 *|*::-moz-inline-table {
   display: inline-table !important;
   box-sizing: border-box; /* XXX do we really want this? */
 }
 
-*|*::-moz-table-outer {
+*|*::-moz-table-wrapper {
   display: inherit !important; /* table or inline-table */
   margin: inherit ! important;
   padding: 0 ! important;
   border: none ! important;
   float: inherit;
   clear: inherit;
   position: inherit;
   top: inherit;
--- a/layout/tables/moz.build
+++ b/layout/tables/moz.build
@@ -16,20 +16,20 @@ EXPORTS += [
 UNIFIED_SOURCES += [
     'BasicTableLayoutStrategy.cpp',
     'FixedTableLayoutStrategy.cpp',
     'nsCellMap.cpp',
     'nsTableCellFrame.cpp',
     'nsTableColFrame.cpp',
     'nsTableColGroupFrame.cpp',
     'nsTableFrame.cpp',
-    'nsTableOuterFrame.cpp',
     'nsTablePainter.cpp',
     'nsTableRowFrame.cpp',
     'nsTableRowGroupFrame.cpp',
+    'nsTableWrapperFrame.cpp',
     'SpanningCellSorter.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../../intl/unicharutil/util',
     '../base',
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -108,17 +108,17 @@ nsTableCellFrame::DestroyFrom(nsIFrame* 
 // nsIPercentBSizeObserver methods
 
 void
 nsTableCellFrame::NotifyPercentBSize(const nsHTMLReflowState& aReflowState)
 {
   // nsHTMLReflowState ensures the mCBReflowState of blocks inside a
   // cell is the cell frame, not the inner-cell block, and that the
   // containing block of an inner table is the containing block of its
-  // outer table.
+  // table wrapper.
   // XXXldb Given the now-stricter |NeedsToObserve|, many if not all of
   // these tests are probably unnecessary.
 
   // Maybe the cell reflow state; we sure if we're inside the |if|.
   const nsHTMLReflowState *cellRS = aReflowState.mCBReflowState;
 
   if (cellRS && cellRS->frame == this &&
       (cellRS->ComputedBSize() == NS_UNCONSTRAINEDSIZE ||
@@ -161,31 +161,31 @@ nsTableCellFrame::NeedsToObserve(const n
     return true;
   }
   rs = rs->mParentReflowState;
   if (!rs) {
     return false;
   }
 
   // We always need to let the percent bsize observer be propagated
-  // from an outer table frame to an inner table frame.
+  // from a table wrapper frame to an inner table frame.
   nsIAtom *fType = aReflowState.frame->GetType();
   if (fType == nsGkAtoms::tableFrame) {
     return true;
   }
 
   // We need the observer to be propagated to all children of the cell
   // (i.e., children of the child block) in quirks mode, but only to
   // tables in standards mode.
   // XXX This may not be true in the case of orthogonal flows within
   // the cell (bug 1174711 comment 8); we may need to observe isizes
   // instead of bsizes for orthogonal children.
   return rs->frame == this &&
          (PresContext()->CompatibilityMode() == eCompatibility_NavQuirks ||
-          fType == nsGkAtoms::tableOuterFrame);
+          fType == nsGkAtoms::tableWrapperFrame);
 }
 
 nsresult
 nsTableCellFrame::GetRowIndex(int32_t &aRowIndex) const
 {
   nsresult result;
   nsTableRowFrame* row = static_cast<nsTableRowFrame*>(GetParent());
   if (row) {
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -17,17 +17,17 @@
 #include "nsIContent.h"
 #include "nsCellMap.h"
 #include "nsTableCellFrame.h"
 #include "nsHTMLParts.h"
 #include "nsTableColFrame.h"
 #include "nsTableColGroupFrame.h"
 #include "nsTableRowFrame.h"
 #include "nsTableRowGroupFrame.h"
-#include "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 #include "nsTablePainter.h"
 
 #include "BasicTableLayoutStrategy.h"
 #include "FixedTableLayoutStrategy.h"
 
 #include "nsPresContext.h"
 #include "nsContentUtils.h"
 #include "nsCSSRendering.h"
@@ -119,20 +119,20 @@ struct BCPropertyData
   BCPixelSize mIStartBorderWidth;
   BCPixelSize mIStartCellBorderWidth;
   BCPixelSize mIEndCellBorderWidth;
 };
 
 nsStyleContext*
 nsTableFrame::GetParentStyleContext(nsIFrame** aProviderFrame) const
 {
-  // Since our parent, the table outer frame, returned this frame, we
+  // Since our parent, the table wrapper frame, returned this frame, we
   // must return whatever our parent would normally have returned.
 
-  NS_PRECONDITION(GetParent(), "table constructed without outer table");
+  NS_PRECONDITION(GetParent(), "table constructed without table wrapper");
   if (!mContent->GetParent() && !StyleContext()->GetPseudo()) {
     // We're the root.  We have no style context parent.
     *aProviderFrame = nullptr;
     return nullptr;
   }
 
   return GetParent()->DoGetParentStyleContext(aProviderFrame);
 }
@@ -178,17 +178,17 @@ nsTableFrame::Init(nsIContent*       aCo
     mCellMap = new nsTableCellMap(*this, borderCollapse);
     if (IsAutoLayout()) {
       mTableLayoutStrategy = new BasicTableLayoutStrategy(this);
     } else {
       mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
     }
   } else {
     // Set my isize, because all frames in a table flow are the same isize and
-    // code in nsTableOuterFrame depends on this being set.
+    // code in nsTableWrapperFrame depends on this being set.
     WritingMode wm = GetWritingMode();
     SetSize(LogicalSize(wm, aPrevInFlow->ISize(wm), BSize(wm)));
   }
 }
 
 nsTableFrame::~nsTableFrame()
 {
   delete mCellMap;
@@ -2641,18 +2641,18 @@ nsTableFrame::GetUsedPadding() const
     return nsContainerFrame::GetUsedPadding();
 
   return nsMargin(0,0,0,0);
 }
 
 /* virtual */ nsMargin
 nsTableFrame::GetUsedMargin() const
 {
-  // The margin is inherited to the outer table frame via
-  // the ::-moz-table-outer rule in ua.css.
+  // The margin is inherited to the table wrapper frame via
+  // the ::-moz-table-wrapper rule in ua.css.
   return nsMargin(0, 0, 0, 0);
 }
 
 NS_DECLARE_FRAME_PROPERTY_DELETABLE(TableBCProperty, BCPropertyData)
 
 BCPropertyData*
 nsTableFrame::GetBCProperty(bool aCreateIfNecessary) const
 {
@@ -6482,17 +6482,17 @@ BCPaintBorderIterator::SetDamageArea(con
       }
       rowB += rowBSize;
     }
   }
   mNextOffsetB = mInitialOffsetB;
 
   // XXX comment refers to the obsolete NS_FRAME_OUTSIDE_CHILDREN flag
   // XXX but I don't understand it, so not changing it for now
-  // outer table borders overflow the table, so the table might be
+  // table wrapper borders overflow the table, so the table might be
   // target to other areas as the NS_FRAME_OUTSIDE_CHILDREN is set
   // on the table
   if (!haveIntersect)
     return false;
   // find startColIndex, endColIndex, startColX
   haveIntersect = false;
   if (0 == mNumTableCols)
     return false;
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -116,17 +116,17 @@ enum nsTableColType {
   eColContent            = 0, // there is real col content associated
   eColAnonymousCol       = 1, // the result of a span on a col
   eColAnonymousColGroup  = 2, // the result of a span on a col group
   eColAnonymousCell      = 3  // the result of a cell alone
 };
 
 /**
   * nsTableFrame maps the inner portion of a table (everything except captions.)
-  * Used as a pseudo-frame within nsTableOuterFrame, it may also be used
+  * Used as a pseudo-frame within nsTableWrapperFrame, it may also be used
   * stand-alone as the top-level frame.
   *
   * The principal child list contains row group frames. There is also an
   * additional child list, kColGroupList, which contains the col group frames.
   */
 class nsTableFrame : public nsContainerFrame
 {
   typedef mozilla::image::DrawResult DrawResult;
@@ -135,18 +135,18 @@ class nsTableFrame : public nsContainerF
 
 public:
   NS_DECL_QUERYFRAME_TARGET(nsTableFrame)
   NS_DECL_FRAMEARENA_HELPERS
 
   NS_DECLARE_FRAME_PROPERTY_DELETABLE(PositionedTablePartArray,
                                       nsTArray<nsIFrame*>)
 
-  /** nsTableOuterFrame has intimate knowledge of the inner table frame */
-  friend class nsTableOuterFrame;
+  /** nsTableWrapperFrame has intimate knowledge of the inner table frame */
+  friend class nsTableWrapperFrame;
 
   /** instantiate a new instance of nsTableRowFrame.
     * @param aPresShell the pres shell for this frame
     *
     * @return           the frame that was created
     */
   friend nsTableFrame* NS_NewTableFrame(nsIPresShell* aPresShell,
                                         nsStyleContext* aContext);
rename from layout/tables/nsTableOuterFrame.cpp
rename to layout/tables/nsTableWrapperFrame.cpp
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsTableOuterFrame.h"
+#include "nsTableWrapperFrame.h"
 
 #include "nsFrameManager.h"
 #include "nsTableFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsCSSRendering.h"
@@ -25,77 +25,77 @@
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::layout;
 
 #define NO_SIDE 100
 
 /* virtual */ nscoord
-nsTableOuterFrame::GetLogicalBaseline(WritingMode aWritingMode) const
+nsTableWrapperFrame::GetLogicalBaseline(WritingMode aWritingMode) const
 {
   nsIFrame* kid = mFrames.FirstChild();
   if (!kid) {
     NS_NOTREACHED("no inner table");
     return nsContainerFrame::GetLogicalBaseline(aWritingMode);
   }
 
   return kid->GetLogicalBaseline(aWritingMode) +
          kid->BStart(aWritingMode, mRect.Size());
 }
 
-nsTableOuterFrame::nsTableOuterFrame(nsStyleContext* aContext):
-  nsContainerFrame(aContext)
+nsTableWrapperFrame::nsTableWrapperFrame(nsStyleContext* aContext)
+  : nsContainerFrame(aContext)
 {
 }
 
-nsTableOuterFrame::~nsTableOuterFrame()
+nsTableWrapperFrame::~nsTableWrapperFrame()
 {
 }
 
-NS_QUERYFRAME_HEAD(nsTableOuterFrame)
-  NS_QUERYFRAME_ENTRY(nsTableOuterFrame)
+NS_QUERYFRAME_HEAD(nsTableWrapperFrame)
+  NS_QUERYFRAME_ENTRY(nsTableWrapperFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 #ifdef ACCESSIBILITY
 a11y::AccType
-nsTableOuterFrame::AccessibleType()
+nsTableWrapperFrame::AccessibleType()
 {
   return a11y::eHTMLTableType;
 }
 #endif
 
 void
-nsTableOuterFrame::DestroyFrom(nsIFrame* aDestructRoot)
+nsTableWrapperFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   DestroyAbsoluteFrames(aDestructRoot);
   mCaptionFrames.DestroyFramesFrom(aDestructRoot);
   nsContainerFrame::DestroyFrom(aDestructRoot);
 }
 
 const nsFrameList&
-nsTableOuterFrame::GetChildList(ChildListID aListID) const
+nsTableWrapperFrame::GetChildList(ChildListID aListID) const
 {
   if (aListID == kCaptionList) {
     return mCaptionFrames;
   }
 
   return nsContainerFrame::GetChildList(aListID);
 }
 
 void
-nsTableOuterFrame::GetChildLists(nsTArray<ChildList>* aLists) const
+nsTableWrapperFrame::GetChildLists(nsTArray<ChildList>* aLists) const
 {
   nsContainerFrame::GetChildLists(aLists);
   mCaptionFrames.AppendIfNonempty(aLists, kCaptionList);
 }
 
-void 
-nsTableOuterFrame::SetInitialChildList(ChildListID     aListID,
-                                       nsFrameList&    aChildList)
+void
+nsTableWrapperFrame::SetInitialChildList(ChildListID     aListID,
+                                         nsFrameList&    aChildList)
 {
   if (kCaptionList == aListID) {
     // the frame constructor already checked for table-caption display type
     MOZ_ASSERT(mCaptionFrames.IsEmpty(),
                "already have child frames in CaptionList");
     mCaptionFrames.SetFrames(aChildList);
   } else {
     MOZ_ASSERT(kPrincipalList != aListID ||
@@ -103,80 +103,78 @@ nsTableOuterFrame::SetInitialChildList(C
                 aChildList.FirstChild() == aChildList.LastChild() &&
                 nsGkAtoms::tableFrame == aChildList.FirstChild()->GetType()),
                "expected a single table frame in principal child list");
     nsContainerFrame::SetInitialChildList(aListID, aChildList);
   }
 }
 
 void
-nsTableOuterFrame::AppendFrames(ChildListID     aListID,
-                                nsFrameList&    aFrameList)
+nsTableWrapperFrame::AppendFrames(ChildListID     aListID,
+                                  nsFrameList&    aFrameList)
 {
   // We only have two child frames: the inner table and a caption frame.
   // The inner frame is provided when we're initialized, and it cannot change
   MOZ_ASSERT(kCaptionList == aListID, "unexpected child list");
   MOZ_ASSERT(aFrameList.IsEmpty() ||
              aFrameList.FirstChild()->IsTableCaption(),
              "appending non-caption frame to captionList");
   mCaptionFrames.AppendFrames(this, aFrameList);
 
   // Reflow the new caption frame. It's already marked dirty, so
   // just tell the pres shell.
-  PresContext()->PresShell()->
-    FrameNeedsReflow(this, nsIPresShell::eTreeChange,
-                     NS_FRAME_HAS_DIRTY_CHILDREN);
+  PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+                                               NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void
-nsTableOuterFrame::InsertFrames(ChildListID     aListID,
-                                nsIFrame*       aPrevFrame,
-                                nsFrameList&    aFrameList)
+nsTableWrapperFrame::InsertFrames(ChildListID     aListID,
+                                  nsIFrame*       aPrevFrame,
+                                  nsFrameList&    aFrameList)
 {
   MOZ_ASSERT(kCaptionList == aListID, "unexpected child list");
   MOZ_ASSERT(aFrameList.IsEmpty() ||
              aFrameList.FirstChild()->IsTableCaption(),
              "inserting non-caption frame into captionList");
   MOZ_ASSERT(!aPrevFrame || aPrevFrame->GetParent() == this,
              "inserting after sibling frame with different parent");
   mCaptionFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
 
   // Reflow the new caption frame. It's already marked dirty, so
   // just tell the pres shell.
-  PresContext()->PresShell()->
-    FrameNeedsReflow(this, nsIPresShell::eTreeChange,
-                     NS_FRAME_HAS_DIRTY_CHILDREN);
+  PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
+                                               NS_FRAME_HAS_DIRTY_CHILDREN);
 }
 
 void
-nsTableOuterFrame::RemoveFrame(ChildListID     aListID,
-                               nsIFrame*       aOldFrame)
+nsTableWrapperFrame::RemoveFrame(ChildListID  aListID,
+                                 nsIFrame*    aOldFrame)
 {
   // We only have two child frames: the inner table and one caption frame.
   // The inner frame can't be removed so this should be the caption
   NS_PRECONDITION(kCaptionList == aListID, "can't remove inner frame");
 
   if (HasSideCaption()) {
     // The old caption isize had an effect on the inner table isize, so
     // we're going to need to reflow it. Mark it dirty
     InnerTableFrame()->AddStateBits(NS_FRAME_IS_DIRTY);
   }
 
   // Remove the frame and destroy it
   mCaptionFrames.DestroyFrame(aOldFrame);
-  
+
   PresContext()->PresShell()->
     FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                      NS_FRAME_HAS_DIRTY_CHILDREN); // also means child removed
 }
 
 void
-nsTableOuterFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
-                                    const nsRect&           aDirtyRect,
-                                    const nsDisplayListSet& aLists)
+nsTableWrapperFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
+                                      const nsRect&           aDirtyRect,
+                                      const nsDisplayListSet& aLists)
 {
   // No border, background or outline are painted because they all belong
   // to the inner table.
 
   // If there's no caption, take a short cut to avoid having to create
   // the special display list set and then sort it.
   if (mCaptionFrames.IsEmpty()) {
     BuildDisplayListForInnerTable(aBuilder, aDirtyRect, aLists);
@@ -184,60 +182,59 @@ nsTableOuterFrame::BuildDisplayList(nsDi
   }
 
   nsDisplayListCollection set;
   BuildDisplayListForInnerTable(aBuilder, aDirtyRect, set);
   
   nsDisplayListSet captionSet(set, set.BlockBorderBackgrounds());
   BuildDisplayListForChild(aBuilder, mCaptionFrames.FirstChild(),
                            aDirtyRect, captionSet);
-  
+
   // Now we have to sort everything by content order, since the caption
   // may be somewhere inside the table
   set.SortAllByContentOrder(GetContent());
   set.MoveTo(aLists);
 }
 
 void
-nsTableOuterFrame::BuildDisplayListForInnerTable(nsDisplayListBuilder*   aBuilder,
-                                                 const nsRect&           aDirtyRect,
-                                                 const nsDisplayListSet& aLists)
+nsTableWrapperFrame::BuildDisplayListForInnerTable(nsDisplayListBuilder*   aBuilder,
+                                                   const nsRect&           aDirtyRect,
+                                                   const nsDisplayListSet& aLists)
 {
   // Just paint the regular children, but the children's background is our
   // true background (there should only be one, the real table)
   nsIFrame* kid = mFrames.FirstChild();
   // The children should be in content order
   while (kid) {
     BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
     kid = kid->GetNextSibling();
   }
 }
 
 nsStyleContext*
-nsTableOuterFrame::GetParentStyleContext(nsIFrame** aProviderFrame) const
+nsTableWrapperFrame::GetParentStyleContext(nsIFrame** aProviderFrame) const
 {
-  // The table outer frame and the (inner) table frame split the style
+  // The table wrapper frame and the (inner) table frame split the style
   // data by giving the table frame the style context associated with
-  // the table content node and creating a style context for the outer
+  // the table content node and creating a style context for the wrapper
   // frame that is a *child* of the table frame's style context,
-  // matching the ::-moz-table-outer pseudo-element.  html.css has a
-  // rule that causes that pseudo-element (and thus the outer table)
+  // matching the ::-moz-table-wrapper pseudo-element. html.css has a
+  // rule that causes that pseudo-element (and thus the wrapper table)
   // to inherit *some* style properties from the table frame.  The
   // children of the table inherit directly from the inner table, and
-  // the outer table's style context is a leaf.
+  // the table wrapper's style context is a leaf.
 
   return (*aProviderFrame = InnerTableFrame())->StyleContext();
 }
 
 // INCREMENTAL REFLOW HELPER FUNCTIONS 
 
 void
-nsTableOuterFrame::InitChildReflowState(nsPresContext&    aPresContext,                     
-                                        nsHTMLReflowState& aReflowState)
-                                    
+nsTableWrapperFrame::InitChildReflowState(nsPresContext&     aPresContext,
+                                          nsHTMLReflowState& aReflowState)
 {
   nsMargin collapseBorder;
   nsMargin collapsePadding(0,0,0,0);
   nsMargin* pCollapseBorder  = nullptr;
   nsMargin* pCollapsePadding = nullptr;
   if (aReflowState.frame == InnerTableFrame() &&
       InnerTableFrame()->IsBorderCollapse()) {
     WritingMode wm = aReflowState.GetWritingMode();
@@ -247,21 +244,21 @@ nsTableOuterFrame::InitChildReflowState(
     pCollapsePadding = &collapsePadding;
   }
   aReflowState.Init(&aPresContext, nullptr, pCollapseBorder, pCollapsePadding);
 }
 
 // get the margin and padding data. nsHTMLReflowState doesn't handle the
 // case of auto margins
 void
-nsTableOuterFrame::GetChildMargin(nsPresContext*           aPresContext,
-                                  const nsHTMLReflowState& aOuterRS,
-                                  nsIFrame*                aChildFrame,
-                                  nscoord                  aAvailISize,
-                                  LogicalMargin&           aMargin)
+nsTableWrapperFrame::GetChildMargin(nsPresContext*           aPresContext,
+                                    const nsHTMLReflowState& aOuterRS,
+                                    nsIFrame*                aChildFrame,
+                                    nscoord                  aAvailISize,
+                                    LogicalMargin&           aMargin)
 {
   NS_ASSERTION(!aChildFrame->IsTableCaption(),
                "didn't expect caption frame; writing-mode may be wrong!");
 
   // construct a reflow state to compute margin and padding. Auto margins
   // will not be computed at this time.
 
   // create and init the child reflow state
@@ -290,17 +287,17 @@ GetContainingBlockSize(const nsHTMLReflo
     if (NS_UNCONSTRAINEDSIZE == size.height) {
       size.height = 0;
     }
   }
   return size;
 }
 
 /* virtual */ nscoord
-nsTableOuterFrame::GetMinISize(nsRenderingContext *aRenderingContext)
+nsTableWrapperFrame::GetMinISize(nsRenderingContext *aRenderingContext)
 {
   nscoord iSize = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                     InnerTableFrame(), nsLayoutUtils::MIN_ISIZE);
   DISPLAY_MIN_WIDTH(this, iSize);
   if (mCaptionFrames.NotEmpty()) {
     nscoord capISize =
       nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                                            mCaptionFrames.FirstChild(),
@@ -312,17 +309,17 @@ nsTableOuterFrame::GetMinISize(nsRenderi
         iSize = capISize;
       }
     }
   }
   return iSize;
 }
 
 /* virtual */ nscoord
-nsTableOuterFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
+nsTableWrapperFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
 {
   nscoord maxISize;
   DISPLAY_PREF_WIDTH(this, maxISize);
 
   maxISize = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                InnerTableFrame(), nsLayoutUtils::PREF_ISIZE);
   if (mCaptionFrames.NotEmpty()) {
     uint8_t captionSide = GetCaptionSide();
@@ -393,28 +390,28 @@ ChildShrinkWrapISize(nsRenderingContext 
   if (aMarginResult) {
     *aMarginResult = offsets.ComputedLogicalMargin().IStartEnd(aWM);
   }
   return size.ISize(aWM) + marginSize.ISize(aWM) + bpSize.ISize(aWM);
 }
 
 /* virtual */
 LogicalSize
-nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
-                                   WritingMode aWM,
-                                   const LogicalSize& aCBSize,
-                                   nscoord aAvailableISize,
-                                   const LogicalSize& aMargin,
-                                   const LogicalSize& aBorder,
-                                   const LogicalSize& aPadding,
-                                   bool aShrinkWrap)
+nsTableWrapperFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
+                                     WritingMode aWM,
+                                     const LogicalSize& aCBSize,
+                                     nscoord aAvailableISize,
+                                     const LogicalSize& aMargin,
+                                     const LogicalSize& aBorder,
+                                     const LogicalSize& aPadding,
+                                     bool aShrinkWrap)
 {
   nscoord kidAvailableISize = aAvailableISize - aMargin.ISize(aWM);
   NS_ASSERTION(aBorder.IsAllZero() && aPadding.IsAllZero(),
-               "Table outer frames cannot have borders or paddings");
+               "Table wrapper frames cannot have borders or paddings");
 
   // When we're shrink-wrapping, our auto size needs to wrap around the
   // actual size of the table, which (if it is specified as a percent)
   // could be something that is not reflected in our GetMinISize and
   // GetPrefISize.  See bug 349457 for an example.
 
   // Match the availableISize logic in Reflow.
   uint8_t captionSide = GetCaptionSide();
@@ -455,45 +452,46 @@ nsTableOuterFrame::ComputeAutoSize(nsRen
       inlineSize = capISize;
     }
   }
 
   return LogicalSize(aWM, inlineSize, NS_UNCONSTRAINEDSIZE);
 }
 
 uint8_t
-nsTableOuterFrame::GetCaptionSide()
+nsTableWrapperFrame::GetCaptionSide()
 {
   if (mCaptionFrames.NotEmpty()) {
     return mCaptionFrames.FirstChild()->StyleTableBorder()->mCaptionSide;
   }
   else {
     return NO_SIDE; // no caption
   }
 }
 
 uint8_t
-nsTableOuterFrame::GetCaptionVerticalAlign()
+nsTableWrapperFrame::GetCaptionVerticalAlign()
 {
   const nsStyleCoord& va =
     mCaptionFrames.FirstChild()->StyleDisplay()->mVerticalAlign;
+
   return (va.GetUnit() == eStyleUnit_Enumerated)
            ? va.GetIntValue()
            : NS_STYLE_VERTICAL_ALIGN_TOP;
 }
 
 void
-nsTableOuterFrame::SetDesiredSize(uint8_t              aCaptionSide,
-                                  const LogicalSize&   aInnerSize,
-                                  const LogicalSize&   aCaptionSize,
-                                  const LogicalMargin& aInnerMargin,
-                                  const LogicalMargin& aCaptionMargin,
-                                  nscoord&             aISize,
-                                  nscoord&             aBSize,
-                                  WritingMode          aWM)
+nsTableWrapperFrame::SetDesiredSize(uint8_t              aCaptionSide,
+                                    const LogicalSize&   aInnerSize,
+                                    const LogicalSize&   aCaptionSize,
+                                    const LogicalMargin& aInnerMargin,
+                                    const LogicalMargin& aCaptionMargin,
+                                    nscoord&             aISize,
+                                    nscoord&             aBSize,
+                                    WritingMode          aWM)
 {
   aISize = aBSize = 0;
 
   // compute the overall inline-size
   switch (aCaptionSide) {
     case NS_STYLE_CAPTION_SIDE_LEFT:
       aISize =
         std::max(aInnerMargin.LineLeft(aWM),
@@ -542,25 +540,25 @@ nsTableOuterFrame::SetDesiredSize(uint8_
       break;
   }
 
   // negative sizes can upset overflow-area code
   aISize = std::max(aISize, 0);
   aBSize = std::max(aBSize, 0);
 }
 
-nsresult 
-nsTableOuterFrame::GetCaptionOrigin(uint32_t             aCaptionSide,
-                                    const LogicalSize&   aContainBlockSize,
-                                    const LogicalSize&   aInnerSize, 
-                                    const LogicalMargin& aInnerMargin,
-                                    const LogicalSize&   aCaptionSize,
-                                    LogicalMargin&       aCaptionMargin,
-                                    LogicalPoint&        aOrigin,
-                                    WritingMode          aWM)
+nsresult
+nsTableWrapperFrame::GetCaptionOrigin(uint32_t             aCaptionSide,
+                                      const LogicalSize&   aContainBlockSize,
+                                      const LogicalSize&   aInnerSize,
+                                      const LogicalMargin& aInnerMargin,
+                                      const LogicalSize&   aCaptionSize,
+                                      LogicalMargin&       aCaptionMargin,
+                                      LogicalPoint&        aOrigin,
+                                      WritingMode          aWM)
 {
   aOrigin.I(aWM) = aOrigin.B(aWM) = 0;
   if ((NS_UNCONSTRAINEDSIZE == aInnerSize.ISize(aWM)) ||
       (NS_UNCONSTRAINEDSIZE == aInnerSize.BSize(aWM)) ||
       (NS_UNCONSTRAINEDSIZE == aCaptionSize.ISize(aWM)) ||
       (NS_UNCONSTRAINEDSIZE == aCaptionSize.BSize(aWM))) {
     return NS_OK;
   }
@@ -634,25 +632,25 @@ nsTableOuterFrame::GetCaptionOrigin(uint
       break;
     default:
       NS_NOTREACHED("Unknown caption alignment type");
       break;
   }
   return NS_OK;
 }
 
-nsresult 
-nsTableOuterFrame::GetInnerOrigin(uint32_t             aCaptionSide,
-                                  const LogicalSize&   aContainBlockSize,
-                                  const LogicalSize&   aCaptionSize, 
-                                  const LogicalMargin& aCaptionMargin,
-                                  const LogicalSize&   aInnerSize,
-                                  LogicalMargin&       aInnerMargin,
-                                  LogicalPoint&        aOrigin,
-                                  WritingMode          aWM)
+nsresult
+nsTableWrapperFrame::GetInnerOrigin(uint32_t             aCaptionSide,
+                                    const LogicalSize&   aContainBlockSize,
+                                    const LogicalSize&   aCaptionSize,
+                                    const LogicalMargin& aCaptionMargin,
+                                    const LogicalSize&   aInnerSize,
+                                    LogicalMargin&       aInnerMargin,
+                                    LogicalPoint&        aOrigin,
+                                    WritingMode          aWM)
 {
   NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.IStart(aWM) &&
                NS_AUTOMARGIN != aCaptionMargin.IEnd(aWM),
                "The computed caption margin is auto?");
   NS_ASSERTION(NS_AUTOMARGIN != aInnerMargin.IStart(aWM) &&
                NS_AUTOMARGIN != aInnerMargin.IEnd(aWM) &&
                NS_AUTOMARGIN != aInnerMargin.BStart(aWM) &&
                NS_AUTOMARGIN != aInnerMargin.BEnd(aWM),
@@ -727,21 +725,21 @@ nsTableOuterFrame::GetInnerOrigin(uint32
     default:
       NS_NOTREACHED("Unknown caption alignment type");
       break;
   }
   return NS_OK;
 }
 
 void
-nsTableOuterFrame::OuterBeginReflowChild(nsPresContext*            aPresContext,
-                                         nsIFrame*                 aChildFrame,
-                                         const nsHTMLReflowState&  aOuterRS,
-                                         Maybe<nsHTMLReflowState>& aChildRS,
-                                         nscoord                   aAvailISize)
+nsTableWrapperFrame::OuterBeginReflowChild(nsPresContext*            aPresContext,
+                                           nsIFrame*                 aChildFrame,
+                                           const nsHTMLReflowState&  aOuterRS,
+                                           Maybe<nsHTMLReflowState>& aChildRS,
+                                           nscoord                   aAvailISize)
 {
   // work around pixel rounding errors, round down to ensure we don't exceed the avail height in
   WritingMode wm = aChildFrame->GetWritingMode();
   LogicalSize outerSize = aOuterRS.AvailableSize(wm);
   nscoord availBSize = outerSize.BSize(wm);
   if (NS_UNCONSTRAINEDSIZE != availBSize) {
     if (mCaptionFrames.FirstChild() == aChildFrame) {
       availBSize = NS_UNCONSTRAINEDSIZE;
@@ -773,72 +771,72 @@ nsTableOuterFrame::OuterBeginReflowChild
     if (captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM ||
         captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE) {
       aChildRS->mFlags.mIsTopOfPage = false;
     }
   }
 }
 
 void
-nsTableOuterFrame::OuterDoReflowChild(nsPresContext*             aPresContext,
-                                      nsIFrame*                  aChildFrame,
-                                      const nsHTMLReflowState&   aChildRS,
-                                      nsHTMLReflowMetrics&       aMetrics,
-                                      nsReflowStatus&            aStatus)
+nsTableWrapperFrame::OuterDoReflowChild(nsPresContext*             aPresContext,
+                                        nsIFrame*                  aChildFrame,
+                                        const nsHTMLReflowState&   aChildRS,
+                                        nsHTMLReflowMetrics&       aMetrics,
+                                        nsReflowStatus&            aStatus)
 {
   // Using zero as containerSize here because we want consistency between
   // the GetLogicalPosition and ReflowChild calls, to avoid unnecessarily
   // changing the frame's coordinates; but we don't yet know its final
   // position anyway so the actual value is unimportant.
   const nsSize zeroCSize;
   WritingMode wm = aChildRS.GetWritingMode();
 
   // Use the current position as a best guess for placement.
   LogicalPoint childPt = aChildFrame->GetLogicalPosition(wm, zeroCSize);
   uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
 
   // We don't want to delete our next-in-flow's child if it's an inner table
-  // frame, because outer table frames always assume that their inner table
-  // frames don't go away. If an outer table frame is removed because it is
-  // a next-in-flow of an already complete outer table frame, then it will
+  // frame, because table wrapper frames always assume that their inner table
+  // frames don't go away. If a table wrapper frame is removed because it is
+  // a next-in-flow of an already complete table wrapper frame, then it will
   // take care of removing it's inner table frame.
   if (aChildFrame == InnerTableFrame()) {
     flags |= NS_FRAME_NO_DELETE_NEXT_IN_FLOW_CHILD;
   }
 
   ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRS,
               wm, childPt, zeroCSize, flags, aStatus);
 }
 
-void 
-nsTableOuterFrame::UpdateOverflowAreas(nsHTMLReflowMetrics& aMet)
+void
+nsTableWrapperFrame::UpdateOverflowAreas(nsHTMLReflowMetrics& aMet)
 {
   aMet.SetOverflowAreasToDesiredBounds();
   ConsiderChildOverflow(aMet.mOverflowAreas, InnerTableFrame());
   if (mCaptionFrames.NotEmpty()) {
     ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild());
   }
 }
 
 void
-nsTableOuterFrame::Reflow(nsPresContext*           aPresContext,
-                          nsHTMLReflowMetrics&     aDesiredSize,
-                          const nsHTMLReflowState& aOuterRS,
-                          nsReflowStatus&          aStatus)
+nsTableWrapperFrame::Reflow(nsPresContext*           aPresContext,
+                            nsHTMLReflowMetrics&     aDesiredSize,
+                            const nsHTMLReflowState& aOuterRS,
+                            nsReflowStatus&          aStatus)
 {
   MarkInReflow();
-  DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame");
+  DO_GLOBAL_REFLOW_COUNT("nsTableWrapperFrame");
   DISPLAY_REFLOW(aPresContext, this, aOuterRS, aDesiredSize, aStatus);
 
   // Initialize out parameters
   aDesiredSize.ClearSize();
   aStatus = NS_FRAME_COMPLETE;
 
   if (!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
-    // Set up our kids.  They're already present, on an overflow list, 
+    // Set up our kids.  They're already present, on an overflow list,
     // or there are none so we'll create them now
     MoveOverflowToChildList();
   }
 
   Maybe<nsHTMLReflowState> captionRS;
   Maybe<nsHTMLReflowState> innerRS;
 
   nsRect origInnerRect = InnerTableFrame()->GetRect();
@@ -1008,48 +1006,48 @@ nsTableOuterFrame::Reflow(nsPresContext*
   FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRS, aStatus);
 
   // Return our desired rect
 
   NS_FRAME_SET_TRUNCATION(aStatus, aOuterRS, aDesiredSize);
 }
 
 nsIAtom*
-nsTableOuterFrame::GetType() const
+nsTableWrapperFrame::GetType() const
 {
-  return nsGkAtoms::tableOuterFrame;
+  return nsGkAtoms::tableWrapperFrame;
 }
 
 /* ----- global methods ----- */
 
 nsIContent*
-nsTableOuterFrame::GetCellAt(uint32_t aRowIdx, uint32_t aColIdx) const
+nsTableWrapperFrame::GetCellAt(uint32_t aRowIdx, uint32_t aColIdx) const
 {
   nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
   if (!cellMap) {
     return nullptr;
   }
 
   nsTableCellFrame* cell = cellMap->GetCellInfoAt(aRowIdx, aColIdx);
   if (!cell) {
     return nullptr;
   }
 
   return cell->GetContent();
 }
 
 
-nsTableOuterFrame*
-NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
+nsTableWrapperFrame*
+NS_NewTableWrapperFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
-  return new (aPresShell) nsTableOuterFrame(aContext);
+  return new (aPresShell) nsTableWrapperFrame(aContext);
 }
 
-NS_IMPL_FRAMEARENA_HELPERS(nsTableOuterFrame)
+NS_IMPL_FRAMEARENA_HELPERS(nsTableWrapperFrame)
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult
-nsTableOuterFrame::GetFrameName(nsAString& aResult) const
+nsTableWrapperFrame::GetFrameName(nsAString& aResult) const
 {
-  return MakeFrameName(NS_LITERAL_STRING("TableOuter"), aResult);
+  return MakeFrameName(NS_LITERAL_STRING("TableWrapper"), aResult);
 }
 #endif
 
rename from layout/tables/nsTableOuterFrame.h
rename to layout/tables/nsTableWrapperFrame.h
--- a/layout/tables/nsTableOuterFrame.h
+++ b/layout/tables/nsTableWrapperFrame.h
@@ -1,43 +1,43 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
-#ifndef nsTableOuterFrame_h__
-#define nsTableOuterFrame_h__
+#ifndef nsTableWrapperFrame_h__
+#define nsTableWrapperFrame_h__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsCellMap.h"
 #include "nsTableFrame.h"
 
 /**
  * Primary frame for a table element,
- * the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
+ * the nsTableWrapperFrame contains 0 or one caption frame, and a nsTableFrame
  * pseudo-frame (referred to as the "inner frame').
  */
-class nsTableOuterFrame : public nsContainerFrame
+class nsTableWrapperFrame : public nsContainerFrame
 {
 public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
-  NS_DECL_QUERYFRAME_TARGET(nsTableOuterFrame)
+  NS_DECL_QUERYFRAME_TARGET(nsTableWrapperFrame)
 
   /** instantiate a new instance of nsTableRowFrame.
     * @param aPresShell the pres shell for this frame
     *
     * @return           the frame that was created
     */
-  friend nsTableOuterFrame* NS_NewTableOuterFrame(nsIPresShell* aPresShell,
-                                                  nsStyleContext* aContext);
-  
+  friend nsTableWrapperFrame* NS_NewTableWrapperFrame(nsIPresShell* aPresShell,
+                                                      nsStyleContext* aContext);
+
   // nsIFrame overrides - see there for a description
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
 
   virtual const nsFrameList& GetChildList(ChildListID aListID) const override;
   virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
 
   virtual void SetInitialChildList(ChildListID     aListID,
@@ -87,17 +87,17 @@ public:
   virtual void Reflow(nsPresContext*           aPresContext,
                       nsHTMLReflowMetrics&     aDesiredSize,
                       const nsHTMLReflowState& aReflowState,
                       nsReflowStatus&          aStatus) override;
 
   /**
    * Get the "type" of the frame
    *
-   * @see nsGkAtoms::tableOuterFrame
+   * @see nsGkAtoms::tableWrapperFrame
    */
   virtual nsIAtom* GetType() const override;
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
 #endif
 
   virtual nsStyleContext* GetParentStyleContext(nsIFrame** aProviderFrame) const override;
@@ -177,20 +177,20 @@ public:
   {
     nsTableCellMap* map = InnerTableFrame()->GetCellMap();
     return map->GetEffectiveRowSpan(aRowIdx, aColIdx);
   }
 
 protected:
 
 
-  explicit nsTableOuterFrame(nsStyleContext* aContext);
-  virtual ~nsTableOuterFrame();
+  explicit nsTableWrapperFrame(nsStyleContext* aContext);
+  virtual ~nsTableWrapperFrame();
 
-  void InitChildReflowState(nsPresContext&    aPresContext,                     
+  void InitChildReflowState(nsPresContext&     aPresContext,
                             nsHTMLReflowState& aReflowState);
 
   // Get a NS_STYLE_CAPTION_SIDE_* value, or NO_SIDE if no caption is present.
   // (Remember that caption-side values are interpreted logically, despite
   // having "physical" names.)
   uint8_t GetCaptionSide();
 
   bool HasSideCaption() {
@@ -252,17 +252,18 @@ protected:
                       mozilla::LogicalMargin&  aMargin);
 
   virtual bool IsFrameOfType(uint32_t aFlags) const override
   {
     return nsContainerFrame::IsFrameOfType(aFlags &
                                            (~eCanContainOverflowContainers));
   }
 
-  nsTableFrame* InnerTableFrame() const {
+  nsTableFrame* InnerTableFrame() const
+  {
     return static_cast<nsTableFrame*>(mFrames.FirstChild());
   }
-  
+
 private:
   nsFrameList   mCaptionFrames;
 };
 
 #endif
--- a/media/mtransport/test_nr_socket.cpp
+++ b/media/mtransport/test_nr_socket.cpp
@@ -382,17 +382,17 @@ int TestNrSocket::recvfrom(void *buf, si
   if (readable_socket_) {
     // If any of the external sockets got data, see if it will be passed through
     r = readable_socket_->recvfrom(buf, maxlen, len, 0, from);
     readable_socket_ = nullptr;
     if (!r) {
       PortMapping *port_mapping_used;
       ingress_allowed = allow_ingress(*from, &port_mapping_used);
       if (ingress_allowed) {
-        r_log(LOG_GENERIC, LOG_INFO, "TestNrSocket %s received from %s via %s",
+        r_log(LOG_GENERIC, LOG_DEBUG, "TestNrSocket %s received from %s via %s",
               internal_socket_->my_addr().as_string,
               from->as_string,
               port_mapping_used->external_socket_->my_addr().as_string);
         if (nat_->refresh_on_ingress_) {
           port_mapping_used->last_used_ = PR_IntervalNow();
         }
       }
     }
@@ -407,17 +407,17 @@ int TestNrSocket::recvfrom(void *buf, si
       ingress_allowed = (!nat_->enabled_ ||
                          nat_->is_an_internal_tuple(*from));
       if (!ingress_allowed) {
         r_log(LOG_GENERIC, LOG_INFO, "TestNrSocket %s denying ingress from %s: "
               "Not behind the same NAT",
               internal_socket_->my_addr().as_string,
               from->as_string);
       } else {
-        r_log(LOG_GENERIC, LOG_INFO, "TestNrSocket %s received from %s",
+        r_log(LOG_GENERIC, LOG_DEBUG, "TestNrSocket %s received from %s",
               internal_socket_->my_addr().as_string,
               from->as_string);
       }
     }
   }
 
   // Kinda lame that we are forced to give the app a readable callback and then
   // say "Oh, never mind...", but the alternative is to totally decouple the
@@ -507,28 +507,28 @@ int TestNrSocket::connect(nr_transport_a
 
   return r;
 }
 
 int TestNrSocket::write(const void *msg, size_t len, size_t *written) {
 
   if (port_mappings_.empty()) {
     // The no-nat case, just pass call through.
-    r_log(LOG_GENERIC, LOG_INFO, "TestNrSocket %s writing",
+    r_log(LOG_GENERIC, LOG_DEBUG, "TestNrSocket %s writing",
           my_addr().as_string);
 
     return internal_socket_->write(msg, len, written);
   } else {
     destroy_stale_port_mappings();
     if (port_mappings_.empty()) {
       return -1;
     }
     // This is TCP only
     MOZ_ASSERT(port_mappings_.size() == 1);
-    r_log(LOG_GENERIC, LOG_INFO,
+    r_log(LOG_GENERIC, LOG_DEBUG,
           "PortMapping %s -> %s writing",
           port_mappings_.front()->external_socket_->my_addr().as_string,
           port_mappings_.front()->remote_address_.as_string);
 
     port_mappings_.front()->last_used_ = PR_IntervalNow();
     return port_mappings_.front()->external_socket_->write(msg, len, written);
   }
 }
@@ -742,17 +742,17 @@ void TestNrSocket::write_to_port_mapping
                   this);
   }
 }
 
 void TestNrSocket::port_mapping_tcp_passthrough_callback(void *ext_sock_v,
                                                          int how,
                                                          void *test_sock_v) {
   TestNrSocket *test_socket = static_cast<TestNrSocket*>(test_sock_v);
-  r_log(LOG_GENERIC, LOG_INFO,
+  r_log(LOG_GENERIC, LOG_DEBUG,
         "TestNrSocket %s firing %s callback",
         test_socket->internal_socket_->my_addr().as_string,
         how == NR_ASYNC_WAIT_READ ? "readable" : "writeable");
 
 
   test_socket->internal_socket_->fire_callback(how);
 }
 
@@ -808,61 +808,61 @@ TestNrSocket::PortMapping::PortMapping(
 }
 
 int TestNrSocket::PortMapping::send_from_queue() {
   MOZ_ASSERT(remote_address_.protocol != IPPROTO_TCP);
   int r = 0;
 
   while (!send_queue_.empty()) {
     UdpPacket &packet = *send_queue_.front();
-    r_log(LOG_GENERIC, LOG_INFO,
+    r_log(LOG_GENERIC, LOG_DEBUG,
           "PortMapping %s -> %s sending from queue to %s",
           external_socket_->my_addr().as_string,
           remote_address_.as_string,
           packet.remote_address_.as_string);
 
     r = external_socket_->sendto(packet.buffer_->data(),
                                  packet.buffer_->len(),
                                  0,
                                  &packet.remote_address_);
 
     if (r) {
       if (r != R_WOULDBLOCK) {
         r_log(LOG_GENERIC, LOG_ERR, "%s: Fatal error %d, stop trying",
               __FUNCTION__, r);
         send_queue_.clear();
       } else {
-        r_log(LOG_GENERIC, LOG_INFO, "Would block, will retry later");
+        r_log(LOG_GENERIC, LOG_DEBUG, "Would block, will retry later");
       }
       break;
     }
 
     send_queue_.pop_front();
   }
 
   return r;
 }
 
 int TestNrSocket::PortMapping::sendto(const void *msg,
                                       size_t len,
                                       const nr_transport_addr &to) {
   MOZ_ASSERT(remote_address_.protocol != IPPROTO_TCP);
-  r_log(LOG_GENERIC, LOG_INFO,
+  r_log(LOG_GENERIC, LOG_DEBUG,
         "PortMapping %s -> %s sending to %s",
         external_socket_->my_addr().as_string,
         remote_address_.as_string,
         to.as_string);
 
   last_used_ = PR_IntervalNow();
   int r = external_socket_->sendto(msg, len, 0,
       // TODO(bug 1170299): Remove const_cast when no longer necessary
       const_cast<nr_transport_addr*>(&to));
 
   if (r == R_WOULDBLOCK) {
-    r_log(LOG_GENERIC, LOG_INFO, "Enqueueing UDP packet to %s", to.as_string);
+    r_log(LOG_GENERIC, LOG_DEBUG, "Enqueueing UDP packet to %s", to.as_string);
     send_queue_.push_back(RefPtr<UdpPacket>(new UdpPacket(msg, len, to)));
     return 0;
   } else if (r) {
     r_log(LOG_GENERIC,LOG_ERR, "Error: %d", r);
   }
 
   return r;
 }
--- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
@@ -393,20 +393,22 @@ JsepTrack::Negotiate(const SdpMediaSecti
   CreateEncodings(remote, negotiatedCodecs.values, negotiatedDetails.get());
 
   if (answer.GetAttributeList().HasAttribute(SdpAttribute::kExtmapAttribute)) {
     for (auto& extmapAttr : answer.GetAttributeList().GetExtmap().mExtmaps) {
       negotiatedDetails->mExtmap[extmapAttr.extensionname] = extmapAttr;
     }
   }
 
-  if ((mDirection == sdp::kRecv) &&
-      remote.GetAttributeList().HasAttribute(SdpAttribute::kSsrcAttribute)) {
-    for (auto& ssrcAttr : remote.GetAttributeList().GetSsrc().mSsrcs) {
-      AddSsrc(ssrcAttr.ssrc);
+  if (mDirection == sdp::kRecv) {
+    mSsrcs.clear();
+    if (remote.GetAttributeList().HasAttribute(SdpAttribute::kSsrcAttribute)) {
+      for (auto& ssrcAttr : remote.GetAttributeList().GetSsrc().mSsrcs) {
+        AddSsrc(ssrcAttr.ssrc);
+      }
     }
   }
 
   mNegotiatedDetails = Move(negotiatedDetails);
 }
 
 // When doing bundle, if all else fails we can try to figure out which m-line a
 // given RTP packet belongs to by looking at the payload type field. This only
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
@@ -57,24 +57,27 @@ sdp_mca_t *sdp_alloc_mca (uint32_t line)
  * copy token param with chars from str until null, cr, lf, or one of the delimiters is found.
  * delimiters at the beginning will be skipped.
  * The pointer *string_of_tokens is moved forward to the next token on sucess.
  *
  */
 static sdp_result_e next_token(const char **string_of_tokens, char *token, unsigned token_max_len, const char *delim)
 {
   int flag2moveon = 0;
-  const char *str = *string_of_tokens;
-  const char *token_end = token + token_max_len - 1;
+  const char *str;
+  const char *token_end;
   const char *next_delim;
 
   if (!string_of_tokens || !*string_of_tokens || !token || !delim) {
     return SDP_FAILURE;
   }
 
+  str = *string_of_tokens;
+  token_end = token + token_max_len - 1;
+
   /* Locate front of token, skipping any delimiters */
   for ( ; ((*str != '\0') && (*str != '\n') && (*str != '\r')); str++) {
     flag2moveon = 1;  /* Default to move on unless we find a delimiter */
     for (next_delim=delim; *next_delim; next_delim++) {
       if (*str == *next_delim) {
         flag2moveon = 0;
         break;
       }
@@ -345,17 +348,19 @@ uint32_t sdp_getnextnumtok_or_null (cons
                                const char *delim, tinybool *null_ind,
                                sdp_result_e *result)
 {
   const char *token_list = str;
   char temp_token[SDP_MAX_STRING_LEN];
   char *strtoul_end;
   unsigned long numval;
 
-  *null_ind = FALSE;
+  if (null_ind) {
+    *null_ind = FALSE;
+  }
 
   if (!str || !str_end || !delim || !null_ind || !result) {
     if (result) {
       *result = SDP_FAILURE;
     }
     return 0;
   }
 
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -557,17 +557,17 @@ pref("editor.singleLine.pasteNewlines", 
 pref("ui.dragThresholdX", 25);
 pref("ui.dragThresholdY", 25);
 
 pref("layers.acceleration.disabled", false);
 pref("layers.async-video.enabled", true);
 
 #ifdef MOZ_ANDROID_APZ
 pref("layers.async-pan-zoom.enabled", true);
-// APZ prefs that are different from B2G
+pref("apz.content_response_timeout", 600);
 pref("apz.allow_immediate_handoff", false);
 pref("apz.touch_start_tolerance", "0.06");
 pref("apz.axis_lock.breakout_angle", "0.7853982");    // PI / 4 (45 degrees)
 // APZ physics settings reviewed by UX
 pref("apz.axis_lock.mode", 1); // Use "strict" axis locking
 pref("apz.fling_curve_function_x1", "0.59");
 pref("apz.fling_curve_function_y1", "0.46");
 pref("apz.fling_curve_function_x2", "0.05");
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/GLController.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/GLController.java
@@ -140,17 +140,17 @@ public class GLController extends JNIObj
 
     void resumeCompositor(int width, int height) {
         // Asking Gecko to resume the compositor takes too long (see
         // https://bugzilla.mozilla.org/show_bug.cgi?id=735230#c23), so we
         // resume the compositor directly. We still need to inform Gecko about
         // the compositor resuming, so that Gecko knows that it can now draw.
         // It is important to not notify Gecko until after the compositor has
         // been resumed, otherwise Gecko may send updates that get dropped.
-        if (mCompositorCreated) {
+        if (isServerSurfaceValid() && mCompositorCreated) {
             syncResumeResizeCompositor(width, height);
             mView.requestRender();
         }
     }
 
     /* package */ void invalidateAndScheduleComposite() {
         if (mCompositorCreated) {
             syncInvalidateAndScheduleComposite();
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -591,17 +591,17 @@ pref("apz.allow_zooming", false);
 // 0 = FREE (No locking at all)
 // 1 = STANDARD (Once locked, remain locked until scrolling ends)
 // 2 = STICKY (Allow lock to be broken, with hysteresis)
 pref("apz.axis_lock.mode", 0);
 pref("apz.axis_lock.lock_angle", "0.5235987");        // PI / 6 (30 degrees)
 pref("apz.axis_lock.breakout_threshold", "0.03125");  // 1/32 inches
 pref("apz.axis_lock.breakout_angle", "0.3926991");    // PI / 8 (22.5 degrees)
 pref("apz.axis_lock.direct_pan_angle", "1.047197");   // PI / 3 (60 degrees)
-pref("apz.content_response_timeout", 300);
+pref("apz.content_response_timeout", 400);
 pref("apz.drag.enabled", false);
 pref("apz.danger_zone_x", 50);
 pref("apz.danger_zone_y", 100);
 pref("apz.disable_for_scroll_linked_effects", false);
 pref("apz.displayport_expiry_ms", 15000);
 pref("apz.enlarge_displayport_when_clipped", false);
 pref("apz.fling_accel_base_mult", "1.0");
 pref("apz.fling_accel_interval_ms", 500);
--- a/netwerk/base/security-prefs.js
+++ b/netwerk/base/security-prefs.js
@@ -78,10 +78,10 @@ pref("security.pki.netscape_step_up_poli
 pref("security.pki.netscape_step_up_policy", 2);
 #endif
 
 pref("security.webauth.u2f", false);
 pref("security.webauth.u2f_enable_softtoken", false);
 pref("security.webauth.u2f_enable_usbtoken", false);
 
 pref("security.ssl.errorReporting.enabled", true);
-pref("security.ssl.errorReporting.url", "https://data.mozilla.com/submit/sslreports");
+pref("security.ssl.errorReporting.url", "https://incoming.telemetry.mozilla.org/submit/sslreports/");
 pref("security.ssl.errorReporting.automatic", false);
--- a/netwerk/dns/GetAddrInfo.cpp
+++ b/netwerk/dns/GetAddrInfo.cpp
@@ -13,20 +13,16 @@
 #include "nsAutoPtr.h"
 #include "mozilla/StaticPtr.h"
 #include "MainThreadUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/net/DNS.h"
 #include <algorithm>
 #include "prerror.h"
 
-#if defined(ANDROID) && ANDROID_VERSION > 19
-#include <resolv_netid.h>
-#endif
-
 #include "mozilla/Logging.h"
 
 #if DNSQUERY_AVAILABLE
 // There is a bug in windns.h where the type of parameter ppQueryResultsSet for
 // DnsQuery_A is dependent on UNICODE being set. It should *always* be
 // PDNS_RECORDA, but if UNICODE is set it is PDNS_RECORDW. To get around this
 // we make sure that UNICODE is unset.
 #undef UNICODE
@@ -243,80 +239,16 @@ static MOZ_ALWAYS_INLINE nsresult
     return NS_ERROR_FAILURE;
   }
 
   *aResult = ttl;
   return NS_OK;
 }
 #endif
 
-#if defined(ANDROID) && ANDROID_VERSION >= 19
-// Make the same as nspr functions.
-static MOZ_ALWAYS_INLINE PRAddrInfo*
-_Android_GetAddrInfoForNetInterface(const char* hostname,
-                                   uint16_t af,
-                                   uint16_t flags,
-                                   const char* aNetworkInterface)
-{
-  if ((af != PR_AF_INET && af != PR_AF_UNSPEC) ||
-      (flags & ~ PR_AI_NOCANONNAME) != PR_AI_ADDRCONFIG) {
-    PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
-    return nullptr;
-  }
-
-  struct addrinfo *res, hints;
-  int rv;
-  memset(&hints, 0, sizeof(hints));
-  if (!(flags & PR_AI_NOCANONNAME)) {
-    hints.ai_flags |= AI_CANONNAME;
-  }
-
-#ifdef AI_ADDRCONFIG
-  if ((flags & PR_AI_ADDRCONFIG) &&
-      strcmp(hostname, "localhost") != 0 &&
-      strcmp(hostname, "localhost.localdomain") != 0 &&
-      strcmp(hostname, "localhost6") != 0 &&
-      strcmp(hostname, "localhost6.localdomain6") != 0) {
-    hints.ai_flags |= AI_ADDRCONFIG;
-  }
-#endif
-
-  hints.ai_family = (af == PR_AF_INET) ? AF_INET : AF_UNSPEC;
-  hints.ai_socktype = SOCK_STREAM;
-
-#if ANDROID_VERSION == 19
-  rv = android_getaddrinfoforiface(hostname, NULL, &hints, aNetworkInterface,
-                                   0, &res);
-#else
-  uint32_t netId = atoi(aNetworkInterface);
-  rv = android_getaddrinfofornet(hostname, NULL, &hints, netId, 0, &res);
-#endif
-
-#ifdef AI_ADDRCONFIG
-  if (rv == EAI_BADFLAGS && (hints.ai_flags & AI_ADDRCONFIG)) {
-    hints.ai_flags &= ~AI_ADDRCONFIG;
-#if ANDROID_VERSION == 19
-    rv = android_getaddrinfoforiface(hostname, NULL, &hints, aNetworkInterface,
-                                     0, &res);
-#else
-    uint32_t netId = atoi(aNetworkInterface);
-    rv = android_getaddrinfofornet(hostname, NULL, &hints, netId, 0, &res);
-#endif
-  }
-#endif
-
-  if (rv == 0) {
-    return (PRAddrInfo *) res;
-  }
-
-  PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, rv);
-  return nullptr;
-}
-#endif
-
 ////////////////////////////////////
 // PORTABLE RUNTIME IMPLEMENTATION//
 ////////////////////////////////////
 
 static MOZ_ALWAYS_INLINE nsresult
 _GetAddrInfo_Portable(const char* aCanonHost, uint16_t aAddressFamily,
                       uint16_t aFlags, const char* aNetworkInterface,
                       AddrInfo** aAddrInfo)
@@ -334,28 +266,17 @@ static MOZ_ALWAYS_INLINE nsresult
 
   // We need to remove IPv4 records manually because PR_GetAddrInfoByName
   // doesn't support PR_AF_INET6.
   bool disableIPv4 = aAddressFamily == PR_AF_INET6;
   if (disableIPv4) {
     aAddressFamily = PR_AF_UNSPEC;
   }
 
-  PRAddrInfo* prai;
-#if defined(ANDROID) && ANDROID_VERSION >= 19
-  if (aNetworkInterface && aNetworkInterface[0] != '\0') {
-    prai = _Android_GetAddrInfoForNetInterface(aCanonHost,
-                                               aAddressFamily,
-                                               prFlags,
-                                               aNetworkInterface);
-  } else
-#endif
-  {
-    prai = PR_GetAddrInfoByName(aCanonHost, aAddressFamily, prFlags);
-  }
+  PRAddrInfo* prai = PR_GetAddrInfoByName(aCanonHost, aAddressFamily, prFlags);
 
   if (!prai) {
     return NS_ERROR_UNKNOWN_HOST;
   }
 
   const char* canonName = nullptr;
   if (aFlags & nsHostResolver::RES_CANON_NAME) {
     canonName = PR_GetCanonNameFromAddrInfo(prai);
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -61,19 +61,16 @@ etld_data = GENERATED_FILES['etld_data.i
 etld_data.script = 'prepare_tlds.py'
 etld_data.inputs = ['effective_tld_names.dat']
 
 # need to include etld_data.inc
 LOCAL_INCLUDES += [
     '/netwerk/base',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['ANDROID_VERSION'] > '19':
-    LOCAL_INCLUDES += ['%' + '%s/bionic/libc/dns/include' % CONFIG['ANDROID_SOURCE']]
-
 if CONFIG['ENABLE_INTL_API']:
     DEFINES['IDNA2008'] = True
     CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
     CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
     LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
     USE_LIBS += ['icu']
 else:
     UNIFIED_SOURCES += [
--- a/old-configure.in
+++ b/old-configure.in
@@ -90,34 +90,33 @@ dnl ====================================
 _topsrcdir=`cd \`dirname $0\`; pwd -W 2>/dev/null || pwd -P`
 _objdir=`pwd -P`
 
 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd -P`
 DIST="$MOZ_BUILD_ROOT/dist"
 
 MOZ_DEFAULT_COMPILER
 
+if test "$COMPILE_ENVIRONMENT"; then
+    MOZ_ANDROID_NDK
+fi # COMPILE_ENVIRONMENT
+
 if test -n "$gonkdir" ; then
     dnl export for js/src/configure. We can't pass the option down normally,
     dnl because it's a `--enable-project=b2g`-only option.
     export gonkdir
     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
     android_source="$gonkdir"
     ANDROID_SOURCE="$android_source"
     dnl Default to ICS
     ANDROID_VERSION=15
     if test -n "${PLATFORM_SDK_VERSION}"; then
         ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
     fi
 
-    if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
-        AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
-    fi
-    STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
-
     case "$ANDROID_VERSION" in
     15)
         GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
         MOZ_B2G_BT=1
         MOZ_B2G_BT_BLUEZ=1
         MOZ_NFC=1
         MOZ_B2G_CAMERA=1
         MOZ_OMX_DECODER=1
@@ -178,36 +177,30 @@ if test -n "$gonkdir" ; then
         fi
         MOZ_NFC=1
         MOZ_RTSP=1
         ;;
     *)
         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
         ;;
     esac
-    CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
-    CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS"
-    CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
+
+    CPPFLAGS="-I$gonkdir/system -I$gonkdir/system/core/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
+    LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib $LDFLAGS"
     dnl Add -llog by default, since we use it all over the place.
     LIBS="$LIBS -llog"
 
-    LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
-
     AC_DEFINE(ANDROID)
     AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
     AC_SUBST(ANDROID_VERSION)
     AC_DEFINE(HAVE_SYS_UIO_H)
     AC_DEFINE(HAVE_PTHREADS)
     direct_nspr_config=1
-    android_cxx_stl=mozstlport
+
 else
-    if test "$COMPILE_ENVIRONMENT"; then
-        MOZ_ANDROID_NDK
-    fi # COMPILE_ENVIRONMENT
-
     case "$target" in
     *-android*|*-linuxandroid*)
         ZLIB_DIR=yes
         AC_DEFINE(ANDROID)
         ;;
     *-linux*)
         AC_PATH_PROG(OBJCOPY,objcopy)
         ;;
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -265,16 +265,20 @@ class MozbuildObject(ProcessExecutionMix
 
         return self._config_environment
 
     @property
     def defines(self):
         return self.config_environment.defines
 
     @property
+    def non_global_defines(self):
+        return self.config_environment.non_global_defines
+
+    @property
     def substs(self):
         return self.config_environment.substs
 
     @property
     def distdir(self):
         return os.path.join(self.topobjdir, 'dist')
 
     @property
--- a/python/mozbuild/mozbuild/mozinfo.py
+++ b/python/mozbuild/mozbuild/mozinfo.py
@@ -15,17 +15,17 @@ import mozbuild.mozconfig as mozconfig
 def build_dict(config, env=os.environ):
     """
     Build a dict containing data about the build configuration from
     the environment.
     """
     substs = config.substs
 
     # Check that all required variables are present first.
-    required = ["TARGET_CPU", "OS_TARGET", "MOZ_WIDGET_TOOLKIT"]
+    required = ["TARGET_CPU", "OS_TARGET"]
     missing = [r for r in required if r not in substs]
     if missing:
         raise Exception("Missing required environment variables: %s" %
                         ', '.join(missing))
 
     d = {}
     d['topsrcdir'] = config.topsrcdir
 
@@ -33,25 +33,25 @@ def build_dict(config, env=os.environ):
     if the_mozconfig:
         d['mozconfig'] = the_mozconfig
 
     # os
     o = substs["OS_TARGET"]
     known_os = {"Linux": "linux",
                 "WINNT": "win",
                 "Darwin": "mac",
-                "Android": "b2g" if substs["MOZ_WIDGET_TOOLKIT"] == "gonk" else "android"}
+                "Android": "b2g" if substs.get("MOZ_WIDGET_TOOLKIT") == "gonk" else "android"}
     if o in known_os:
         d["os"] = known_os[o]
     else:
         # Allow unknown values, just lowercase them.
         d["os"] = o.lower()
 
     # Widget toolkit, just pass the value directly through.
-    d["toolkit"] = substs["MOZ_WIDGET_TOOLKIT"]
+    d["toolkit"] = substs.get("MOZ_WIDGET_TOOLKIT")
 
     # Application name
     if 'MOZ_APP_NAME' in substs:
         d["appname"] = substs["MOZ_APP_NAME"]
 
     # Build app name
     if 'MOZ_MULET' in substs and substs.get('MOZ_MULET') == "1":
         d["buildapp"] = "mulet"
--- a/python/mozbuild/mozbuild/test/test_base.py
+++ b/python/mozbuild/mozbuild/test/test_base.py
@@ -36,16 +36,17 @@ log_manager = LoggingManager()
 
 
 class TestMozbuildObject(unittest.TestCase):
     def setUp(self):
         self._old_cwd = os.getcwd()
         self._old_env = dict(os.environ)
         os.environ.pop('MOZCONFIG', None)
         os.environ.pop('MOZ_OBJDIR', None)
+        os.environ.pop('MOZ_CURRENT_PROJECT', None)
 
     def tearDown(self):
         os.chdir(self._old_cwd)
         os.environ.clear()
         os.environ.update(self._old_env)
 
     def get_base(self, topobjdir=None):
         return MozbuildObject(topsrcdir, None, log_manager, topobjdir=topobjdir)
--- a/security/sandbox/chromium/base/containers/hash_tables.h
+++ b/security/sandbox/chromium/base/containers/hash_tables.h
@@ -40,17 +40,17 @@
 // This is a hack to disable the gcc 4.4 warning about hash_map and hash_set
 // being deprecated.  We can get rid of this when we upgrade to VS2008 and we
 // can use <tr1/unordered_map> and <tr1/unordered_set>.
 #ifdef __DEPRECATED
 #define CHROME_OLD__DEPRECATED __DEPRECATED
 #undef __DEPRECATED
 #endif
 
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) && !defined(MOZ_WIDGET_GONK)
 #include <hash_map>
 #include <hash_set>
 #define BASE_HASH_IMPL_NAMESPACE std
 #else
 #include <ext/hash_map>
 #include <ext/hash_set>
 #define BASE_HASH_IMPL_NAMESPACE __gnu_cxx
 #endif
--- a/security/sandbox/linux/broker/moz.build
+++ b/security/sandbox/linux/broker/moz.build
@@ -11,16 +11,20 @@ EXPORTS.mozilla += [
 ]
 
 SOURCES += [
     'SandboxBroker.cpp',
     'SandboxBrokerCommon.cpp',
     'SandboxBrokerPolicyFactory.cpp',
 ]
 
+if CONFIG['OS_TARGET'] == 'Android':
+    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+        DEFINES['HAVE_ANDROID_OS'] = True
+
 LOCAL_INCLUDES += [
     '/security/sandbox/linux', # SandboxLogging.h
     '/security/sandbox/linux/common', # SandboxInfo.h
 ]
 
 # Need this for mozilla::ipc::FileDescriptor etc.
 include('/ipc/chromium/chromium-config.mozbuild')
 
--- a/taskcluster/scripts/builder/hazard-analysis.sh
+++ b/taskcluster/scripts/builder/hazard-analysis.sh
@@ -31,18 +31,20 @@ fi
 
 function build_js_shell () {
     ( cd $JS_SRCDIR; autoconf-2.13 )
     if [[ -z "$HAZ_DEP" ]]; then
         [ -d $HAZARD_SHELL_OBJDIR ] && rm -rf $HAZARD_SHELL_OBJDIR
     fi
     mkdir -p $HAZARD_SHELL_OBJDIR || true
     cd $HAZARD_SHELL_OBJDIR
-    $JS_SRCDIR/configure --enable-optimize --disable-debug --enable-ctypes --enable-nspr-build --without-intl-api --with-ccache
-    make -j4
+    ( export MOZCONFIG=
+      $JS_SRCDIR/configure --enable-optimize --disable-debug --enable-ctypes --enable-nspr-build --without-intl-api --with-ccache
+      make -j4
+    )
 }
 
 function configure_analysis () {
     local analysis_dir
     analysis_dir="$1"
 
     if [[ -z "$HAZ_DEP" ]]; then
         [ -d "$analysis_dir" ] && rm -rf "$analysis_dir"
--- a/testing/mozharness/configs/builds/taskcluster_firefox_win32_debug.py
+++ b/testing/mozharness/configs/builds/taskcluster_firefox_win32_debug.py
@@ -79,16 +79,17 @@ config = {
         'MOZ_AUTOMATION': '1',
         'MOZ_CRASHREPORTER_NO_REPORT': '1',
         'MOZ_OBJDIR': 'obj-firefox',
         'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x86/srcsrv/pdbstr.exe',
         'TINDERBOX_OUTPUT': '1',
         'TOOLTOOL_CACHE': '/c/builds/tooltool_cache',
         'TOOLTOOL_HOME': '/c/builds',
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
+        'MSYSTEM': 'MINGW32',
     },
     'upload_env': {
         'UPLOAD_HOST': 'localhost',
         'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'),
     },
     "check_test_env": {
         'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win32\\minidump_stackwalk.exe',
         'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps',
--- a/testing/mozharness/configs/builds/taskcluster_firefox_win32_opt.py
+++ b/testing/mozharness/configs/builds/taskcluster_firefox_win32_opt.py
@@ -77,16 +77,17 @@ config = {
         'MOZBUILD_STATE_PATH': os.path.join(os.getcwd(), '.mozbuild'),
         'MOZ_AUTOMATION': '1',
         'MOZ_CRASHREPORTER_NO_REPORT': '1',
         'MOZ_OBJDIR': 'obj-firefox',
         'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x86/srcsrv/pdbstr.exe',
         'TINDERBOX_OUTPUT': '1',
         'TOOLTOOL_CACHE': '/c/builds/tooltool_cache',
         'TOOLTOOL_HOME': '/c/builds',
+        'MSYSTEM': 'MINGW32',
     },
     'upload_env': {
         'UPLOAD_HOST': 'localhost',
         'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'),
     },
     "check_test_env": {
         'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win32\\minidump_stackwalk.exe',
         'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps',
--- a/testing/mozharness/configs/builds/taskcluster_firefox_win64_debug.py
+++ b/testing/mozharness/configs/builds/taskcluster_firefox_win64_debug.py
@@ -75,16 +75,17 @@ config = {
         'MOZ_AUTOMATION': '1',
         'MOZ_CRASHREPORTER_NO_REPORT': '1',
         'MOZ_OBJDIR': 'obj-firefox',
         'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/srcsrv/pdbstr.exe',
         'TINDERBOX_OUTPUT': '1',
         'TOOLTOOL_CACHE': '/c/builds/tooltool_cache',
         'TOOLTOOL_HOME': '/c/builds',
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
+        'MSYSTEM': 'MINGW32',
     },
     'upload_env': {
         'UPLOAD_HOST': 'localhost',
         'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'),
     },
     "check_test_env": {
         'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win64\\minidump_stackwalk.exe',
         'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps',
--- a/testing/mozharness/configs/builds/taskcluster_firefox_win64_opt.py
+++ b/testing/mozharness/configs/builds/taskcluster_firefox_win64_opt.py
@@ -73,16 +73,17 @@ config = {
         ),
         'MOZ_AUTOMATION': '1',
         'MOZ_CRASHREPORTER_NO_REPORT': '1',
         'MOZ_OBJDIR': 'obj-firefox',
         'PDBSTR_PATH': '/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/srcsrv/pdbstr.exe',
         'TINDERBOX_OUTPUT': '1',
         'TOOLTOOL_CACHE': '/c/builds/tooltool_cache',
         'TOOLTOOL_HOME': '/c/builds',
+        'MSYSTEM': 'MINGW32',
     },
     'upload_env': {
         'UPLOAD_HOST': 'localhost',
         'UPLOAD_PATH': os.path.join(os.getcwd(), 'public', 'build'),
     },
     "check_test_env": {
         'MINIDUMP_STACKWALK': '%(abs_tools_dir)s\\breakpad\\win64\\minidump_stackwalk.exe',
         'MINIDUMP_SAVE_PATH': '%(base_work_dir)s\\minidumps',
--- a/testing/mozharness/mozharness/mozilla/googleplay.py
+++ b/testing/mozharness/mozharness/mozilla/googleplay.py
@@ -8,41 +8,33 @@
       5) Create "New client ID"
          or download the p12 key (it should remain
          super private)
       6) Move the file in this directory with the name
          'key.p12' or use the --credentials option
 """
 
 import httplib2
-
+from oauth2client.service_account import ServiceAccountCredentials
 from apiclient.discovery import build
 from oauth2client import client
 
 
 # GooglePlayMixin {{{1
 class GooglePlayMixin(object):
 
     def connect_to_play(self):
         """ Connect to the google play interface
         """
-        # Load the key in PKCS 12 format that you downloaded from the
-        # Google APIs Console when you created your Service account.
-        f = file(self.config["google_play_credentials_file"], 'rb')
-        key = f.read()
-        f.close()
 
         # Create an httplib2.Http object to handle our HTTP requests an
         # authorize it with the Credentials. Note that the first parameter,
         # service_account_name, is the Email address created for the Service
         # account. It must be the email address associated with the key that
         # was created.
         scope = 'https://www.googleapis.com/auth/androidpublisher'
-        credentials = client.SignedJwtAssertionCredentials(
-            self.config["service_account"],
-            key,
-            scope)
+        credentials = ServiceAccountCredentials.from_p12_keyfile(self.config["service_account"], self.config["google_play_credentials_file"], scopes=scope)
         http = httplib2.Http()
         http = credentials.authorize(http)
 
         service = build('androidpublisher', 'v2', http=http)
 
         return service
new file mode 100644
--- /dev/null
+++ b/testing/mozharness/mozharness/mozilla/storel10n.py
@@ -0,0 +1,48 @@
+""" storel10n.py
+
+    Manage the localization of the Google play store
+
+"""
+
+from mozharness.base.log import LogMixin
+from mozharness.base.script import ScriptMixin
+
+
+class storel10n(ScriptMixin, LogMixin):
+
+    l10n_api_url = "https://l10n.mozilla-community.org/stores_l10n/"
+    all_locales_url = l10n_api_url + "api/google/listing/{channel}/"
+    locale_url = l10n_api_url + "api/google/translation/{channel}/{locale}/"
+    mapping_url = l10n_api_url + "api/google/localesmapping/?reverse"
+
+    def __init__(self, config, log):
+        self.config = config
+        self.log_obj = log
+        self.mappings = []
+
+    def get_list_locales(self, package_name):
+
+        """ Get all the translated locales supported by Google play
+        So, locale unsupported by Google play won't be downloaded
+        Idem for not translated locale
+        """
+        return self.load_json_url(self.all_locales_url.format(channel=package_name))
+
+    def get_translation(self, package_name, locale):
+        """ Get the translation for a locale
+        """
+        return self.load_json_url(self.locale_url.format(channel=package_name, locale=locale))
+
+    def load_mapping(self):
+        """ Download and load the locale mapping
+        """
+        self.mappings = self.load_json_url(self.mapping_url)
+
+    def locale_mapping(self, locale):
+        """ Google play and Mozilla don't have the exact locale code
+        Translate them
+        """
+        if locale in self.mappings:
+            return self.mappings[locale]
+        else:
+            return locale
--- a/testing/mozharness/requirements.txt
+++ b/testing/mozharness/requirements.txt
@@ -16,10 +16,10 @@ paramiko==1.10.0
 pycrypto==2.6
 pyflakes==0.6.1
 pylint==0.27.0
 simplejson==2.1.1
 unittest2==0.5.1
 virtualenv==1.5.1
 wsgiref==0.1.2
 urllib3==1.9.1
-google-api-python-client==1.3.1
+google-api-python-client==1.5.1
 oauth2client==1.4.2
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/elf.h
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H
-
-#include <stdint.h>
-#include <libgen.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// The Android <elf.h> provides BSD-based definitions for the ElfXX_Nhdr
-// types 
-// always source-compatible with the GLibc/kernel ones. To overcome this
-// issue without modifying a lot of code in Breakpad, use an ugly macro
-// renaming trick with #include_next
-
-// Avoid conflict with BSD-based definition of ElfXX_Nhdr.
-// Unfortunately, their field member names do not use a 'n_' prefix.
-#define Elf32_Nhdr   __bsd_Elf32_Nhdr
-#define Elf64_Nhdr   __bsd_Elf64_Nhdr
-
-// In case they are defined by the NDK version
-#define Elf32_auxv_t  __bionic_Elf32_auxv_t
-#define Elf64_auxv_t  __bionic_Elf64_auxv_t
-
-#define Elf32_Dyn     __bionic_Elf32_Dyn
-#define Elf64_Dyn     __bionic_Elf64_Dyn
-
-#include_next <elf.h>
-
-#undef Elf32_Nhdr
-#undef Elf64_Nhdr
-
-typedef struct {
-  Elf32_Word n_namesz;
-  Elf32_Word n_descsz;
-  Elf32_Word n_type;
-} Elf32_Nhdr;
-
-typedef struct {
-  Elf64_Word n_namesz;
-  Elf64_Word n_descsz;
-  Elf64_Word n_type;
-} Elf64_Nhdr;
-
-#undef Elf32_auxv_t
-#undef Elf64_auxv_t
-
-typedef struct {
-    uint32_t a_type;
-    union {
-      uint32_t a_val;
-    } a_un;
-} Elf32_auxv_t;
-
-typedef struct {
-    uint64_t a_type;
-    union {
-      uint64_t a_val;
-    } a_un;
-} Elf64_auxv_t;
-
-#undef Elf32_Dyn
-#undef Elf64_Dyn
-
-typedef struct {
-  Elf32_Sword   d_tag;
-  union {
-    Elf32_Word  d_val;
-    Elf32_Addr  d_ptr;
-  } d_un;
-} Elf32_Dyn;
-
-typedef struct {
-  Elf64_Sxword   d_tag;
-  union {
-    Elf64_Xword  d_val;
-    Elf64_Addr   d_ptr;
-  } d_un;
-} Elf64_Dyn;
-
-
-// __WORDSIZE is GLibc-specific and used by Google Breakpad on Linux.
-// All Android platforms are 32-bit for now.
-#ifndef __WORDSIZE
-#define __WORDSIZE 32
-#endif
-
-// The Android headers don't always define this constant.
-#ifndef EM_X86_64
-#define EM_X86_64  62
-#endif
-
-#ifndef EM_PPC64
-#define EM_PPC64   21
-#endif
-
-#ifndef EM_S390
-#define EM_S390    22
-#endif
-
-#if !defined(AT_SYSINFO_EHDR)
-#define AT_SYSINFO_EHDR 33
-#endif
-
-#if !defined(NT_PRSTATUS)
-#define NT_PRSTATUS 1
-#endif
-
-#if !defined(NT_PRPSINFO)
-#define NT_PRPSINFO 3
-#endif
-
-#if !defined(NT_AUXV)
-#define NT_AUXV   6
-#endif
-
-#if !defined(NT_PRXFPREG)
-#define NT_PRXFPREG 0x46e62b7f
-#endif
-
-#if !defined(NT_FPREGSET)
-#define NT_FPREGSET 2
-#endif
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_ELF_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/link.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H
-#define GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H
-
-/* Android doesn't provide <link.h>. Provide custom version here */
-#include <elf.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-#define ElfW(type)      _ElfW (Elf, ELFSIZE, type)
-#define _ElfW(e,w,t)    _ElfW_1 (e, w, _##t)
-#define _ElfW_1(e,w,t)  e##w##t
-
-struct r_debug {
-  int              r_version;
-  struct link_map* r_map;
-  ElfW(Addr)       r_brk;
-  enum {
-    RT_CONSISTENT,
-    RT_ADD,
-    RT_DELETE }    r_state;
-  ElfW(Addr)       r_ldbase;
-};
-
-struct link_map {
-  ElfW(Addr)       l_addr;
-  char*            l_name;
-  ElfW(Dyn)*       l_ld;
-  struct link_map* l_next;
-  struct link_map* l_prev;
-};
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/stab.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_STAB_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_STAB_H
-
-#include <sys/cdefs.h>
-
-#ifdef __BIONIC_HAVE_STAB_H
-#include <stab.h>
-#else
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-#define _STAB_CODE_LIST       \
-  _STAB_CODE_DEF(UNDF,0x00)   \
-  _STAB_CODE_DEF(GSYM,0x20)   \
-  _STAB_CODE_DEF(FNAME,0x22)  \
-  _STAB_CODE_DEF(FUN,0x24)    \
-  _STAB_CODE_DEF(STSYM,0x26)  \
-  _STAB_CODE_DEF(LCSYM,0x28)  \
-  _STAB_CODE_DEF(MAIN,0x2a)   \
-  _STAB_CODE_DEF(PC,0x30)     \
-  _STAB_CODE_DEF(NSYMS,0x32)  \
-  _STAB_CODE_DEF(NOMAP,0x34)  \
-  _STAB_CODE_DEF(OBJ,0x38)    \
-  _STAB_CODE_DEF(OPT,0x3c)    \
-  _STAB_CODE_DEF(RSYM,0x40)   \
-  _STAB_CODE_DEF(M2C,0x42)    \
-  _STAB_CODE_DEF(SLINE,0x44)  \
-  _STAB_CODE_DEF(DSLINE,0x46) \
-  _STAB_CODE_DEF(BSLINE,0x48) \
-  _STAB_CODE_DEF(BROWS,0x48)  \
-  _STAB_CODE_DEF(DEFD,0x4a)   \
-  _STAB_CODE_DEF(EHDECL,0x50) \
-  _STAB_CODE_DEF(MOD2,0x50)   \
-  _STAB_CODE_DEF(CATCH,0x54)  \
-  _STAB_CODE_DEF(SSYM,0x60)   \
-  _STAB_CODE_DEF(SO,0x64)     \
-  _STAB_CODE_DEF(LSYM,0x80)   \
-  _STAB_CODE_DEF(BINCL,0x82)  \
-  _STAB_CODE_DEF(SOL,0x84)    \
-  _STAB_CODE_DEF(PSYM,0xa0)   \
-  _STAB_CODE_DEF(EINCL,0xa2)  \
-  _STAB_CODE_DEF(ENTRY,0xa4)  \
-  _STAB_CODE_DEF(LBRAC,0xc0)  \
-  _STAB_CODE_DEF(EXCL,0xc2)   \
-  _STAB_CODE_DEF(SCOPE,0xc4)  \
-  _STAB_CODE_DEF(RBRAC,0xe0)  \
-  _STAB_CODE_DEF(BCOMM,0xe2)  \
-  _STAB_CODE_DEF(ECOMM,0xe4)  \
-  _STAB_CODE_DEF(ECOML,0xe8)  \
-  _STAB_CODE_DEF(NBTEXT,0xf0) \
-  _STAB_CODE_DEF(NBDATA,0xf2) \
-  _STAB_CODE_DEF(NBBSS,0xf4)  \
-  _STAB_CODE_DEF(NBSTS,0xf6)  \
-  _STAB_CODE_DEF(NBLCS,0xf8)  \
-  _STAB_CODE_DEF(LENG,0xfe)
-
-enum __stab_debug_code {
-#define _STAB_CODE_DEF(x,y)  N_##x = y,
-_STAB_CODE_LIST
-#undef _STAB_CODE_DEF
-};
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // __BIONIC_HAVE_STAB_H
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_STAB_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/sys/procfs.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H
-
-#ifdef __BIONIC_HAVE_SYS_PROCFS_H
-
-#include_next <sys/procfs.h>
-
-#else
-
-#include <sys/cdefs.h>
-#include <sys/user.h>
-#include <unistd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-#ifdef __x86_64__
-typedef unsigned long long elf_greg_t;
-#else
-typedef unsigned long  elf_greg_t;
-#endif
-
-#ifdef __arm__
-#define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t))
-#else
-#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
-#endif
-
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-struct elf_siginfo {
-  int si_signo;
-  int si_code;
-  int si_errno;
-};
-
-struct elf_prstatus {
-  struct elf_siginfo pr_info;
-  short              pr_cursig;
-  unsigned long      pr_sigpend;
-  unsigned long      pr_sighold;
-  pid_t              pr_pid;
-  pid_t              pr_ppid;
-  pid_t              pr_pgrp;
-  pid_t              pd_sid;
-  struct timeval     pr_utime;
-  struct timeval     pr_stime;
-  struct timeval     pr_cutime;
-  struct timeval     pr_cstime;
-  elf_gregset_t      pr_reg;
-  int                pr_fpvalid;
-};
-
-#define ELF_PRARGSZ 80
-
-struct elf_prpsinfo {
-  char           pr_state;
-  char           pr_sname;
-  char           pr_zomb;
-  char           pr_nice;
-  unsigned long  pr_flags;
-#ifdef __x86_64__
-  unsigned int   pr_uid;
-  unsigned int   pr_gid;
-#else
-  unsigned short pr_uid;
-  unsigned short pr_gid;
-#endif
-  int pr_pid;
-  int pr_ppid;
-  int pr_pgrp;
-  int pr_sid;
-  char pr_fname[16];
-  char pr_psargs[ELF_PRARGSZ];
-};
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // __BIONIC_HAVE_SYS_PROCFS_H
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_SYS_PROCFS_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/sys/signal.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_SIGNAL_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_SIGNAL_H
-
-#include <signal.h>
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_SIGNAL_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/sys/stat.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
-
-#include_next <sys/stat.h>
-
-#ifndef S_IRWXU
-#define S_IRWXU  00700
-#endif
-
-#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_STAT_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/sys/ucontext.h
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
-
-#include <sys/cdefs.h>
-#include <signal.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-#ifndef __BIONIC_HAVE_UCONTEXT_T
-
-// Ensure that 'stack_t' is defined.
-#include <asm/signal.h>
-
-// This version of the Android C library headers do not provide ucontext_t.
-// Provide custom definitions for Google Breakpad.
-#if defined(__arm__)
-
-// Ensure that 'struct sigcontext' is defined.
-#include <asm/sigcontext.h>
-typedef struct sigcontext mcontext_t;
-
-// The ARM kernel uses a 64-bit signal mask.
-typedef uint32_t  kernel_sigmask_t[2];
-
-typedef struct ucontext {
-  uint32_t uc_flags;
-  struct ucontext* uc_link;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  kernel_sigmask_t uc_sigmask;
-  // Other fields are not used by Google Breakpad. Don't define them.
-} ucontext_t;
-
-#elif defined(__i386__)
-
-/* 80-bit floating-point register */
-struct _libc_fpreg {
-  unsigned short significand[4];
-  unsigned short exponent;
-};
-
-/* Simple floating-point state, see FNSTENV instruction */
-struct _libc_fpstate {
-  unsigned long cw;
-  unsigned long sw;
-  unsigned long tag;
-  unsigned long ipoff;
-  unsigned long cssel;
-  unsigned long dataoff;
-  unsigned long datasel;
-  struct _libc_fpreg _st[8];
-  unsigned long status;
-};
-
-typedef uint32_t  greg_t;
-
-typedef struct {
-  uint32_t gregs[19];
-  struct _libc_fpstate* fpregs;
-  uint32_t oldmask;
-  uint32_t cr2;
-} mcontext_t;
-
-enum {
-  REG_GS = 0,
-  REG_FS,
-  REG_ES,
-  REG_DS,
-  REG_EDI,
-  REG_ESI,
-  REG_EBP,
-  REG_ESP,
-  REG_EBX,
-  REG_EDX,
-  REG_ECX,
-  REG_EAX,
-  REG_TRAPNO,
-  REG_ERR,
-  REG_EIP,
-  REG_CS,
-  REG_EFL,
-  REG_UESP,
-  REG_SS,
-};
-
-// The i386 kernel uses a 64-bit signal mask.
-typedef uint32_t kernel_sigmask_t[2];
-
-typedef struct ucontext {
-  uint32_t uc_flags;
-  struct ucontext* uc_link;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  kernel_sigmask_t uc_sigmask;
-  struct _libc_fpstate __fpregs_mem;
-} ucontext_t;
-
-#elif defined(__mips__)
-
-// Not supported by Google Breakpad at this point, but just in case.
-typedef struct {
-  uint32_t regmask;
-  uint32_t status;
-  uint64_t pc;
-  uint64_t gregs[32];
-  uint64_t fpregs[32];
-  uint32_t acx;
-  uint32_t fpc_csr;
-  uint32_t fpc_eir;
-  uint32_t used_math;
-  uint32_t dsp;
-  uint64_t mdhi;
-  uint64_t mdlo;
-  uint32_t hi1;
-  uint32_t lo1;
-  uint32_t hi2;
-  uint32_t lo2;
-  uint32_t hi3;
-  uint32_t lo3;
-} mcontext_t;
-
-// The MIPS kernel uses a 128-bit signal mask.
-typedef uint32_t kernel_sigmask_t[4];
-
-typedef struct ucontext {
-  uint32_t uc_flags;
-  struct ucontext* uc_link;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  kernel_sigmask_t uc_sigmask;
-  // Other fields are not used by Google Breakpad. Don't define them.
-} ucontext_t;
-
-#else
-#  error "Unsupported Android CPU ABI!"
-#endif
-
-#endif  // __BIONIC_HAVE_UCONTEXT_T
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_UCONTEXT_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/sys/user.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// These types are used with ptrace(), more specifically with
-// PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively.
-//
-// They are also defined, sometimes with different names, in <asm/user.h>
-//
-
-#if defined(__arm__)
-
-#define _ARM_USER_H  1  // Prevent <asm/user.h> conflicts
-
-// Note: on ARM, GLibc uses user_regs instead of user_regs_struct.
-struct user_regs {
-  // Note: Entries 0-15 match r0..r15
-  //       Entry 16 is used to store the CPSR register.
-  //       Entry 17 is used to store the "orig_r0" value.
-  unsigned long int uregs[18];
-};
-
-// Same here: user_fpregs instead of user_fpregs_struct.
-struct user_fpregs {
-  struct fp_reg {
-    unsigned int sign1:1;
-    unsigned int unused:15;
-    unsigned int sign2:1;
-    unsigned int exponent:14;
-    unsigned int j:1;
-    unsigned int mantissa1:31;
-    unsigned int mantissa0:32;
-  } fpregs[8];
-  unsigned int  fpsr:32;
-  unsigned int  fpcr:32;
-  unsigned char ftype[8];
-  unsigned int  init_flag;
-};
-
-// GLibc doesn't define this one in <sys/user.h> though.
-struct user_vfpregs {
-  unsigned long long  fpregs[32];
-  unsigned long       fpscr;
-};
-
-#elif defined(__i386__)
-
-#define _I386_USER_H 1  // Prevent <asm/user.h> conflicts
-
-// GLibc-compatible definitions
-struct user_regs_struct {
-  long ebx, ecx, edx, esi, edi, ebp, eax;
-  long xds, xes, xfs, xgs, orig_eax;
-  long eip, xcs, eflags, esp, xss;
-};
-
-struct user_fpregs_struct {
-  long cwd, swd, twd, fip, fcs, foo, fos;
-  long st_space[20];
-};
-
-struct user_fpxregs_struct {
-  unsigned short cwd, swd, twd, fop;
-  long fip, fcs, foo, fos, mxcsr, reserved;
-  long st_space[32];
-  long xmm_space[32];
-  long padding[56];
-};
-
-struct user {
-  struct user_regs_struct    regs;
-  int                        u_fpvalid;
-  struct user_fpregs_struct  i387;
-  unsigned long              u_tsize;
-  unsigned long              u_dsize;
-  unsigned long              u_ssize;
-  unsigned long              start_code;
-  unsigned long              start_stack;
-  long                       signal;
-  int                        reserved;
-  struct user_regs_struct*   u_ar0;
-  struct user_fpregs_struct* u_fpstate;
-  unsigned long              magic;
-  char                       u_comm [32];
-  int                        u_debugreg [8];
-};
-
-
-#elif defined(__mips__)
-
-// TODO: Provide some useful definitions here, once the rest of Breakpad
-//        requires them.
-
-#else
-#  error "Unsupported Android CPU ABI"
-#endif
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
deleted file mode 100644
--- a/toolkit/crashreporter/gonk-include/ucontext.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H
-#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H
-
-#include <sys/cdefs.h>
-#include <signal.h>
-
-#ifdef __BIONIC_HAVE_UCONTEXT_H
-# include_next <ucontext.h>
-#else
-# include <sys/ucontext.h>
-#endif  // __BIONIC_UCONTEXT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// Provided by src/android/common/breakpad_getcontext.S
-int breakpad_getcontext(ucontext_t* ucp);
-
-#define getcontext(x)   breakpad_getcontext(x)
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_UCONTEXT_H
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/moz.build
@@ -14,24 +14,19 @@ UNIFIED_SOURCES += [
     'log/log.cc',
     'microdump_writer/microdump_writer.cc',
     'minidump_writer/linux_dumper.cc',
     'minidump_writer/linux_ptrace_dumper.cc',
     'minidump_writer/minidump_writer.cc',
 ]
 
 if CONFIG['OS_TARGET'] == 'Android':
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/gonk-include',
-        ]
-    else:
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-        ]
+    LOCAL_INCLUDES += [
+        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
+    ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CPU_ARCH'] == 'x86':
     # The NDK's user.h defines this struct with a different name.
--- a/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h
+++ b/toolkit/crashreporter/google-breakpad/src/common/android/include/link.h
@@ -38,16 +38,17 @@
 // architectures - crbug.com/358831
 #if !defined(__aarch64__) && !defined(__x86_64__) && \
     !(defined(__mips__) && _MIPS_SIM == _ABI64)
 
 #ifdef __cplusplus
 extern "C" {
 #endif  // __cplusplus
 
+#if defined(ANDROID) && ANDROID_VERSION <= 20
 struct r_debug {
   int              r_version;
   struct link_map* r_map;
   ElfW(Addr)       r_brk;
   enum {
     RT_CONSISTENT,
     RT_ADD,
     RT_DELETE }    r_state;
@@ -56,16 +57,17 @@ struct r_debug {
 
 struct link_map {
   ElfW(Addr)       l_addr;
   char*            l_name;
   ElfW(Dyn)*       l_ld;
   struct link_map* l_next;
   struct link_map* l_prev;
 };
+#endif
 
 #ifdef __cplusplus
 }  // extern "C"
 #endif  // __cplusplus
 
 #endif  // !defined(__aarch64__) && !defined(__x86_64__)
 
 #endif /* GOOGLE_BREAKPAD_ANDROID_INCLUDE_LINK_H */
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -35,24 +35,19 @@ HOST_SOURCES += [
 ]
 
 HOST_CXXFLAGS += [
     '-O2',
     '-g',
 ]
 
 if CONFIG['OS_TARGET'] == 'Android':
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/gonk-include',
-        ]
-    else:
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-        ]
+    LOCAL_INCLUDES += [
+        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
+    ]
 
 Library('breakpad_linux_common_s')
 
 FINAL_LIBRARY = 'xul'
 
 HOST_DEFINES['NO_STABS_SUPPORT'] = True
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -49,25 +49,19 @@ if CONFIG['OS_ARCH'] != 'WINNT':
     ]
     HostLibrary('host_breakpad_common_s')
 
 if CONFIG['OS_TARGET'] == 'Android':
     # We don't support unifying assembly files.
     SOURCES += [
         'android/breakpad_getcontext.S',
     ]
-
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/gonk-include',
-        ]
-    else:
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-        ]
+    LOCAL_INCLUDES += [
+        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
+    ]
 
 Library('breakpad_common_s')
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -82,24 +82,19 @@ include('/ipc/chromium/chromium-config.m
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['ANDROID_PACKAGE_NAME'] = '"%s"' % CONFIG['ANDROID_PACKAGE_NAME']
     # NDK5 workarounds
     DEFINES['_STLP_CONST_CONSTRUCTOR_BUG'] = True
     DEFINES['_STLP_NO_MEMBER_TEMPLATES'] = True
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/gonk-include',
-        ]
-    else:
-        LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/google-breakpad/src/common/android/include',
-        ]
+    LOCAL_INCLUDES += [
+        '/toolkit/crashreporter/google-breakpad/src/common/android/include',
+    ]
 
 if CONFIG['OS_ARCH'] == 'SunOS':
     # there's no define for this normally
     DEFINES['XP_SOLARIS'] = True
 
 DEFINES['UNICODE'] = True
 DEFINES['_UNICODE'] = True
 
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -89,27 +89,23 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']:
         '/ipc/chromium/src',
         '/mozglue/linker',
         '/toolkit/crashreporter/google-breakpad/src',
         '/tools/profiler/core/',
         '/tools/profiler/gecko/',
         '/xpcom/base',
     ]
 
-    # We need access to Breakpad's getcontext(3) which is suitable for Android
-    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+    if CONFIG['OS_TARGET'] == 'Android':
         LOCAL_INCLUDES += [
-            '/toolkit/crashreporter/gonk-include',
-        ]
-    elif CONFIG['OS_TARGET'] == 'Android':
-        LOCAL_INCLUDES += [
+            # We need access to Breakpad's getcontext(3) which is suitable for Android
             '/toolkit/crashreporter/google-breakpad/src/common/android/include',
         ]
 
-    if not CONFIG['MOZ_CRASHREPORTER'] and CONFIG['OS_TARGET'] in ('Android', 'gonk'):
+    if not CONFIG['MOZ_CRASHREPORTER'] and CONFIG['OS_TARGET'] == 'Android':
         SOURCES += ['/toolkit/crashreporter/google-breakpad/src/common/android/breakpad_getcontext.S']
 
     if CONFIG['ANDROID_CPU_ARCH'] == 'armeabi':
         DEFINES['ARCH_ARMV6'] = True
 
     if CONFIG['ENABLE_TESTS']:
         DIRS += ['tests/gtest']
 
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2208,35 +2208,35 @@ TextInputHandler::InsertText(NSAttribute
       MOZ_LOG(gLog, LogLevel::Error,
         ("%p IMEInputHandler::HandleKeyUpEvent, "
          "FAILED, due to BeginNativeInputTransaction() failure", this));
     return;
   }
 
   // Dispatch keypress event with char instead of compositionchange event
   WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
+  // XXX Why do we need to dispatch keypress event for not inputting any
+  //     string?  If it wants to delete the specified range, should we
+  //     dispatch an eContentCommandDelete event instead?  Because this
+  //     must not be caused by a key operation, a part of IME's processing.
   keypressEvent.mIsChar = IsPrintableChar(str.CharAt(0));
 
   // Don't set other modifiers from the current event, because here in
   // -insertText: they've already been taken into account in creating
   // the input string.
 
   if (currentKeyEvent) {
     NSEvent* keyEvent = currentKeyEvent->mKeyEvent;
     InitKeyEvent(keyEvent, keypressEvent, &str);
   } else {
     nsCocoaUtils::InitInputEvent(keypressEvent, static_cast<NSEvent*>(nullptr));
-    if (keypressEvent.mIsChar) {
-      keypressEvent.mCharCode = str.CharAt(0);
-    }
-    // Note that insertText is not called only at key pressing.
-    if (!keypressEvent.mCharCode) {
-      keypressEvent.mKeyCode =
-        WidgetUtils::ComputeKeyCodeFromChar(keypressEvent.mCharCode);
-    }
+    keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
+    keypressEvent.mKeyValue = str;
+    // FYI: TextEventDispatcher will set mKeyCode to 0 for printable key's
+    //      keypress events even if they don't cause inputting non-empty string.
   }
 
   // Remove basic modifiers from keypress event because if they are included,
   // nsPlaintextEditor ignores the event.
   keypressEvent.mModifiers &= ~(MODIFIER_CONTROL |
                                 MODIFIER_ALT |
                                 MODIFIER_META);
 
--- a/widget/gonk/GonkPermission.cpp
+++ b/widget/gonk/GonkPermission.cpp
@@ -9,22 +9,26 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
+#include "GonkPermission.h"
 #include <binder/IPCThreadState.h>
 #include <binder/ProcessState.h>
 #include <binder/IServiceManager.h>
 #include <binder/IPermissionController.h>
+
+#ifndef HAVE_ANDROID_OS
+#define HAVE_ANDROID_OS 1
+#endif
 #include <private/android_filesystem_config.h>
-#include "GonkPermission.h"
 
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/SyncRunnable.h"
 #include "nsIAppsService.h"
 #include "mozIApplication.h"
 #include "nsThreadUtils.h"
 
--- a/widget/gonk/libdisplay/BootAnimation.cpp
+++ b/widget/gonk/libdisplay/BootAnimation.cpp
@@ -11,16 +11,17 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #include <algorithm>
 #include <endian.h>
 #include <fcntl.h>
+#include <pthread.h>
 #include <string>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <vector>
 #include "mozilla/FileUtils.h"
 #include "png.h"
 
 #include "android/log.h"
@@ -596,17 +597,17 @@ AnimationThread(void *)
         snprintf(search, sizeof(search), "%s/", part.path);
         while ((entry = reader.GetNextEntry(entry))) {
             string name = reader.GetEntryName(entry);
             if (name.find(search) ||
                 !entry->GetDataSize() ||
                 name.length() >= 256)
                 continue;
 
-            part.frames.push_back();
+            part.frames.resize(part.frames.size() + 1);
             AnimationFrame &frame = part.frames.back();
             strcpy(frame.path, name.c_str());
             frame.file = reader.GetLocalEntry(entry);
         }
 
         sort(part.frames.begin(), part.frames.end());
     }
 
--- a/widget/gonk/nativewindow/moz.build
+++ b/widget/gonk/nativewindow/moz.build
@@ -92,16 +92,18 @@ include('/ipc/chromium/chromium-config.m
 
 if CONFIG['ANDROID_VERSION'] >= '18':
     LOCAL_INCLUDES += [
         '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
             'frameworks/native/opengl/include',
         ]
     ]
 
+DEFINES['HAVE_ANDROID_OS'] = True
+
 # Suppress some GCC warnings being treated as errors:
 #  - about attributes on forward declarations for types that are already
 #    defined, which complains about an important MOZ_EXPORT for android::AString
 if CONFIG['GNU_CC']:
   CXXFLAGS += ['-Wno-error=attributes', '-Wno-overloaded-virtual']
 
 FINAL_LIBRARY = 'xul'
 
--- a/widget/nsDeviceContextSpecProxy.cpp
+++ b/widget/nsDeviceContextSpecProxy.cpp
@@ -1,19 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsDeviceContextSpecProxy.h"
 
+#include "gfxASurface.h"
 #include "gfxPlatform.h"
 #include "mozilla/gfx/DrawEventRecorder.h"
-#include "mozilla/gfx/PrintTargetRecording.h"
+#include "mozilla/gfx/PrintTargetThebes.h"
 #include "mozilla/layout/RemotePrintJobChild.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/unused.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIPrintSession.h"
 #include "nsIPrintSettings.h"
 
 using mozilla::Unused;
@@ -74,17 +75,38 @@ nsDeviceContextSpecProxy::MakePrintTarge
   if (NS_WARN_IF(NS_FAILED(rv)) || width <= 0 || height <= 0) {
     return nullptr;
   }
 
   // convert twips to points
   width /= TWIPS_PER_POINT_FLOAT;
   height /= TWIPS_PER_POINT_FLOAT;
 
-  return PrintTargetRecording::CreateOrNull(IntSize(width, height));
+  RefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->
+    CreateOffscreenSurface(mozilla::gfx::IntSize(width, height),
+                           mozilla::gfx::SurfaceFormat::A8R8G8B8_UINT32);
+  if (!surface) {
+    return nullptr;
+  }
+
+  // The type of PrintTarget that we return here shouldn't really matter since
+  // our implementation of GetDrawEventRecorder returns an object, which means
+  // the DrawTarget returned by the PrintTarget will be a DrawTargetRecording.
+  // The recording will be serialized and sent over to the parent process where
+  // PrintTranslator::TranslateRecording will call MakePrintTarget (indirectly
+  // via PrintTranslator::CreateDrawTarget) on whatever type of
+  // nsIDeviceContextSpecProxy is created for the platform that we are running
+  // on.  It is that DrawTarget that the recording will be replayed on to
+  // print.
+  // XXX(jwatt): The above isn't quite true.  We do want to use a
+  // PrintTargetRecording here, but we can't until bug 1280324 is figured out
+  // and fixed otherwise we will cause bug 1280181 to happen again.
+  RefPtr<PrintTarget> target = PrintTargetThebes::CreateOrNull(surface);
+
+  return target.forget();
 }
 
 NS_IMETHODIMP
 nsDeviceContextSpecProxy::GetDrawEventRecorder(mozilla::gfx::DrawEventRecorder** aDrawEventRecorder)
 {
   MOZ_ASSERT(aDrawEventRecorder);
   RefPtr<mozilla::gfx::DrawEventRecorder> result = mRecorder;
   result.forget(aDrawEventRecorder);
--- a/xpcom/threads/moz.build
+++ b/xpcom/threads/moz.build
@@ -63,23 +63,16 @@ UNIFIED_SOURCES += [
 ]
 
 LOCAL_INCLUDES += [
     '../build',
     '/caps',
     '/tools/profiler',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    # Gonk's bionic doesn't have ucontext.h
-    LOCAL_INCLUDES += [
-        '/toolkit/crashreporter/gonk-include',
-    ]
-
-
 # BHR disabled for Release builds because of bug 965392.
 # BHR disabled for debug builds because of bug 979069.
 # BHR disabled on gonk because of bug 1180533
 # BHR disabled for TSan builds because of bug 1121216.
 if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release') and \
    not CONFIG['MOZ_DEBUG'] and \
    not CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and \
    not CONFIG['MOZ_TSAN']: