Merge m-c to fx-team.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 21 Feb 2014 15:02:24 -0500
changeset 170385 44cd959279d195957f38cbaaa20d7c0db2ca2aaf
parent 170384 66b8fc136e5e695b355bf3240f5b9214cf5a35a2 (current diff)
parent 170315 1238ef12b99626c00a58b1721aff21e9ffafa988 (diff)
child 170386 a4baa3782ae288e80c2be56d62bc88b55fed6feb
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
milestone30.0a1
Merge m-c to fx-team.
--- a/b2g/chrome/content/content.css
+++ b/b2g/chrome/content/content.css
@@ -5,26 +5,23 @@
 @namespace url("http://www.w3.org/1999/xhtml");
 @namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 /* Style the scrollbars */
 xul|window xul|scrollbar {
   display: none;
 }
 
-html xul|scrollbar[root="true"] {
-  position: relative;
-  z-index: 2147483647;
-}
-
 html xul|scrollbar {
   -moz-appearance: none !important;
+  position: relative;
   background-color: transparent !important;
   background-image: none !important;
   border: 0px solid transparent !important;
+  z-index: 2147483647;
   pointer-events: none;
   opacity: 1;
 }
 
 xul|scrollbar[orient="vertical"] {
   -moz-margin-start: -8px;
   min-width: 8px;
   max-width: 8px;
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -7,18 +7,18 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="022eadd5917615ff00c47eaaafa792b45e9c8a28"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
   <project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -6,18 +6,18 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="9025e50b9d29b3cabbbb21e1dd94d0d13121a17e"/>
@@ -117,14 +117,14 @@
   <project name="platform/system/security" path="system/security" revision="f48ff68fedbcdc12b570b7699745abb6e7574907"/>
   <project name="platform/system/vold" path="system/vold" revision="8de05d4a52b5a91e7336e6baa4592f945a6ddbea"/>
   <default remote="caf" revision="refs/tags/android-4.3_r2.1" sync-j="4"/>
   <!-- Emulator specific things -->
   <project name="android-development" path="development" remote="b2g" revision="dab55669da8f48b6e57df95d5af9f16b4a87b0b1"/>
   <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
   <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="09485b73629856b21b2ed6073e327ab0e69a1189"/>
   <project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
-  <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="8f7c9ac889ae2c778197b4a4c0529d60530f480b"/>
+  <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="594cef96f1e5353f41dc75c4e8b586b1dd980f49"/>
   <project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
-  <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2838a77ce4b8c09fa6a46fe25410bb3a4474cbd4"/>
+  <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="72e3a520e3c700839f07ba0113fd527b923c3330"/>
   <project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="c283f635d537f3fb249813028702577be50fdcef"/>
   <project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
 </manifest>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -7,18 +7,18 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="022eadd5917615ff00c47eaaafa792b45e9c8a28"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
   <project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "5ef18673926479e25a67e4133256f11dea0cf88e", 
+    "revision": "5b157e823d42532a365d33cfe3a8bd9ba4b71152", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -6,18 +6,18 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
   <project name="platform/bootable/recovery" path="bootable/recovery" revision="746bc48f34f5060f90801925dcdd964030c1ab6d"/>
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -5,18 +5,18 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
   <project name="platform/bootable/recovery" path="bootable/recovery" revision="575fdbf046e966a5915b1f1e800e5d6ad0ea14c0"/>
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -7,18 +7,18 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
   <project name="platform/bootable/recovery" path="bootable/recovery" revision="e0a9ac010df3afaa47ba107192c05ac8b5516435"/>
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -6,18 +6,18 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -6,18 +6,18 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="9025e50b9d29b3cabbbb21e1dd94d0d13121a17e"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -6,18 +6,18 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="b88eb63c3950ecaa88d00399735e52d83ab6e307"/>
-  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6894b915ee7d031a1f0ed16c422c48f293de1b84"/>
+  <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
--- a/browser/locales/en-US/chrome/browser/preferences/connection.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/connection.dtd
@@ -40,10 +40,10 @@
 <!ENTITY  FTPport.accesskey             "r">
 <!ENTITY  SOCKSport.accesskey           "t">
 <!ENTITY  noproxy.label                 "No Proxy for:">
 <!ENTITY  noproxy.accesskey             "n">
 <!ENTITY  noproxyExplain.label          "Example: .mozilla.org, .net.nz, 192.168.1.0/24">
 <!ENTITY  shareproxy.label              "Use this proxy server for all protocols">
 <!ENTITY  shareproxy.accesskey          "s">
 <!ENTITY  autologinproxy.label          "Do not prompt for authentication if password is saved">
-<!ENTITY  autologinproxy.accesskey      "a">
+<!ENTITY  autologinproxy.accesskey      "v">
 <!ENTITY  autologinproxy.tooltip        "This option silently authenticates you to proxies when you have saved credentials for them. You will be prompted if authentication fails.">
--- a/content/media/fmp4/PlatformDecoderModule.h
+++ b/content/media/fmp4/PlatformDecoderModule.h
@@ -139,16 +139,17 @@ public:
 // arbitrary thread.
 //
 // Decoding is done asynchronously. Any async work can be done on the
 // MediaTaskQueue passed into the PlatformDecoderModules's Create*Decoder()
 // function. This may not be necessary for platforms with async APIs
 // for decoding.
 class MediaDataDecoder : public AtomicRefCounted<MediaDataDecoder> {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaDataDecoder)
   virtual ~MediaDataDecoder() {};
 
   // Initialize the decoder. The decoder should be ready to decode after
   // this returns. The decoder should do any initialization here, rather
   // than in its constructor or PlatformDecoderModule::Create*Decoder(),
   // so that if the MP4Reader needs to shutdown during initialization,
   // it can call Shutdown() to cancel this operation. Any initialization
   // that requires blocking the calling thread in this function *must*
--- a/content/media/fmp4/wmf/MFTDecoder.h
+++ b/content/media/fmp4/wmf/MFTDecoder.h
@@ -11,16 +11,17 @@
 #include "mozilla/RefPtr.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "nsIThread.h"
 
 namespace mozilla {
 
 class MFTDecoder : public AtomicRefCounted<MFTDecoder> {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(MTFDecoder)
   MFTDecoder();
   ~MFTDecoder();
 
   // Creates the MFT. First thing to do as part of setup.
   //
   // Params:
   //  - aMFTClsID the clsid used by CoCreateInstance to instantiate the
   //    decoder MFT.
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1,20 +1,21 @@
 /* -*- 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 "mozilla/layers/CompositorParent.h"
+#include "nsDOMWindowUtils.h"
+
+#include "mozilla/layers/CompositorChild.h"
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "nsPresContext.h"
 #include "nsDOMClassInfoID.h"
 #include "nsError.h"
 #include "nsIDOMEvent.h"
-#include "nsDOMWindowUtils.h"
 #include "nsQueryContentEventResult.h"
 #include "CompositionStringSynthesizer.h"
 #include "nsGlobalWindow.h"
 #include "nsIDocument.h"
 #include "nsFocusManager.h"
 #include "nsEventStateManager.h"
 #include "nsFrameManager.h"
 #include "nsRefreshDriver.h"
@@ -2543,31 +2544,48 @@ NS_IMETHODIMP
 nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
 {
   if (!nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
   driver->AdvanceTimeAndRefresh(aMilliseconds);
-  CompositorParent::SetTimeAndSampleAnimations(driver->MostRecentRefresh(), true);
+
+  nsIWidget* widget = GetWidget();
+  if (widget) {
+    CompositorChild* compositor = widget->GetRemoteRenderer();
+    if (compositor) {
+      compositor->SendSetTestSampleTime(driver->MostRecentRefresh());
+    }
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::RestoreNormalRefresh()
 {
   if (!nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
+  // Kick the compositor out of test mode before the refresh driver, so that
+  // the refresh driver doesn't send an update that gets ignored by the
+  // compositor.
+  nsIWidget* widget = GetWidget();
+  if (widget) {
+    CompositorChild* compositor = widget->GetRemoteRenderer();
+    if (compositor) {
+      compositor->SendLeaveTestMode();
+    }
+  }
+
   nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
   driver->RestoreNormalRefresh();
-  CompositorParent::SetTimeAndSampleAnimations(driver->MostRecentRefresh(), false);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::GetIsTestControllingRefreshes(bool *aResult)
 {
   if (!nsContentUtils::IsCallerChrome()) {
--- a/dom/base/nsDOMWindowUtils.h
+++ b/dom/base/nsDOMWindowUtils.h
@@ -5,19 +5,23 @@
 
 #ifndef nsDOMWindowUtils_h_
 #define nsDOMWindowUtils_h_
 
 #include "nsWeakReference.h"
 
 #include "nsIDOMWindowUtils.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/BasicEvents.h"
 
 class nsGlobalWindow;
 class nsIPresShell;
+class nsIWidget;
+class nsPresContext;
+class nsPoint;
 
 class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
                                    public nsSupportsWeakReference
 {
 public:
   nsDOMWindowUtils(nsGlobalWindow *aWindow);
   ~nsDOMWindowUtils();
   NS_DECL_ISUPPORTS
--- a/dom/bluetooth/BluetoothProfileController.h
+++ b/dom/bluetooth/BluetoothProfileController.h
@@ -54,16 +54,17 @@ BEGIN_BLUETOOTH_NAMESPACE
 
 class BluetoothProfileManagerBase;
 class BluetoothReplyRunnable;
 typedef void (*BluetoothProfileControllerCallback)();
 
 class BluetoothProfileController : public RefCounted<BluetoothProfileController>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(BluetoothProfileController)
   /**
    * @param aConnect:       If it's a connect request, the value should be set
    *                        to true. For disconnect request, set it to false.
    * @param aDeviceAddress: The address of remote device.
    * @param aRunnable:      Once the controller has done, the runnable will be
    *                        replied. When all connection/disconnection attemps
    *                        have failed, an error is fired. In other words,
    *                        reply a success if any attemp successes.
--- a/dom/events/nsEventStateManager.cpp
+++ b/dom/events/nsEventStateManager.cpp
@@ -1107,16 +1107,17 @@ nsEventStateManager::PreHandleEvent(nsPr
       // then fall through...
     } else {
       GenerateMouseEnterExit(mouseEvent);
       //This is a window level mouse exit event and should stop here
       aEvent->message = 0;
       break;
     }
   case NS_MOUSE_MOVE:
+  case NS_POINTER_DOWN:
   case NS_POINTER_MOVE: {
     // on the Mac, GenerateDragGesture() may not return until the drag
     // has completed and so |aTargetFrame| may have been deleted (moving
     // a bookmark, for example).  If this is the case, however, we know
     // that ClearFrameRefs() has been called and it cleared out
     // |mCurrentTarget|. As a result, we should pass |mCurrentTarget|
     // into UpdateCursor().
     GenerateDragGesture(aPresContext, mouseEvent);
@@ -4418,16 +4419,17 @@ nsEventStateManager::GenerateMouseEnterE
         aMouseEvent->lastRefPoint = sLastRefPoint;
       }
 
       // Update the last known refPoint with the current refPoint.
       sLastRefPoint = aMouseEvent->refPoint;
 
     }
   case NS_POINTER_MOVE:
+  case NS_POINTER_DOWN:
     {
       // Get the target content target (mousemove target == mouseover target)
       nsCOMPtr<nsIContent> targetElement = GetEventTargetContent(aMouseEvent);
       if (!targetElement) {
         // We're always over the document root, even if we're only
         // over dead space in a page (whose frame is not associated with
         // any content) or in print preview dead space
         targetElement = mDocument->GetRootElement();
--- a/dom/events/test/test_bug967796.html
+++ b/dom/events/test/test_bug967796.html
@@ -129,16 +129,35 @@ function runTests() {
   synthesizePointer(iframe.contentDocument.body, r.width / 2, r.height - (r.height / 4), {type: "pointermove"},
                     iframe.contentWindow);
   is(pointerentercount, 7, "Unexpected pointerenter event count!");
   expectedRelatedEnter = iframe;
   expectedRelatedLeave = outside;
   sendPointerEvent("pointermove", outside);
   is(pointerleavecount, 7, "Unexpected pointerleave event count!");
 
+  // pointerdown must produce pointerenter event
+  expectedRelatedEnter = outside;
+  expectedRelatedLeave = iframe;
+  // Move pointer inside the iframe.
+  synthesizePointer(iframe.contentDocument.body, r.width / 2, r.height / 4, {type: "pointerdown"},
+                    iframe.contentWindow);
+  synthesizePointer(iframe.contentDocument.body, r.width / 2, r.height - (r.height / 4), {type: "pointerdown"},
+                    iframe.contentWindow);
+  is(pointerentercount, 10, "Unexpected pointerenter event count!");
+
+  // pointerdown + pointermove must produce single pointerenter event
+  expectedRelatedEnter = outside;
+  expectedRelatedLeave = iframe;
+  synthesizePointer(iframe.contentDocument.body, r.width / 2, r.height / 4, {type: "pointerdown"},
+                    iframe.contentWindow);
+  synthesizePointer(iframe.contentDocument.body, r.width / 2 + 1, r.height / 4 + 1, {type: "pointermove"},
+                    iframe.contentWindow);
+  is(pointerentercount, 11, "Unexpected pointerenter event count!");
+
   SpecialPowers.clearUserPref("dom.w3c_pointer_events.enabled");      // Disable Pointer Events
 
   SimpleTest.finish();
 }
 
 function penter(evt) {
   ++pointerentercount;
   evt.stopPropagation();
--- a/dom/plugins/base/nsIPluginTag.idl
+++ b/dom/plugins/base/nsIPluginTag.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; 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 "nsISupports.idl"
 
-[scriptable, uuid(0354d96d-3fd3-4365-a0a2-6c807ec1ce95)]
+[scriptable, uuid(0e56f04d-cda4-4a55-ab83-e5e29ddd370e)]
 interface nsIPluginTag : nsISupports
 {
   // enabledState is stored as one of the following as an integer in prefs,
   // so if new states are added, they must not renumber the existing states.
   const unsigned long STATE_DISABLED = 0;
   const unsigned long STATE_CLICKTOPLAY = 1;
   const unsigned long STATE_ENABLED = 2;
 
@@ -24,16 +24,18 @@ interface nsIPluginTag : nsISupports
    * true only if this plugin is "hardblocked" and cannot be enabled.
    */
   readonly attribute boolean blocklisted;
 
   readonly attribute boolean disabled;
   readonly attribute boolean clicktoplay;
            attribute unsigned long enabledState;
 
+  readonly attribute PRTime lastModifiedTime;
+
   void getMimeTypes([optional] out unsigned long aCount,
                     [retval, array, size_is(aCount)] out wstring aResults);
   void getMimeDescriptions([optional] out unsigned long aCount,
                            [retval, array, size_is(aCount)]
                            out wstring aResults);
   void getExtensions([optional] out unsigned long aCount,
                      [retval, array, size_is(aCount)]
                      out wstring aResults);
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1771,23 +1771,22 @@ nsresult nsPluginHost::ScanPluginsDirect
         }
         mInvalidPlugins = invalidTag;
 
         // Mark aPluginsChanged so pluginreg is rewritten
         *aPluginsChanged = true;
         continue;
       }
 
-      pluginTag = new nsPluginTag(&info);
+      pluginTag = new nsPluginTag(&info, fileModTime);
       pluginFile.FreePluginInfo(info);
       if (!pluginTag)
         return NS_ERROR_OUT_OF_MEMORY;
 
       pluginTag->mLibrary = library;
-      pluginTag->mLastModifiedTime = fileModTime;
       uint32_t state = pluginTag->GetBlocklistState();
 
       // If the blocklist says it is risky and we have never seen this
       // plugin before, then disable it.
       // If the blocklist says this is an outdated plugin, warn about
       // outdated plugins.
       if (state == nsIBlocklistService::STATE_SOFTBLOCKED && !seenBefore) {
         pluginTag->SetEnabledState(nsIPluginTag::STATE_DISABLED);
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -57,26 +57,26 @@ MakePrefNameForPlugin(const char* const 
 static nsCString
 GetStatePrefNameForPlugin(nsPluginTag* aTag)
 {
   return MakePrefNameForPlugin("state", aTag);
 }
 
 /* nsPluginTag */
 
-nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo)
+nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo, int64_t aLastModifiedTime)
   : mName(aPluginInfo->fName),
     mDescription(aPluginInfo->fDescription),
     mLibrary(nullptr),
     mIsJavaPlugin(false),
     mIsFlashPlugin(false),
     mFileName(aPluginInfo->fFileName),
     mFullPath(aPluginInfo->fFullPath),
     mVersion(aPluginInfo->fVersion),
-    mLastModifiedTime(0),
+    mLastModifiedTime(aLastModifiedTime),
     mNiceFileName(),
     mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED),
     mCachedBlocklistStateValid(false)
 {
   InitMime(aPluginInfo->fMimeTypeArray,
            aPluginInfo->fMimeDescriptionArray,
            aPluginInfo->fExtensionArray,
            aPluginInfo->fVariantCount);
@@ -561,8 +561,16 @@ nsPluginTag::GetBlocklistState()
   return state;
 }
 
 void
 nsPluginTag::InvalidateBlocklistState()
 {
   mCachedBlocklistStateValid = false;
 }
+
+nsresult
+nsPluginTag::GetLastModifiedTime(PRTime* aLastModifiedTime)
+{
+  MOZ_ASSERT(aLastModifiedTime);
+  *aLastModifiedTime = mLastModifiedTime;
+  return NS_OK;
+}
--- a/dom/plugins/base/nsPluginTags.h
+++ b/dom/plugins/base/nsPluginTags.h
@@ -31,27 +31,27 @@ public:
   // These must match the STATE_* values in nsIPluginTag.idl
   enum PluginState {
     ePluginState_Disabled = 0,
     ePluginState_Clicktoplay = 1,
     ePluginState_Enabled = 2,
     ePluginState_MaxValue = 3,
   };
 
-  nsPluginTag(nsPluginInfo* aPluginInfo);
+  nsPluginTag(nsPluginInfo* aPluginInfo, int64_t aLastModifiedTime);
   nsPluginTag(const char* aName,
               const char* aDescription,
               const char* aFileName,
               const char* aFullPath,
               const char* aVersion,
               const char* const* aMimeTypes,
               const char* const* aMimeDescriptions,
               const char* const* aExtensions,
               int32_t aVariants,
-              int64_t aLastModifiedTime = 0,
+              int64_t aLastModifiedTime,
               bool aArgsAreUTF8 = false);
   virtual ~nsPluginTag();
 
   void TryUnloadPlugin(bool inShutdown);
 
   // plugin is enabled and not blocklisted
   bool IsActive();
 
--- a/dom/system/gonk/AutoMounter.cpp
+++ b/dom/system/gonk/AutoMounter.cpp
@@ -161,16 +161,17 @@ private:
     int   mErrorCount;
 };
 
 /***************************************************************************/
 
 class AutoMounter : public RefCounted<AutoMounter>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(AutoMounter)
 
   typedef nsTArray<RefPtr<Volume> > VolumeArray;
 
   AutoMounter()
     : mResponseCallback(new AutoMounterResponseCallback),
       mMode(AUTOMOUNTER_DISABLE)
   {
     VolumeManager::RegisterStateObserver(&mVolumeManagerStateObserver);
@@ -627,16 +628,17 @@ UsbCableEventIOThread()
 *   to IOThread context before we can do anything.
 *
 **************************************************************************/
 
 class UsbCableObserver : public SwitchObserver,
                          public RefCounted<UsbCableObserver>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(UsbCableObserver)
   UsbCableObserver()
   {
     RegisterSwitchObserver(SWITCH_USB, this);
   }
 
   ~UsbCableObserver()
   {
     UnregisterSwitchObserver(SWITCH_USB, this);
--- a/dom/system/gonk/Volume.h
+++ b/dom/system/gonk/Volume.h
@@ -22,16 +22,17 @@ namespace system {
 *
 *   Each volume originates from the /system/etv/vold.fstab file.
 *
 ***************************************************************************/
 
 class Volume : public RefCounted<Volume>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(Volume)
   Volume(const nsCSubstring& aVolumeName);
 
   typedef long STATE; // States are now defined in nsIVolume.idl
 
   static const char* StateStr(STATE aState) { return NS_VolumeStateStr(aState); }
   const char* StateStr() const  { return StateStr(mState); }
   STATE State() const           { return mState; }
 
--- a/dom/system/gonk/VolumeCommand.h
+++ b/dom/system/gonk/VolumeCommand.h
@@ -30,16 +30,17 @@ class VolumeCommand;
 *
 *   Valid Response codes can be found in the vold/ResponseCode.h header.
 *
 ***************************************************************************/
 
 class VolumeResponseCallback : public RefCounted<VolumeResponseCallback>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeResponseCallback)
   VolumeResponseCallback()
     : mResponseCode(0), mPending(false) {}
 
   virtual ~VolumeResponseCallback() {}
 
   bool Done() const
   {
     // Response codes from the 200, 400, and 500 series all indicated that
@@ -103,16 +104,17 @@ private:
 *   All of these commands are asynchronous in nature, and the
 *   ResponseReceived callback will be called when a response is available.
 *
 ***************************************************************************/
 
 class VolumeCommand : public RefCounted<VolumeCommand>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeCommand)
   VolumeCommand(VolumeResponseCallback* aCallback)
     : mBytesConsumed(0),
       mCallback(aCallback)
   {
     SetCmd(NS_LITERAL_CSTRING(""));
   }
 
   VolumeCommand(const nsACString& aCommand, VolumeResponseCallback* aCallback)
--- a/dom/system/gonk/VolumeManager.h
+++ b/dom/system/gonk/VolumeManager.h
@@ -72,16 +72,17 @@ namespace system {
 *   commands are being used.
 *
 ***************************************************************************/
 
 class VolumeManager : public MessageLoopForIO::LineWatcher,
                       public RefCounted<VolumeManager>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeManager)
 
   typedef nsTArray<RefPtr<Volume> > VolumeArray;
 
   VolumeManager();
   virtual ~VolumeManager();
 
   //-----------------------------------------------------------------------
   //
--- a/dom/system/gonk/VolumeServiceIOThread.h
+++ b/dom/system/gonk/VolumeServiceIOThread.h
@@ -18,16 +18,17 @@ class nsVolumeService;
 * The nsVolumeServiceIOThread is a companion class to the nsVolumeService
 * class, but whose methods are called from IOThread.
 */
 class VolumeServiceIOThread : public VolumeManager::StateObserver,
                               public Volume::EventObserver,
                               public RefCounted<VolumeServiceIOThread>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeServiceIOThread)
   VolumeServiceIOThread(nsVolumeService* aVolumeService);
   ~VolumeServiceIOThread();
 
 private:
   void  UpdateAllVolumes();
 
   virtual void Notify(const VolumeManager::StateChangedEvent& aEvent);
   virtual void Notify(Volume* const & aVolume);
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -368,16 +368,38 @@ CompositorParent::RecvStopFrameTimeRecor
                                              InfallibleTArray<float>* intervals)
 {
   if (mLayerManager) {
     mLayerManager->StopFrameTimeRecording(aStartIndex, *intervals);
   }
   return true;
 }
 
+bool
+CompositorParent::RecvSetTestSampleTime(const TimeStamp& aTime)
+{
+  if (aTime.IsNull()) {
+    return false;
+  }
+
+  mIsTesting = true;
+  mTestTime = aTime;
+  if (mCompositionManager) {
+    mCompositionManager->TransformShadowTree(aTime);
+  }
+  return true;
+}
+
+bool
+CompositorParent::RecvLeaveTestMode()
+{
+  mIsTesting = false;
+  return true;
+}
+
 void
 CompositorParent::ActorDestroy(ActorDestroyReason why)
 {
   mPaused = true;
   RemoveCompositor(mCompositorID);
 
   if (mLayerManager) {
     mLayerManager->Destroy();
@@ -858,31 +880,16 @@ CompositorParent* CompositorParent::Remo
   if (it == sCompositorMap->end()) {
     return nullptr;
   }
   CompositorParent *retval = it->second;
   sCompositorMap->erase(it);
   return retval;
 }
 
-/* static */ void
-CompositorParent::SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting)
-{
-  if (!sCompositorMap) {
-    return;
-  }
-  for (CompositorMap::iterator it = sCompositorMap->begin(); it != sCompositorMap->end(); ++it) {
-    it->second->mIsTesting = aIsTesting;
-    it->second->mTestTime = aTime;
-    if (it->second->mCompositionManager) {
-      it->second->mCompositionManager->TransformShadowTree(aTime);
-    }
-  }
-}
-
 bool
 CompositorParent::RecvNotifyChildCreated(const uint64_t& child)
 {
   NotifyChildCreated(child);
   return true;
 }
 
 void
@@ -1008,16 +1015,18 @@ public:
   virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
                                 SurfaceDescriptor* aOutSnapshot)
   { return true; }
   virtual bool RecvFlushRendering() MOZ_OVERRIDE { return true; }
   virtual bool RecvForceComposite() MOZ_OVERRIDE { return true; }
   virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
   virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
   virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE  { return true; }
+  virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE { return true; }
+  virtual bool RecvLeaveTestMode() MOZ_OVERRIDE { return true; }
 
   virtual PLayerTransactionParent*
     AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
                                  const uint64_t& aId,
                                  TextureFactoryIdentifier* aTextureFactoryIdentifier,
                                  bool *aSuccess) MOZ_OVERRIDE;
 
   virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -88,16 +88,18 @@ public:
   virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
                                 SurfaceDescriptor* aOutSnapshot) MOZ_OVERRIDE;
   virtual bool RecvFlushRendering() MOZ_OVERRIDE;
   virtual bool RecvForceComposite() MOZ_OVERRIDE;
 
   virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE;
   virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE;
   virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE;
+  virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
+  virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
 
   virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
   virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
                                    const TargetConfig& aTargetConfig,
                                    bool aIsFirstPaint,
                                    bool aScheduleComposite) MOZ_OVERRIDE;
   virtual AsyncCompositionManager* GetCompositionManager() MOZ_OVERRIDE { return mCompositionManager; }
@@ -218,28 +220,20 @@ public:
    * exists.  Otherwise null is returned.  This must only be called on
    * the compositor thread.
    */
   static const LayerTreeState* GetIndirectShadowTree(uint64_t aId);
 
   float ComputeRenderIntegrity();
 
   /**
-   * Tell all CompositorParents to update their last refresh to aTime and sample
-   * animations at this time stamp.  If aIsTesting is true, the
-   * CompositorParents will become "paused" and continue sampling animations at
-   * this time stamp until this function is called again with aIsTesting set to
-   * false.
-   */
-  static void SetTimeAndSampleAnimations(TimeStamp aTime, bool aIsTesting);
-
-  /**
    * Returns true if the calling thread is the compositor thread.
    */
   static bool IsInCompositorThread();
+
 protected:
   virtual PLayerTransactionParent*
     AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
                                  const uint64_t& aId,
                                  TextureFactoryIdentifier* aTextureFactoryIdentifier,
                                  bool* aSuccess) MOZ_OVERRIDE;
   virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
   virtual void ScheduleTask(CancelableTask*, int);
--- a/gfx/layers/ipc/PCompositor.ipdl
+++ b/gfx/layers/ipc/PCompositor.ipdl
@@ -13,16 +13,17 @@ include "nsRegion.h";
 
 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
 using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
 using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
 using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
 using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
 using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
 using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
+using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
 
 namespace mozilla {
 namespace layers {
 
 
 /**
  * The PCompositor protocol is used to manage communication between
  * the main thread and the compositor thread context. It's primary
@@ -72,16 +73,22 @@ parent:
   async ForceComposite();
 
   sync StartFrameTimeRecording(int32_t bufferSize)
     returns (uint32_t startIndex);
 
   sync StopFrameTimeRecording(uint32_t startIndex)
     returns (float[] intervals);
 
+  // Enter test mode, set the sample time to sampleTime, and resample animations.
+  // sampleTime must not be null.
+  sync SetTestSampleTime(TimeStamp sampleTime);
+  // Leave test mode and resume normal compositing
+  sync LeaveTestMode();
+
   // layersBackendHints is an ordered list of preffered backends where
   // layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
   // that hint is ignored.
   sync PLayerTransaction(LayersBackend[] layersBackendHints, uint64_t id)
     returns (TextureFactoryIdentifier textureFactoryIdentifier, bool success);
 
   // Notify the compositor that a region of the screen has been invalidated.
   async NotifyRegionInvalidated(nsIntRegion region);
--- a/hal/gonk/GonkHal.cpp
+++ b/hal/gonk/GonkHal.cpp
@@ -293,16 +293,17 @@ public:
 };
 
 } // anonymous namespace
 
 class BatteryObserver : public IUeventObserver,
                         public RefCounted<BatteryObserver>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(BatteryObserver)
   BatteryObserver()
     :mUpdater(new BatteryUpdater())
   {
   }
 
   virtual void Notify(const NetlinkEvent &aEvent)
   {
     // this will run on IO thread
--- a/hal/gonk/GonkSwitch.cpp
+++ b/hal/gonk/GonkSwitch.cpp
@@ -49,16 +49,17 @@ namespace hal_impl {
  *    SUBSYSTEM=switch
  *    SWITCH_NAME=usb_configuration
  *    SWITCH_STATE=0
  *    SEQNUM=5038
  */
 class SwitchHandler : public RefCounted<SwitchHandler>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(SwitchHandler)
   SwitchHandler(const char* aDevPath, SwitchDevice aDevice)
     : mDevPath(aDevPath),
       mState(SWITCH_STATE_UNKNOWN),
       mDevice(aDevice)
   {
     GetInitialState();
   }
 
@@ -228,16 +229,17 @@ public:
 private:
   SwitchEvent mEvent;
 };
 
 class SwitchEventObserver : public IUeventObserver,
                             public RefCounted<SwitchEventObserver>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(SwitchEventObserver)
   SwitchEventObserver() : mEnableCount(0)
   {
     Init();
   }
 
   ~SwitchEventObserver()
   {
     mHandler.Clear();
--- a/ipc/dbus/DBusUtils.h
+++ b/ipc/dbus/DBusUtils.h
@@ -56,16 +56,17 @@ private:
  * DBusReplyHandler represents a handler for DBus reply messages. Inherit
  * from this class and implement the Handle method. The method Callback
  * should be passed to the DBus send function, with the class instance as
  * user-data argument.
  */
 class DBusReplyHandler : public mozilla::RefCounted<DBusReplyHandler>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(DBusReplyHandler)
   virtual ~DBusReplyHandler() {
   }
 
   /**
    * Implements a call-back function for DBus. The supplied value for
    * aData must be a pointer to an instance of DBusReplyHandler.
    */
   static void Callback(DBusMessage* aReply, void* aData);
--- a/ipc/netd/Netd.h
+++ b/ipc/netd/Netd.h
@@ -24,29 +24,31 @@ struct NetdCommand
 
   // Number of octets in mData.
   size_t mSize;
 };
 
 class NetdConsumer : public mozilla::RefCounted<NetdConsumer>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(NetdConsumer)
   virtual ~NetdConsumer() { }
   virtual void MessageReceived(NetdCommand* aMessage) = 0;
 };
 
 class NetdWriteTask : public Task
 {
   virtual void Run();
 };
 
 class NetdClient : public MessageLoopForIO::LineWatcher,
                    public RefCounted<NetdClient>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(NetdClient)
   typedef std::queue<NetdCommand*> NetdCommandQueue;
 
   NetdClient();
   virtual ~NetdClient();
   static void Start();
   static void SendNetdCommandIOThread(NetdCommand* aMessage);
 
 private:
--- a/ipc/unixsocket/UnixSocket.h
+++ b/ipc/unixsocket/UnixSocket.h
@@ -155,16 +155,17 @@ enum SocketConnectionStatus {
   SOCKET_LISTENING = 1,
   SOCKET_CONNECTING = 2,
   SOCKET_CONNECTED = 3
 };
 
 class UnixSocketConsumer : public RefCounted<UnixSocketConsumer>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(UnixSocketConsumer)
   UnixSocketConsumer();
 
   virtual ~UnixSocketConsumer();
 
   SocketConnectionStatus GetConnectionStatus() const
   {
     MOZ_ASSERT(NS_IsMainThread());
     return mConnectionStatus;
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug975290.js
@@ -0,0 +1,6 @@
+for (var j = 0; j < 9999; ++j) {
+    (function() {
+        Math.pow(Math.fround(), Math.fround(0))
+    })();
+}
+
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -837,16 +837,18 @@ IonBuilder::inlineMathPow(CallInfo &call
             MMul *mul = MMul::New(alloc(), y, y, outputType);
             current->add(mul);
             output = mul;
         }
     }
 
     // Use MPow for other powers
     if (!output) {
+        if (powerType == MIRType_Float32)
+            powerType = MIRType_Double;
         MPow *pow = MPow::New(alloc(), base, power, powerType);
         current->add(pow);
         output = pow;
     }
 
     // Cast to the right type
     if (outputType == MIRType_Int32 && output->type() != MIRType_Int32) {
         MToInt32 *toInt = MToInt32::New(alloc(), output);
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -3747,16 +3747,17 @@ class MPow
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(Pow)
     static MPow *New(TempAllocator &alloc, MDefinition *input, MDefinition *power,
                      MIRType powerType)
     {
+        JS_ASSERT(powerType == MIRType_Double || powerType == MIRType_Int32);
         return new(alloc) MPow(input, power, powerType);
     }
 
     MDefinition *input() const {
         return lhs();
     }
     MDefinition *power() const {
         return rhs();
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -232,21 +232,23 @@ static inline MaskLayerImageCache* GetMa
  * layer, giving us the best chance of getting subpixel AA.
  */
 class ThebesLayerData {
 public:
   ThebesLayerData() :
     mAnimatedGeometryRoot(nullptr), mReferenceFrame(nullptr),
     mLayer(nullptr),
     mIsSolidColorInVisibleRegion(false),
+    mSingleItemFixedToViewport(false),
     mNeedComponentAlpha(false),
     mForceTransparentSurface(false),
     mImage(nullptr),
     mCommonClipCount(-1),
-    mAllDrawingAbove(false) {}
+    mAllDrawingAbove(false)
+  {}
   /**
    * Record that an item has been added to the ThebesLayer, so we
    * need to update our regions.
    * @param aVisibleRect the area of the item that's visible
    * @param aDrawRect the area of the item that would be drawn if it
    * was completely visible
    * @param aOpaqueRect if non-null, the area of the item that's opaque.
    * We pass in a separate opaque rect because the opaque rect can be
@@ -380,16 +382,21 @@ public:
    * region.
    */
   nscolor      mSolidColor;
   /**
    * True if every pixel in mVisibleRegion will have color mSolidColor.
    */
   bool mIsSolidColorInVisibleRegion;
   /**
+   * True if the layer contains exactly one item that returned true for
+   * ShouldFixToViewport.
+   */
+  bool mSingleItemFixedToViewport;
+  /**
    * True if there is any text visible in the layer that's over
    * transparent pixels in the layer.
    */
   bool mNeedComponentAlpha;
   /**
    * Set if the layer should be treated as transparent, even if its entire
    * area is covered by opaque display items. For example, this needs to
    * be set if something is going to "punch holes" in the layer by clearing
@@ -602,20 +609,23 @@ protected:
    */
   nscolor FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex);
   /**
    * Find the fixed-pos frame, if any, containing (or equal to)
    * aAnimatedGeometryRoot. Only return a fixed-pos frame if its viewport
    * has a displayport. Updates *aVisibleRegion to be the intersection of
    * aDrawRegion and the displayport, and updates *aIsSolidColorInVisibleRegion
    * (if non-null) to false if the visible region grows.
+   * aDisplayItemFixedToViewport is true if the layer contains a single display
+   * item which returned true for ShouldFixToViewport.
    * This can return the actual viewport frame for layers whose display items
    * are directly on the viewport (e.g. background-attachment:fixed backgrounds).
    */
   const nsIFrame* FindFixedPosFrameForLayerData(const nsIFrame* aAnimatedGeometryRoot,
+                                                bool aDisplayItemFixedToViewport,
                                                 const nsIntRegion& aDrawRegion,
                                                 nsIntRegion* aVisibleRegion,
                                                 bool* aIsSolidColorInVisibleRegion = nullptr);
   /**
    * Set fixed-pos layer metadata on aLayer according to the data for aFixedPosFrame.
    */
   void SetFixedPositionLayerData(Layer* aLayer,
                                  const nsIFrame* aFixedPosFrame);
@@ -636,21 +646,25 @@ protected:
    * layer is found. If we choose a ThebesLayer that's already on the
    * ThebesLayerData stack, later elements on the stack will be popped off.
    * @param aVisibleRect the area of the next display item that's visible
    * @param aAnimatedGeometryRoot the active scrolled root for the next
    * display item
    * @param aOpaqueRect if non-null, a region of the display item that is opaque
    * @param aSolidColor if non-null, indicates that every pixel in aVisibleRect
    * will be painted with aSolidColor by the item
+   * @param aShouldFixToViewport if true, aAnimatedGeometryRoot is the viewport
+   * and we will be adding fixed-pos metadata for this layer because the
+   * display item returned true from ShouldFixToViewport.
    */
   ThebesLayerData* FindThebesLayerFor(nsDisplayItem* aItem,
                                       const nsIntRect& aVisibleRect,
                                       const nsIFrame* aAnimatedGeometryRoot,
-                                      const nsPoint& aTopLeft);
+                                      const nsPoint& aTopLeft,
+                                      bool aShouldFixToViewport);
   ThebesLayerData* GetTopThebesLayerData()
   {
     return mThebesLayerDataStack.IsEmpty() ? nullptr
         : mThebesLayerDataStack[mThebesLayerDataStack.Length() - 1].get();
   }
 
   /* Build a mask layer to represent the clipping region. Will return null if
    * there is no clipping specified or a mask layer cannot be built.
@@ -1657,31 +1671,32 @@ ThebesLayerData::CanOptimizeImageLayer(n
     return nullptr;
   }
 
   return mImage->GetContainer(mLayer->Manager(), aBuilder);
 }
 
 const nsIFrame*
 ContainerState::FindFixedPosFrameForLayerData(const nsIFrame* aAnimatedGeometryRoot,
+                                              bool aDisplayItemFixedToViewport,
                                               const nsIntRegion& aDrawRegion,
                                               nsIntRegion* aVisibleRegion,
                                               bool* aIsSolidColorInVisibleRegion)
 {
   if (!mManager->IsWidgetLayerManager()) {
     // Never attach any fixed-pos metadata to inactive layers, it's pointless!
     return nullptr;
   }
 
   nsPresContext* presContext = mContainerFrame->PresContext();
   nsIFrame* viewport = presContext->PresShell()->GetRootFrame();
   const nsIFrame* result = nullptr;
   nsRect displayPort;
 
-  if (viewport == aAnimatedGeometryRoot &&
+  if (viewport == aAnimatedGeometryRoot && aDisplayItemFixedToViewport &&
       nsLayoutUtils::ViewportHasDisplayPort(presContext, &displayPort)) {
     // Probably a background-attachment:fixed item
     result = viewport;
   } else {
     // Viewports with no fixed-pos frames are not relevant.
     if (!viewport->GetFirstChild(nsIFrame::kFixedList)) {
       return nullptr;
     }
@@ -1786,16 +1801,17 @@ ContainerState::PopThebesLayerData()
 {
   NS_ASSERTION(!mThebesLayerDataStack.IsEmpty(), "Can't pop");
 
   int32_t lastIndex = mThebesLayerDataStack.Length() - 1;
   ThebesLayerData* data = mThebesLayerDataStack[lastIndex];
 
   const nsIFrame* fixedPosFrameForLayerData =
     FindFixedPosFrameForLayerData(data->mAnimatedGeometryRoot,
+                                  data->mSingleItemFixedToViewport,
                                   data->mDrawRegion,
                                   &data->mVisibleRegion,
                                   &data->mIsSolidColorInVisibleRegion);
   nsRefPtr<Layer> layer;
   nsRefPtr<ImageContainer> imageContainer = data->CanOptimizeImageLayer(mBuilder);
 
   if ((data->mIsSolidColorInVisibleRegion || imageContainer) &&
       (data->mLayer->GetValidRegion().IsEmpty() || mLayerBuilder->CheckInLayerTreeCompressionMode())) {
@@ -2066,17 +2082,17 @@ ThebesLayerData::Accumulate(ContainerSta
       mIsSolidColorInVisibleRegion = false;
     }
 
     mVisibleRegion.Or(mVisibleRegion, aVisibleRect);
     mVisibleRegion.SimplifyOutward(4);
     mDrawRegion.Or(mDrawRegion, aDrawRect);
     mDrawRegion.SimplifyOutward(4);
   }
-  
+
   bool snap;
   nsRegion opaque = aItem->GetOpaqueRegion(aState->mBuilder, &snap);
   if (!opaque.IsEmpty()) {
     nsRegion opaqueClipped;
     nsRegionRectIterator iter(opaque);
     for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
       opaqueClipped.Or(opaqueClipped, aClip.ApproximateIntersectInward(*r));
     }
@@ -2118,24 +2134,31 @@ ThebesLayerData::Accumulate(ContainerSta
     }
   }
 }
 
 ThebesLayerData*
 ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
                                    const nsIntRect& aVisibleRect,
                                    const nsIFrame* aActiveScrolledRoot,
-                                   const nsPoint& aTopLeft)
+                                   const nsPoint& aTopLeft,
+                                   bool aShouldFixToViewport)
 {
   int32_t i;
   int32_t lowestUsableLayerWithScrolledRoot = -1;
   int32_t topmostLayerWithScrolledRoot = -1;
   for (i = mThebesLayerDataStack.Length() - 1; i >= 0; --i) {
     ThebesLayerData* data = mThebesLayerDataStack[i];
-    if (data->IsBelow(aVisibleRect)) {
+    // ThebesLayers for items returning true from ShouldFixToViewport should
+    // not be added to (or have content moved below them),
+    // since they will receive special treatment for async scrolling.
+    // If the item is going to be fixed to the viewport, don't let it combine
+    // with any existing layer.
+    if (data->IsBelow(aVisibleRect) || data->mSingleItemFixedToViewport ||
+        aShouldFixToViewport) {
       ++i;
       break;
     }
     if (data->mAnimatedGeometryRoot == aActiveScrolledRoot) {
       lowestUsableLayerWithScrolledRoot = i;
       if (topmostLayerWithScrolledRoot < 0) {
         topmostLayerWithScrolledRoot = i;
       }
@@ -2165,16 +2188,17 @@ ContainerState::FindThebesLayerFor(nsDis
     nsRefPtr<ThebesLayer> layer =
       CreateOrRecycleThebesLayer(aActiveScrolledRoot, aItem->ReferenceFrame(), aTopLeft);
 
     thebesLayerData = new ThebesLayerData();
     mThebesLayerDataStack.AppendElement(thebesLayerData);
     thebesLayerData->mLayer = layer;
     thebesLayerData->mAnimatedGeometryRoot = aActiveScrolledRoot;
     thebesLayerData->mReferenceFrame = aItem->ReferenceFrame();
+    thebesLayerData->mSingleItemFixedToViewport = aShouldFixToViewport;
 
     NS_ASSERTION(!mNewChildLayers.Contains(layer), "Layer already in list???");
     *mNewChildLayers.AppendElement() = layer.forget();
   } else {
     thebesLayerData = mThebesLayerDataStack[lowestUsableLayerWithScrolledRoot];
   }
 
   return thebesLayerData;
@@ -2345,16 +2369,18 @@ ContainerState::ProcessDisplayItems(cons
     } else {
       forceInactive = false;
       animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder);
       if (animatedGeometryRoot != lastAnimatedGeometryRoot) {
         lastAnimatedGeometryRoot = animatedGeometryRoot;
         topLeft = animatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
       }
     }
+    bool shouldFixToViewport = !animatedGeometryRoot->GetParent() &&
+      item->ShouldFixToViewport(mBuilder);
 
     if (maxLayers != -1 && layerCount >= maxLayers) {
       forceInactive = true;
     }
 
     // Assign the item to a layer
     if (layerState == LAYER_ACTIVE_FORCE ||
         (layerState == LAYER_INACTIVE && !mManager->IsWidgetLayerManager()) ||
@@ -2398,18 +2424,19 @@ ContainerState::ProcessDisplayItems(cons
       if (!ownLayer) {
         continue;
       }
 
       NS_ASSERTION(!ownLayer->AsThebesLayer(),
                    "Should never have created a dedicated Thebes layer!");
 
       nsIntRegion visibleRegion(itemVisibleRect);
-      const nsIFrame* fixedPosFrame = FindFixedPosFrameForLayerData(animatedGeometryRoot,
-        nsIntRegion(itemDrawRect), &visibleRegion);
+      const nsIFrame* fixedPosFrame =
+        FindFixedPosFrameForLayerData(animatedGeometryRoot, shouldFixToViewport,
+                                      nsIntRegion(itemDrawRect), &visibleRegion);
       if (fixedPosFrame) {
         itemVisibleRect = visibleRegion.GetBounds();
       }
       SetFixedPositionLayerData(ownLayer, fixedPosFrame);
 
       nsRect invalid;
       if (item->IsInvalid(invalid)) {
         ownLayer->SetInvalidRectToVisibleRegion();
@@ -2482,17 +2509,18 @@ ContainerState::ProcessDisplayItems(cons
        */
       nsAutoPtr<nsDisplayItemGeometry> dummy;
       mLayerBuilder->AddLayerDisplayItem(ownLayer, item, 
                                          itemClip, layerState,
                                          topLeft, nullptr,
                                          dummy);
     } else {
       ThebesLayerData* data =
-        FindThebesLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft);
+        FindThebesLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
+                           shouldFixToViewport);
 
       if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
         nsDisplayLayerEventRegions* eventRegions =
             static_cast<nsDisplayLayerEventRegions*>(item);
         data->AccumulateEventRegions(ScaleRegionToOutsidePixels(eventRegions->HitRegion()),
                                      ScaleRegionToOutsidePixels(eventRegions->MaybeHitRegion()),
                                      ScaleRegionToOutsidePixels(eventRegions->DispatchToContentHitRegion()));
       } else {
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -985,18 +985,17 @@ public:
    * only differs by the translation.
    * It return true for all wrapped lists.
    */
   virtual bool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder,
                                                 nsIFrame* aFrame)
   { return false; }
   /**
    * @return true if the contents of this item are rendered fixed relative
-   * to the nearest viewport *and* they cover the viewport's scrollport.
-   * Only return true if the contents actually vary when scrolling in the viewport.
+   * to the nearest viewport.
    */
   virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder)
   { return false; }
 
   /**
    * Returns true if all layers that can be active should be forced to be
    * active. Requires setting the pref layers.force-active=true.
    */
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1389,16 +1389,17 @@ public:
   void NotifyFontSizeInflationEnabledIsDirty()
   {
     mFontSizeInflationEnabledIsDirty = true;
   }
 
   virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0;
 
   void InvalidatePresShellIfHidden();
+  void CancelInvalidatePresShellIfHidden();
 
   // Schedule an update of the list of visible images.
   virtual void ScheduleImageVisibilityUpdate() = 0;
 
   // Clears the current list of visible images on this presshell and replaces it
   // with images that are in the display list aList.
   virtual void RebuildImageVisibility(const nsDisplayList& aList) = 0;
 
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1574,16 +1574,19 @@ nsPresContext::GetDocShell() const
   return mContainer;
 }
 
 /* virtual */ void
 nsPresContext::Detach()
 {
   SetContainer(nullptr);
   SetLinkHandler(nullptr);
+  if (mShell) {
+    mShell->CancelInvalidatePresShellIfHidden();
+  }
 }
 
 bool
 nsPresContext::ThrottledTransitionStyleIsUpToDate() const
 {
   return
     mLastUpdateThrottledTransitionStyle == mRefreshDriver->MostRecentRefresh();
 }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -620,16 +620,25 @@ nsIPresShell::InvalidatePresShellIfHidde
 {
   if (!IsVisible() && mPresContext) {
     mPresContext->NotifyInvalidation(0);
   }
   mHiddenInvalidationObserverRefreshDriver = nullptr;
 }
 
 void
+nsIPresShell::CancelInvalidatePresShellIfHidden()
+{
+  if (mHiddenInvalidationObserverRefreshDriver) {
+    mHiddenInvalidationObserverRefreshDriver->RemovePresShellToInvalidateIfHidden(this);
+    mHiddenInvalidationObserverRefreshDriver = nullptr;
+  }
+}
+
+void
 nsIPresShell::SetVerifyReflowEnable(bool aEnabled)
 {
   gVerifyReflowEnabled = aEnabled;
 }
 
 /* virtual */ void
 nsIPresShell::AddWeakFrameExternal(nsWeakFrame* aWeakFrame)
 {
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4884,18 +4884,21 @@ nsIFrame::SchedulePaint(PaintType aType)
   nsIFrame *displayRoot = nsLayoutUtils::GetDisplayRootFrame(this);
   nsPresContext *pres = displayRoot->PresContext()->GetRootPresContext();
 
   // No need to schedule a paint for an external document since they aren't
   // painted directly.
   if (!pres || (pres->Document() && pres->Document()->IsResourceDoc())) {
     return;
   }
-  
-  MOZ_ASSERT(pres->GetContainerWeak(), "SchedulePaint in a detached pres context");
+  if (!pres->GetContainerWeak()) {
+    NS_WARNING("Shouldn't call SchedulePaint in a detached pres context");
+    return;
+  }
+
   pres->PresShell()->ScheduleViewManagerFlush(aType == PAINT_DELAYED_COMPRESS ?
                                               nsIPresShell::PAINT_DELAYED_COMPRESS :
                                               nsIPresShell::PAINT_DEFAULT);
 
   if (aType == PAINT_DELAYED_COMPRESS) {
     return;
   }
 
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-actuarial-ref.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose actuarial</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+          "M" + (box.left + "," + box.top) +
+          "L" + ((box.width+box.left) + "," + box.top) +
+          "L" + ((box.width+box.left) + "," + box.bottom ));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="actuarial">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-actuarial.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose actuarial</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+          "M" + (box.left + "," + box.top) +
+          "L" + ((box.width+box.left) + "," + box.top) +
+          "L" + ((box.width+box.left) + "," + box.bottom ));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="actuarial">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-bottom-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose bottom</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + (box.top + box.height)) + " " +
+        "l" + (box.width + "," + 0));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="bottom">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-bottom.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose bottom</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + (box.top + box.height)) + " " +
+        "l" + (box.width + "," + 0));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="bottom">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-box-ref.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose box</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        r = document.getElementById("rect");
+        r.setAttribute("x", box.left );
+        r.setAttribute("y", box.top );
+        r.setAttribute("width", box.width );
+        r.setAttribute("height", box.height );
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+
+  <body>
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="box">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+          <rect id="rect" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></rect>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-box.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose box</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        r = document.getElementById("rect");
+        r.setAttribute("x", box.left );
+        r.setAttribute("y", box.top );
+        r.setAttribute("width", box.width );
+        r.setAttribute("height", box.height );
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+
+  <body>
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+          <menclose id="box" notation="box">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+          <rect id="rect" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></rect>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-circle-ref.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose circle</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("circle").getBoundingClientRect();
+        e = document.getElementById("ellipse");
+        e.setAttribute("cx", (box.left + box.width/2));
+        e.setAttribute("rx", (box.width/2));
+        e.setAttribute("cy", (box.top + box.height/2));
+        e.setAttribute("ry", (box.height/2));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="circle" notation="circle">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+         <ellipse id="ellipse" style="fill: none; stroke-width: 8px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></ellipse>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-circle.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose circle</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("circle").getBoundingClientRect();
+        e = document.getElementById("ellipse");
+        e.setAttribute("cx", (box.left + box.width/2));
+        e.setAttribute("rx", (box.width/2));
+        e.setAttribute("cy", (box.top + box.height/2));
+        e.setAttribute("ry", (box.height/2));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="circle" notation="circle">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+         <ellipse id="ellipse" style="fill: none; stroke-width: 8px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></ellipse>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-downdiagonalstrike-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose downdiagonalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.top) + " " +
+        "l" + (box.width + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+       <mphantom>
+        <menclose id="box" notation="downdiagonalstrike">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+       </mphantom> 
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 6px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-downdiagonalstrike.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose downdiagonalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.top) + " " +
+        "l" + (box.width + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="downdiagonalstrike">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 6px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-horizontalstrike-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose horizontalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + (box.top + box.bottom)/2 ) + " " +
+        "l" + (box.width + "," + 0));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="horizontalstrike">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;" ></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-horizontalstrike.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose horizontalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + (box.top + box.bottom)/2 ) + " " +
+        "l" + (box.width + "," + 0));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="horizontalstrike">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-left-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose left</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.top) + " " +
+        "l" + (0 + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="left">
+           <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-left.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose left</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.top) + " " +
+        "l" + (0 + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="left">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-longdiv-ref.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose longdiv</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        var x =  " " + box.left + "," + box.top + " " ;
+        document.getElementById("path").setAttribute("d",
+          "M" + (box.left + "," + (box.top + box.height)) +
+          "Q" + ((box.left + 15) + "," + (box.top + box.height)/2) + x +
+          "L" + ((box.left + box.width) + "," + box.top));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>  
+          <menclose id="box" notation="longdiv">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 11px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-longdiv.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose longdiv</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        var x =  " " + box.left + "," + box.top + " " ;
+        document.getElementById("path").setAttribute("d",
+          "M" + (box.left + "," + (box.top + box.height)) +
+          "Q" + ((box.left + 15) + "," + (box.top + box.height)/2) + x +
+          "L" + ((box.left + box.width) + "," + box.top));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="longdiv">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 11px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-right-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose right</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + ((box.left + box.width) + "," + box.top) + " " +
+        "l" + (0 + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="right">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-right.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose right</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + ((box.left + box.width) + "," + box.top) + " " +
+        "l" + (0 + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="right">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-roundedbox-ref.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html class="reftest-wait">
+<head>
+	<meta charset="utf-8"/>
+	<title>menclose roundedbox</title>
+
+	<script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("roundedbox").getBoundingClientRect();
+        r = document.getElementById("box");
+        r.style.left = (box.left - 6) + "px";
+        r.style.top = (box.top - 6) + "px";
+        r.style.width = (box.width - 6) + "px";
+        r.style.height = (box.height - 6) + "px";
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+</head>
+<body>
+	<div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="roundedbox" notation="roundedbox">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom> 
+      </math>
+    </div>
+
+    <div id="box" style="position: absolute; border:10px solid #000; border-radius:10px 10px 10px 10px;" >
+    </div>
+    
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-roundedbox.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<html class="reftest-wait">
+<head>
+	<meta charset="utf-8"/>
+	<title>menclose roundedbox</title>
+
+	<script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("roundedbox").getBoundingClientRect();
+        r = document.getElementById("box");
+        r.style.left = (box.left - 6) + "px";
+        r.style.top = (box.top - 6) + "px";
+        r.style.width = (box.width - 6) + "px";
+        r.style.height = (box.height - 6) + "px";
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+</head>
+<body>
+	<div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+          <menclose id="roundedbox" notation="roundedbox">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+      </math>
+    </div>
+
+    <div id="box" style="position: absolute; border:10px solid #000; border-radius:10px 10px 10px 10px;" >
+    </div>
+    
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-top-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose top</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.top) + " " +
+        "l" + (box.width + "," + 0));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="top">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-top.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose top</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.top) + " " +
+        "l" + (box.width + "," + 0));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="top">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-updiagonalarrow-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose updiagonalarrow</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+          "M" + (box.left + "," + (box.height + box.top)) +
+          "L" + ((box.width + box.left) + "," + box.top));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="updiagonalarrow">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 11px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+  
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-updiagonalarrow.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose updiagonalarrow</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+          "M" + (box.left + "," + (box.height + box.top)) +
+          "L" + ((box.width + box.left) + "," + box.top));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="updiagonalarrow">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 11px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-updiagonalstrike-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+ <head>
+    <title>menclose updiagonalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.bottom) + " " +
+        "l" + (box.width + "," + (-box.height)));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+          <menclose id="box" notation="updiagonalstrike">
+            <mspace width="200px" height="100px"></mspace>
+          </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 5px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-updiagonalstrike.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+ <head>
+    <title>menclose updiagonalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + (box.left + "," + box.bottom) + " " +
+        "l" + (box.width + "," + (-box.height)));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="updiagonalstrike">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 5px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-verticalstrike-ref.html
@@ -0,0 +1,37 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose verticalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + ((box.right + box.left)/2 + "," + box.top) + " " +
+        "l" + (0 + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <mphantom>
+         <menclose id="box" notation="verticalstrike">
+           <mspace width="200px" height="100px"></mspace>
+         </menclose>
+        </mphantom>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-2-verticalstrike.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose verticalstrike</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box = document.getElementById("box").getBoundingClientRect();
+        document.getElementById("path").setAttribute("d",
+        "M" + ((box.right + box.left)/2 + "," + box.top) + " " +
+        "l" + (0 + "," + box.height));
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="box" notation="verticalstrike">
+          <mspace width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+
+    <div style="position: absolute; left: 0px; top: 0px;">
+      <svg width="500px" height="500px">
+        <path id="path" style="fill: none; stroke-width: 3px; stroke: green; stroke-linecap: round; shape-rendering: crispEdges;"></path>
+      </svg>
+    </div>
+    
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-box-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose box</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="left top right bottom">
+        <mspace width="100px" height="50px" mathbackground="blue"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-box.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose box</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="box">
+        <mspace width="100px" height="50px" mathbackground="blue"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-default-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose default</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose>
+        <mspace width="100px" height="50px"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-default.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose default</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="longdiv">
+        <mspace width="100px" height="50px"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-invalid-ref.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose invalid</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+        <mspace width="100px" height="50px" mathbackground="blue"></mspace>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-invalid.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose invalid</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="not_a_vaild_notation">
+        <mspace width="100px" height="50px" mathbackground="blue"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-madruwb-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Test menclose madruwb</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <!-- menclose: madruwb -->
+    <math>
+      <menclose notation="right bottom"><mi>x</mi></menclose>
+    </math>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-madruwb.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Test menclose madruwb</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <!-- menclose: madruwb -->
+    <math>
+      <menclose notation="madruwb"><mi>x</mi></menclose>
+    </math>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-multiple-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose multiple</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="top top left circle">
+        <mspace width="100px" height="50px"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-multiple.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose multiple</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="circle left top">
+        <mspace width="100px" height="50px"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-radical-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Test menclose radical</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <!-- menclose: radical -->
+    <math>
+      <menclose notation="radical" style="font-size:12px;"><mi>x</mi></menclose>
+    </math>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-radical.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Test menclose radical</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <!-- menclose: radical -->
+    <math>
+      <msqrt style="font-size:12px;"><mi>x</mi></msqrt>
+    </math>
+
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-unknown-ref.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose unknown</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="circle">
+        <mspace width="100px" height="50px" mathbackground="blue"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-3-unknown.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html>
+  <head>
+    <title>menclose unknown</title>
+    <meta charset="utf-8"/>
+  </head>
+
+  <body>
+    <math>
+      <menclose notation="circle unknown">
+        <mspace width="100px" height="50px" mathbackground="blue"></mspace>
+      </menclose>
+    </math>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-4.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html class="reftest-wait">
+  <head>
+    <title>menclose inner and outer circle</title>
+    <meta charset="utf-8"/>
+    <script type="text/javascript">
+      function doTest()
+      {
+        var box1 = document.getElementById("outer").getBoundingClientRect();
+        var box2 = document.getElementById("inner").getBoundingClientRect();
+        var epsilon = 0.1;
+        if ((box1.width >= ((Math.sqrt(2) - epsilon)*box2.width)) && (box1.height >= ((Math.sqrt(2) - epsilon)*box2.height))) {
+            document.body.innerHTML = "Pass";
+        }
+        document.documentElement.removeAttribute("class");
+      }
+      window.addEventListener("MozReftestInvalidate",doTest, false);
+    </script>
+  </head>
+  <body>
+    <div style="position: absolute; left: 20px; top: 20px;">
+      <math>
+        <menclose id="outer" notation="circle">
+          <mspace id="inner" width="200px" height="100px"></mspace>
+        </menclose>
+      </math>
+    </div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-actuarial-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose actuarial</title>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="actuarial"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-actuarial.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose actuarial</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').setAttribute("notation","actuarial");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-bottom-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose bottom</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="bottom"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-bottom.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose bottom</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","bottom");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-box-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose box</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="box"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-box.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose box</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","box");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-circle-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose circle</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="circle"><mspace width="100px" height="50px"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-circle.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose circle</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","circle");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-downdiagonalstrike-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose downdiagonalstrike</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="downdiagonalstrike"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-downdiagonalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose downdiagonalstrike</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","downdiagonalstrike");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-horizontalstrike-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose horizontalstrike</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="horizontalstrike"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-horizontalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose horizontalstrike</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","horizontalstrike");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-left-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose left</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="left"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-left.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose left</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","left");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-longdiv-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose longdiv</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="longdiv"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-longdiv.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose longdiv</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","longdiv");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-madruwb-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose madruwb</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="madruwb"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-madruwb.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose madruwb</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","madruwb");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-radical-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose radical</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="radical"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-radical.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose radical</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","radical");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-right-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose right</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="right"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-right.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose right</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","right");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-roundedbox-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose roundedbox</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="roundedbox"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-roundedbox.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose roundedbox</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","roundedbox");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-top-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose top</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="top"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-top.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose top</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","top");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-updiagonalarrow-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose updiagonalarrow</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="updiagonalarrow"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-updiagonalarrow.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose updiagonalarrow</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","updiagonalarrow");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-updiagonalstrike-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose updiagonalstrike</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="updiagonalstrike"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-updiagonalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose updiagonalstrike</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","updiagonalstrike");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-verticalstrike-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose verticalstrike</title>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose" notation="verticalstrike"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-5-verticalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose verticalstrike</title>
+	    <script type="text/javascript">
+	        function doTest() {
+	            document.getElementById('testMenclose').setAttribute("notation","verticalstrike");
+	            document.documentElement.removeAttribute("class");
+	        }
+	        window.addEventListener("MozReftestInvalidate",doTest, false);
+	    </script>
+	</head>
+	<body>
+	    <p>
+	       <math><menclose id="testMenclose"><mspace width="100px" height="50px"></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-actuarial.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose actuarial</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="actuarial"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-bottom.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose bottom</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="bottom"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-box.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose box</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="box"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-circle.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose circle</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="circle"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-downdiagonalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose downdiagonalstrike</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="downdiagonalstrike"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-horizontalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose horizontalstrike</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="horizontalstrike"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-left.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose left</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="left"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-longdiv.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose longdiv</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="longdiv"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-madruwb.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose madruwb</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="madruwb"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-radical.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose radical</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="radical"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+	<head>
+	    <title>menclose 6 reference</title>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-right.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose right</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="right"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-roundedbox.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose roundedbox</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="roundedbox"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-top.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose top</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="top"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-updiagonalarrow.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose updiagonalarrow</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="updiagonalarrow"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-updiagonalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose updiagonalstrike</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="updiagonalstrike"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/mathml/menclose-6-verticalstrike.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html class="reftest-wait">
+	<head>
+	    <title>menclose verticalstrike</title>
+	        <script type="text/javascript">
+	            function doTest() {
+	                document.getElementById('testMenclose').removeAttribute("notation");
+	                document.documentElement.removeAttribute("class");
+	            }
+	            window.addEventListener("MozReftestInvalidate",doTest, false);
+	        </script>
+	</head>
+	<body>
+	    <p>
+	    	<math><menclose id="testMenclose" notation="verticalstrike"><mspace width="100px" height="50px" mathbackground="blue"></mspace></menclose></math>
+        </p>
+	</body>
+</html>
--- a/layout/reftests/mathml/reftest.list
+++ b/layout/reftests/mathml/reftest.list
@@ -165,16 +165,71 @@ fails == whitespace-trim-4.html whitespa
 != menclose-1i.html menclose-1-ref.html
 != menclose-1j.html menclose-1-ref.html
 != menclose-1k.html menclose-1-ref.html
 != menclose-1l.html menclose-1-ref.html
 != menclose-1m.html menclose-1-ref.html
 != menclose-1n.html menclose-1-ref.html
 != menclose-1o.html menclose-1-ref.html
 != menclose-1p.html menclose-1-ref.html
+== menclose-2-actuarial.html menclose-2-actuarial-ref.html
+== menclose-2-bottom.html menclose-2-bottom-ref.html
+== menclose-2-box.html menclose-2-box-ref.html
+== menclose-2-circle.html menclose-2-circle-ref.html
+== menclose-2-downdiagonalstrike.html menclose-2-downdiagonalstrike-ref.html
+== menclose-2-horizontalstrike.html menclose-2-horizontalstrike-ref.html
+== menclose-2-left.html menclose-2-left-ref.html
+== menclose-2-longdiv.html menclose-2-longdiv-ref.html
+== menclose-2-right.html menclose-2-right-ref.html
+== menclose-2-roundedbox.html menclose-2-roundedbox-ref.html
+== menclose-2-top.html menclose-2-top-ref.html
+== menclose-2-updiagonalarrow.html menclose-2-updiagonalarrow-ref.html
+== menclose-2-updiagonalstrike.html menclose-2-updiagonalstrike-ref.html
+== menclose-2-verticalstrike.html menclose-2-verticalstrike-ref.html
+== menclose-2-roundedbox.html menclose-2-roundedbox-ref.html
+== menclose-3-box.html menclose-3-box-ref.html
+== menclose-3-madruwb.html menclose-3-madruwb-ref.html
+fails random-if(winWidget) == menclose-3-radical.html menclose-3-radical-ref.html # Bug 973917
+== menclose-3-default.html menclose-3-default-ref.html
+== menclose-3-invalid.html menclose-3-invalid-ref.html
+== menclose-3-multiple.html menclose-3-multiple-ref.html
+== menclose-3-unknown.html menclose-3-unknown.html
+== menclose-4.html data:text/html,<body>Pass
+== menclose-5-actuarial.html menclose-5-actuarial-ref.html
+== menclose-5-bottom.html menclose-5-bottom-ref.html
+== menclose-5-box.html menclose-5-box-ref.html
+fuzzy-if(OSX,1,100) == menclose-5-circle.html menclose-5-circle-ref.html
+== menclose-5-downdiagonalstrike.html menclose-5-downdiagonalstrike-ref.html
+== menclose-5-horizontalstrike.html menclose-5-horizontalstrike-ref.html
+== menclose-5-left.html menclose-5-left-ref.html
+== menclose-5-longdiv.html menclose-5-longdiv-ref.html
+== menclose-5-madruwb.html menclose-5-madruwb-ref.html
+== menclose-5-radical.html menclose-5-radical-ref.html
+== menclose-5-right.html menclose-5-right-ref.html
+== menclose-5-roundedbox.html menclose-5-roundedbox-ref.html
+== menclose-5-top.html menclose-5-top-ref.html
+== menclose-5-updiagonalarrow.html menclose-5-updiagonalarrow-ref.html
+== menclose-5-updiagonalstrike.html menclose-5-updiagonalstrike-ref.html
+== menclose-5-verticalstrike.html menclose-5-verticalstrike-ref.html
+== menclose-6-actuarial.html menclose-6-ref.html
+== menclose-6-bottom.html menclose-6-ref.html
+== menclose-6-box.html menclose-6-ref.html
+== menclose-6-circle.html menclose-6-ref.html
+== menclose-6-downdiagonalstrike.html menclose-6-ref.html
+== menclose-6-horizontalstrike.html menclose-6-ref.html
+== menclose-6-left.html menclose-6-ref.html
+== menclose-6-longdiv.html menclose-6-ref.html
+== menclose-6-madruwb.html menclose-6-ref.html
+== menclose-6-radical.html menclose-6-ref.html
+== menclose-6-right.html menclose-6-ref.html
+== menclose-6-roundedbox.html menclose-6-ref.html
+== menclose-6-top.html menclose-6-ref.html
+== menclose-6-updiagonalarrow.html menclose-6-ref.html
+== menclose-6-updiagonalstrike.html menclose-6-ref.html
+== menclose-6-verticalstrike.html menclose-6-ref.html
 == mmultiscript-align.html mmultiscript-align-ref.html
 == subscript-italic-correction.html subscript-italic-correction-ref.html
 == mathvariant-1a.html mathvariant-1a-ref.html
 == mathvariant-1b.html mathvariant-1b-ref.html
 == mathvariant-1c.html mathvariant-1c-ref.html
 == mathvariant-1d.html mathvariant-1d-ref.html
 == mathvariant-2.html mathvariant-2-ref.html
 == mathvariant-3.html mathvariant-3-ref.html
--- a/memory/mozalloc/VolatileBuffer.h
+++ b/memory/mozalloc/VolatileBuffer.h
@@ -41,16 +41,17 @@
  */
 
 namespace mozilla {
 
 class MOZALLOC_EXPORT VolatileBuffer : public RefCounted<VolatileBuffer>
 {
   friend class VolatileBufferPtr_base;
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(VolatileBuffer)
   VolatileBuffer();
   ~VolatileBuffer();
 
   /* aAlignment must be a multiple of the pointer size */
   bool Init(size_t aSize, size_t aAlignment = sizeof(void*));
 
   size_t HeapSizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
   size_t NonHeapSizeOfExcludingThis() const;
--- a/mfbt/tests/TestWeakPtr.cpp
+++ b/mfbt/tests/TestWeakPtr.cpp
@@ -6,16 +6,17 @@
 
 using mozilla::SupportsWeakPtr;
 using mozilla::WeakPtr;
 
 // To have a class C support weak pointers, inherit from SupportsWeakPtr<C>.
 class C : public SupportsWeakPtr<C>
 {
   public:
+    MOZ_DECLARE_REFCOUNTED_TYPENAME(C)
     int num;
     void act() {}
 };
 
 static void
 Example()
 {
 
@@ -38,16 +39,17 @@ Example()
   delete ptr;
 
   MOZ_ASSERT(!weak, "Deleting |ptr| clears weak pointers to it.");
   MOZ_ASSERT(!other, "Deleting |ptr| clears all weak pointers to it.");
 }
 
 struct A : public SupportsWeakPtr<A>
 {
+    MOZ_DECLARE_REFCOUNTED_TYPENAME(A)
     int data;
 };
 
 
 int
 main()
 {
 
--- a/mozglue/linker/ElfLoader.h
+++ b/mozglue/linker/ElfLoader.h
@@ -86,16 +86,17 @@ template <> inline RefCounted<LibHandle,
 
 /**
  * Abstract class for loaded libraries. Libraries may be loaded through the
  * system linker or this linker, both cases will be derived from this class.
  */
 class LibHandle: public mozilla::AtomicRefCounted<LibHandle>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(LibHandle)
   /**
    * Constructor. Takes the path of the loaded library and will store a copy
    * of the leaf name.
    */
   LibHandle(const char *path)
   : directRefCnt(0), path(path ? strdup(path) : nullptr), mappable(nullptr) { }
 
   /**
--- a/mozglue/linker/Mappable.h
+++ b/mozglue/linker/Mappable.h
@@ -17,16 +17,17 @@
  * Abstract class to handle mmap()ing from various kind of entities, such as
  * plain files or Zip entries. The virtual members are meant to act as the
  * equivalent system functions, except mapped memory is always MAP_PRIVATE,
  * even though a given implementation may use something different internally.
  */
 class Mappable: public mozilla::RefCounted<Mappable>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(Mappable)
   virtual ~Mappable() { }
 
   virtual MemoryRange mmap(const void *addr, size_t length, int prot, int flags,
                            off_t offset) = 0;
 
   enum Kind {
     MAPPABLE_FILE,
     MAPPABLE_EXTRACT_FILE,
--- a/mozglue/linker/Zip.h
+++ b/mozglue/linker/Zip.h
@@ -24,16 +24,17 @@ class ZipCollection;
  * performed, which means hand-crafted malicious Zip archives can make the
  * code fail in bad ways. However, since the only intended use is to load
  * libraries from Zip archives, there is no interest in making this code
  * safe, since the libraries could contain malicious code anyways.
  */
 class Zip: public mozilla::AtomicRefCounted<Zip>
 {
 public:
+  MOZ_DECLARE_REFCOUNTED_TYPENAME(Zip)
   /**
    * Create a Zip instance for the given file name. Returns nullptr in case
    * of failure.
    */
   static mozilla::TemporaryRef<Zip> Create(const char *filename);
 
   /**
    * Create a Zip instance using the given buffer.
--- a/testing/mozbase/mozrunner/mozrunner/base.py
+++ b/testing/mozbase/mozrunner/mozrunner/base.py
@@ -149,31 +149,36 @@ class Runner(object):
 
         return self.returncode
 
     def reset(self):
         """Reset the runner to its default state"""
         if getattr(self, 'profile', False):
             self.profile.reset()
 
-    def check_for_crashes(self, dump_directory=None, test_name=None):
+    def check_for_crashes(self, dump_directory=None, dump_save_path=None,
+                          test_name=None, quiet=False):
         """Check for a possible crash and output stack trace
 
         :param dump_directory: Directory to search for minidump files
+        :param dump_save_path: Directory to save the minidump files to
         :param test_name: Name to use in the crash output
+        :param quiet: If `True` don't print the PROCESS-CRASH message to stdout
 
         """
         if not dump_directory:
             dump_directory = os.path.join(self.profile.profile, 'minidumps')
 
         crashed = False
         try:
             crashed = mozcrash.check_for_crashes(dump_directory,
                                                  self.symbols_path,
-                                                 test_name=test_name)
+                                                 dump_save_path=dump_save_path,
+                                                 test_name=test_name,
+                                                 quiet=quiet)
         except:
             traceback.print_exc()
 
         return crashed
 
     def cleanup(self):
         """Cleanup all runner state"""
         self.stop()
--- a/testing/mozbase/mozversion/mozversion/mozversion.py
+++ b/testing/mozbase/mozversion/mozversion/mozversion.py
@@ -38,20 +38,21 @@ class Version(mozlog.LoggingMixin):
 
     def get_gecko_info(self, config_path):
         for filename, section in (('application', 'App'),
                                   ('platform', 'Build')):
             config = ConfigParser.RawConfigParser()
             config_file = os.path.join(config_path, '%s.ini' % filename)
             if os.path.exists(config_file):
                 config.read(config_file)
-                for key in ('BuildID', 'Name', 'Version', 'SourceRepository',
-                            'SourceStamp'):
-                    name_map = {'SourceRepository': 'repository',
-                                'SourceStamp': 'changeset'}
+                name_map = {'CodeName': 'code_name',
+                            'SourceRepository': 'repository',
+                            'SourceStamp': 'changeset'}
+                for key in ('BuildID', 'Name', 'CodeName', 'Version',
+                            'SourceRepository', 'SourceStamp'):
                     name = name_map.get(key, key).lower()
                     self._info['%s_%s' % (filename, name)] = config.has_option(
                         section, key) and config.get(section, key) or None
             else:
                 self.warn('Unable to find %s' % config_file)
 
 
 class LocalVersion(Version):
--- a/testing/mozbase/mozversion/setup.py
+++ b/testing/mozbase/mozversion/setup.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from setuptools import setup
 
-PACKAGE_VERSION = '0.1'
+PACKAGE_VERSION = '0.2'
 
 dependencies = ['mozdevice >= 0.29',
                 'mozfile >= 1.0',
                 'mozlog >= 1.5']
 
 setup(name='mozversion',
       version=PACKAGE_VERSION,
       description='Library to get version information for applications',
--- a/testing/mozbase/mozversion/tests/test_binary.py
+++ b/testing/mozbase/mozversion/tests/test_binary.py
@@ -12,16 +12,17 @@ import mozfile
 from mozversion import get_version
 
 
 class BinaryTest(unittest.TestCase):
     """test getting application version information from a binary path"""
 
     application_ini = """[App]
 Name = AppName
+CodeName = AppCodeName
 Version = AppVersion
 BuildID = AppBuildID
 SourceRepository = AppSourceRepo
 SourceStamp = AppSourceStamp
 """
     platform_ini = """[Build]
 BuildID = PlatformBuildID
 SourceStamp = PlatformSourceStamp
@@ -63,16 +64,17 @@ SourceRepository = PlatformSourceRepo
                           os.path.join(self.tempdir, 'invalid'))
 
     def test_missing_ini_files(self):
         v = get_version(self.binary)
         self.assertEqual(v, {})
 
     def _check_version(self, version):
         self.assertEqual(version.get('application_name'), 'AppName')
+        self.assertEqual(version.get('application_code_name'), 'AppCodeName')
         self.assertEqual(version.get('application_version'), 'AppVersion')
         self.assertEqual(version.get('application_buildid'), 'AppBuildID')
         self.assertEqual(
             version.get('application_repository'), 'AppSourceRepo')
         self.assertEqual(
             version.get('application_changeset'), 'AppSourceStamp')
         self.assertIsNone(version.get('platform_name'))
         self.assertIsNone(version.get('platform_version'))
--- a/toolkit/locales/en-US/chrome/mozapps/profile/profileSelection.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/profile/profileSelection.dtd
@@ -22,10 +22,10 @@
 <!ENTITY            deleteButton.accesskey "D">
 
 <!-- manager entities -->
 <!ENTITY            pmDescription.label    "&brandShortName; stores information about your settings, preferences, and other user items in your user profile.">
 
 <!ENTITY            offlineState.label    "Work offline">
 <!ENTITY            offlineState.accesskey "o">
 
-<!ENTITY            autoSelect.label       "Don't ask at startup">
-<!ENTITY            autoSelect.accesskey   "s">
+<!ENTITY            useSelected.label       "Use the selected profile without asking at startup">
+<!ENTITY            useSelected.accesskey   "s">
--- a/toolkit/mozapps/extensions/PluginProvider.jsm
+++ b/toolkit/mozapps/extensions/PluginProvider.jsm
@@ -415,20 +415,18 @@ function PluginWrapper(aId, aName, aDesc
         types.push(type);
       }
     }
     return types;
   });
 
   this.__defineGetter__("installDate", function() {
     let date = 0;
-    let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
     for (let tag of aTags) {
-      file.initWithPath(tag.fullpath);
-      date = Math.max(date, file.lastModifiedTime);
+      date = Math.max(date, tag.lastModifiedTime);
     }
     return new Date(date);
   });
 
   this.__defineGetter__("scope", function() {
     let path = aTags[0].fullpath;
     // Plugins inside the application directory are in the application scope
     let dir = Services.dirsvc.get("APlugns", Ci.nsIFile);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
@@ -69,16 +69,31 @@ function getFileSize(aFile) {
   let entries = aFile.directoryEntries.QueryInterface(AM_Ci.nsIDirectoryEnumerator);
   let entry;
   while (entry = entries.nextFile)
     size += getFileSize(entry);
   entries.close();
   return size;
 }
 
+function getPluginLastModifiedTime(aPluginFile) {
+  // On OS X we use the bundle contents last modified time as using
+  // the package directories modified date may be outdated.
+  // See bug 313700.
+  try {
+    let localFileMac = aPluginFile.QueryInterface(AM_Ci.nsILocalFileMac);
+    if (localFileMac) {
+      return localFileMac.bundleContentsLastModifiedTime;
+    }
+  } catch (e) {
+  }
+
+  return aPluginFile.lastModifiedTime;
+}
+
 // Tests that the test plugin exists
 function run_test_1() {
   var testPlugin = get_test_plugin();
   do_check_neq(testPlugin, null);
 
   AddonManager.getAddonsByTypes(["plugin"], function(addons) {
     do_check_true(addons.length > 0);
 
@@ -106,21 +121,23 @@ function run_test_1() {
       do_check_true(p.isCompatible);
       do_check_true(p.providesUpdatesSecurely);
       do_check_eq(p.blocklistState, 0);
       do_check_eq(p.permissions, AddonManager.PERM_CAN_DISABLE | AddonManager.PERM_CAN_ENABLE);
       do_check_eq(p.pendingOperations, 0);
       do_check_true(p.size > 0);
       do_check_eq(p.size, getFileSize(testPlugin));
       do_check_true(p.updateDate > 0);
-      do_check_eq(p.updateDate.getTime(), testPlugin.lastModifiedTime);
-      do_check_eq(p.installDate.getTime(), testPlugin.lastModifiedTime);
       do_check_true("isCompatibleWith" in p);
       do_check_true("findUpdates" in p);
 
+      let lastModifiedTime = getPluginLastModifiedTime(testPlugin);
+      do_check_eq(p.updateDate.getTime(), lastModifiedTime);
+      do_check_eq(p.installDate.getTime(), lastModifiedTime);
+
       run_test_2(p);
     });
   });
 }
 
 // Tests that disabling a plugin works
 function run_test_2(p) {
   let test = {};
--- a/toolkit/profile/content/profileSelection.xul
+++ b/toolkit/profile/content/profileSelection.xul
@@ -57,14 +57,14 @@
       <listbox id="profiles" rows="5" seltype="single"
                ondblclick="onProfilesDblClick(event)"
                onkeypress="onProfilesKey(event);">
       </listbox>
 
       <!-- Bug 257777 -->
       <checkbox id="offlineState" label="&offlineState.label;" accesskey="&offlineState.accesskey;"/> 
 
-      <checkbox id="autoSelectLastProfile" label="&autoSelect.label;"
-                accesskey="&autoSelect.accesskey;"/> 
+      <checkbox id="autoSelectLastProfile" label="&useSelected.label;"
+                accesskey="&useSelected.accesskey;"/> 
     </vbox>
 
   </hbox>
 </dialog>
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -23,17 +23,17 @@
 #include "HwcComposer2D.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/PLayerTransaction.h"
 #include "mozilla/layers/ShadowLayerUtilsGralloc.h"
 #include "mozilla/StaticPtr.h"
 #include "cutils/properties.h"
 #include "gfx2DGlue.h"
 
-#if ANDROID_VERSION >= 18
+#if ANDROID_VERSION >= 17
 #include "libdisplay/FramebufferSurface.h"
 #ifndef HWC_BLIT
 #define HWC_BLIT (HWC_FRAMEBUFFER_TARGET + 1)
 #endif
 #endif
 
 #define LOG_TAG "HWComposer"
 
@@ -87,17 +87,17 @@ HwcComposer2D::Init(hwc_display_t dpy, h
         return -1;
     }
 
     nsIntSize screenSize;
 
     mozilla::Framebuffer::GetSize(&screenSize);
     mScreenRect  = nsIntRect(nsIntPoint(0, 0), screenSize);
 
-#if ANDROID_VERSION >= 18
+#if ANDROID_VERSION >= 17
     int supported = 0;
     if (mHwc->query(mHwc, HwcUtils::HWC_COLOR_FILL, &supported) == NO_ERROR) {
         mColorFill = supported ? true : false;
     }
     if (mHwc->query(mHwc, HwcUtils::HWC_FORMAT_RB_SWAP, &supported) == NO_ERROR) {
         mRBSwapSupport = supported ? true : false;
     }
 #else
@@ -298,22 +298,24 @@ HwcComposer2D::PrepareLayerList(Layer* a
     hwcLayer.handle = handle;
 
     hwcLayer.flags = 0;
     hwcLayer.hints = 0;
     hwcLayer.blending = HWC_BLENDING_PREMULT;
     if ((opacity == 0xFF) && (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE)) {
         hwcLayer.blending = HWC_BLENDING_NONE;
     }
-#if ANDROID_VERSION >= 18
+#if ANDROID_VERSION >= 17
     hwcLayer.compositionType = HWC_FRAMEBUFFER;
 
     hwcLayer.acquireFenceFd = -1;
     hwcLayer.releaseFenceFd = -1;
+#if ANDROID_VERSION >= 18
     hwcLayer.planeAlpha = opacity;
+#endif
 #else
     hwcLayer.compositionType = HwcUtils::HWC_USE_COPYBIT;
 #endif
 
     if (!fillColor) {
         if (state.FormatRBSwapped()) {
             if (!mRBSwapSupport) {
                 LOGD("No R/B swap support in H/W Composer");
@@ -467,17 +469,17 @@ HwcComposer2D::PrepareLayerList(Layer* a
     }
 
     mHwcLayerMap.AppendElement(static_cast<LayerComposite*>(aLayer->ImplData()));
     mList->numHwLayers++;
     return true;
 }
 
 
-#if ANDROID_VERSION >= 18
+#if ANDROID_VERSION >= 17
 bool
 HwcComposer2D::TryHwComposition()
 {
     FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());
 
     if (!(fbsurface && fbsurface->lastHandle)) {
         LOGD("H/W Composition failed. FBSurface not initialized.");
         return false;
@@ -623,18 +625,19 @@ HwcComposer2D::Prepare(buffer_handle_t f
     mList->hwLayers[idx].blending = HWC_BLENDING_PREMULT;
     mList->hwLayers[idx].compositionType = HWC_FRAMEBUFFER_TARGET;
     setCrop(&mList->hwLayers[idx], r);
     mList->hwLayers[idx].displayFrame = r;
     mList->hwLayers[idx].visibleRegionScreen.numRects = 1;
     mList->hwLayers[idx].visibleRegionScreen.rects = &mList->hwLayers[idx].displayFrame;
     mList->hwLayers[idx].acquireFenceFd = fence;
     mList->hwLayers[idx].releaseFenceFd = -1;
+#if ANDROID_VERSION >= 18
     mList->hwLayers[idx].planeAlpha = 0xFF;
-
+#endif
     if (mPrepared) {
         LOGE("Multiple hwc prepare calls!");
     }
     mHwc->prepare(mHwc, HWC_NUM_DISPLAY_TYPES, displays);
     mPrepared = true;
 }
 
 bool
--- a/widget/gonk/HwcComposer2D.h
+++ b/widget/gonk/HwcComposer2D.h
@@ -29,17 +29,17 @@ namespace mozilla {
 namespace layers {
 class ContainerLayer;
 class Layer;
 }
 
 //Holds a dynamically allocated vector of rectangles
 //used to decribe the complex visible region of a layer
 typedef std::vector<hwc_rect_t> RectVector;
-#if ANDROID_VERSION >= 18
+#if ANDROID_VERSION >= 17
 typedef hwc_composer_device_1_t HwcDevice;
 typedef hwc_display_contents_1_t HwcList;
 typedef hwc_layer_1_t HwcLayer;
 #else
 typedef hwc_composer_device_t HwcDevice;
 typedef hwc_layer_list_t HwcList;
 typedef hwc_layer_t HwcLayer;
 #endif
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -866,16 +866,17 @@ static GtkSelectionData* CopyRetrievedDa
 {
     // A negative length indicates that retrieving the data failed.
     return gtk_selection_data_get_length(aData) >= 0 ?
         gtk_selection_data_copy(aData) : nullptr;
 }
 
 class RetrievalContext : public RefCounted<RetrievalContext> {
 public:
+    MOZ_DECLARE_REFCOUNTED_TYPENAME(RetrievalContext)
     enum State { INITIAL, COMPLETED, TIMED_OUT };
 
     RetrievalContext() : mState(INITIAL), mData(nullptr) {}
     ~RetrievalContext()
     {
         MOZ_ASSERT(!mData, "Wait() wasn't called");
     }