merge b2g-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 28 Nov 2014 13:44:29 +0100
changeset 217994 ca89fe55717059e4e43040d16d260765ffa9dca7
parent 217973 df75d4e6a5ae06a05599577661e1366ef217b482 (current diff)
parent 217993 cf8ab72e5750b4e1712039737c1ae028fef6850a (diff)
child 217995 f3600a81b069b1e0647331eebd05b79bf21e1a29
child 218011 70db9bbd296884d0283bc097effc859f38dc939e
child 218032 79b7c10e2c1c3ffa0c5095d25ebdd28fbb2198e0
child 218066 c77bd6051d3b64f2677e507b05475f4a62ed3c2b
push id52417
push usercbook@mozilla.com
push dateFri, 28 Nov 2014 13:24:05 +0000
treeherdermozilla-inbound@f3600a81b069 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge b2g-inbound to mozilla-central a=merge
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was git://codeaurora.org/-->
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
@@ -111,18 +111,20 @@
   <project name="platform/libcore" path="libcore" revision="e195beab082c09217318fc19250caeaf4c1bd800"/>
   <project name="platform/libnativehelper" path="libnativehelper" revision="feeb36c2bd4adfe285f98f5de92e0f3771b2c115"/>
   <project name="platform/ndk" path="ndk" revision="e58ef003be4306bb53a8c11331146f39e4eab31f"/>
   <project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
   <project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="c24c8871173bf6aedcf236cab075edf092a7015c"/>
   <project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="cfcef469537869947abb9aa1d656774cc2678d4c"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
+  <project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="449d3b2b2a0c87be2133deb72f2a8e939e33305d"/>
   <project name="platform/system/extras" path="system/extras" revision="10e78a05252b3de785f88c2d0b9ea8a428009c50"/>
   <project name="platform/system/media" path="system/media" revision="7ff72c2ea2496fa50b5e8a915e56e901c3ccd240"/>
+  <project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
   <project name="platform/system/netd" path="system/netd" revision="3ae56364946d4a5bf5a5f83f12f9a45a30398e33"/>
   <project name="platform/system/security" path="system/security" revision="ee8068b9e7bfb2770635062fc9c2035be2142bd8"/>
   <project name="platform/system/vold" path="system/vold" revision="2e43efe1b30d0b98574d293059556aebd2f46454"/>
   <!--original fetch url was http://sprdsource.spreadtrum.com:8085/b2g/android-->
   <remote fetch="https://git.mozilla.org/external/sprd-aosp" name="sprd-aosp"/>
   <default remote="sprd-aosp" revision="sprdb2g_gonk4.4" sync-j="4"/>
   <!-- Stock Android things -->
   <project name="platform/external/icu4c" path="external/icu4c" revision="2bb01561780583cc37bc667f0ea79f48a122d8a2"/>
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <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="df362ace56338da8173d30d3e09e08c42c1accfa">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="8b13bfc1d7d25cee4de55f332654fdba25b8460b"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="0e94c080bee081a50aa2097527b0b40852f9143f">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- 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"/>
@@ -113,18 +113,20 @@
   <project name="platform/libnativehelper" path="libnativehelper" revision="4792069e90385889b0638e97ae62c67cdf274e22"/>
   <project name="platform/ndk" path="ndk" revision="7666b97bbaf1d645cdd6b4430a367b7a2bb53369"/>
   <project name="platform/prebuilts/misc" path="prebuilts/misc" revision="f6ab40b3257abc07741188fd173ac392575cc8d2"/>
   <project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="e52099755d0bd3a579130eefe8e58066cc6c0cb6"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="02c32feb2fe97037be0ac4dace3a6a5025ac895d"/>
   <project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="842e33e43a55ea44833b9e23e4d180fa17c843af"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5db24726f0f42124304195a6bdea129039eeeaeb"/>
   <project name="platform/system/bluetooth" path="system/bluetooth" revision="930ae098543881f47eac054677726ee4b998b2f8"/>
+  <project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="449d3b2b2a0c87be2133deb72f2a8e939e33305d"/>
   <project name="platform_system_core" path="system/core" remote="b2g" revision="542d1f59dc331b472307e5bd043101d14d5a3a3e"/>
   <project name="platform/system/extras" path="system/extras" revision="18c1180e848e7ab8691940481f5c1c8d22c37b3e"/>
+  <project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
   <project name="platform/system/media" path="system/media" revision="d90b836f66bf1d9627886c96f3a2d9c3007fbb80"/>
   <project name="platform/system/netd" path="system/netd" revision="56112dd7b811301b718d0643a82fd5cac9522073"/>
   <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"/>
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was git://codeaurora.org/-->
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
@@ -111,18 +111,20 @@
   <project name="platform/libcore" path="libcore" revision="9877ade9617bb0db6e59aa2a54719a9bc92600f3"/>
   <project name="platform/libnativehelper" path="libnativehelper" revision="46c96ace65eb1ccab05bf15b9bf8e53e443039af"/>
   <project name="platform/ndk" path="ndk" revision="cb5519af32ae7b4a9c334913a612462ecd04c5d0"/>
   <project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
   <project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="6aa61f8557a22039a30b42b7f283996381fd625d"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="c24c8871173bf6aedcf236cab075edf092a7015c"/>
   <project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="b562b01c93de9578d5db537b6a602a38e1aaa0ce"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="387f03e815f57d536dd922706db1622bddba8d81"/>
+  <project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="449d3b2b2a0c87be2133deb72f2a8e939e33305d"/>
   <project name="platform/system/extras" path="system/extras" revision="5356165f67f4a81c2ef28671c13697f1657590df"/>
   <project name="platform/system/media" path="system/media" revision="be0e2fe59a8043fa5200f75697df9220a99abe9d"/>
+  <project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
   <project name="platform/system/netd" path="system/netd" revision="36704b0da24debcab8090156568ac236315036bb"/>
   <project name="platform/system/security" path="system/security" revision="583374f69f531ba68fc3dcbff1f74893d2a96406"/>
   <project name="platform/system/vold" path="system/vold" revision="d4455b8cf361f8353e8aebac15ffd64b4aedd2b9"/>
   <project name="platform/external/icu4c" path="external/icu4c" remote="aosp" revision="b4c6379528887dc25ca9991a535a8d92a61ad6b6"/>
   <project name="platform_frameworks_av" path="frameworks/av" remote="b2g" revision="614747e5e6755ffcdb36156ea82d8b5c1609a3af"/>
   <project name="platform_system_core" path="system/core" remote="b2g" revision="9395eb5aa885cf6d305a202de6e9694a58a89717"/>
   <default remote="caf" revision="refs/tags/android-4.4.2_r1" sync-j="4"/>
   <!-- Emulator specific things -->
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <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="df362ace56338da8173d30d3e09e08c42c1accfa">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="8b13bfc1d7d25cee4de55f332654fdba25b8460b"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was git://codeaurora.org/-->
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
@@ -111,18 +111,20 @@
   <project name="platform/libcore" path="libcore" revision="baf7d8068dd501cfa338d3a8b1b87216d6ce0571"/>
   <project name="platform/libnativehelper" path="libnativehelper" revision="50c4430e32849530ced32680fd6ee98963b3f7ac"/>
   <project name="platform/ndk" path="ndk" revision="e58ef003be4306bb53a8c11331146f39e4eab31f"/>
   <project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
   <project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="c24c8871173bf6aedcf236cab075edf092a7015c"/>
   <project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="69d524e80cdf3981006627c65ac85f3a871238a3"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
+  <project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="449d3b2b2a0c87be2133deb72f2a8e939e33305d"/>
   <project name="platform/system/extras" path="system/extras" revision="576f57b6510de59c08568b53c0fb60588be8689e"/>
   <project name="platform/system/media" path="system/media" revision="20c2fb4c896aa59f2e8379d755f439dc59a5cf9b"/>
+  <project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
   <project name="platform/system/netd" path="system/netd" revision="a6531f7befb49b1c81bc0de7e51c5482b308e1c5"/>
   <project name="platform/system/security" path="system/security" revision="ee8068b9e7bfb2770635062fc9c2035be2142bd8"/>
   <project name="platform/system/vold" path="system/vold" revision="42fa2a0f14f965970a4b629a176bbd2666edf017"/>
   <project name="platform/external/icu4c" path="external/icu4c" revision="d3ec7428eb276db43b7ed0544e09344a6014806c"/>
   <remove-project name="platform/frameworks/base"/>
   <remove-project name="platform/frameworks/native"/>
   <remove-project name="platform/hardware/libhardware"/>
   <remove-project name="platform/external/bluetooth/bluedroid"/>
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="0e94c080bee081a50aa2097527b0b40852f9143f">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="e95b4ce22c825da44d14299e1190ea39a5260bde"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="471afab478649078ad7c75ec6b252481a59e19b8"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
         "git_revision": "", 
         "remote": "", 
         "branch": ""
     }, 
-    "revision": "415520315b048f40979e9bac344bec99e18df901", 
+    "revision": "eb65c4355e0a16dc5cd203c5c007fd7e3bf0e4b2", 
     "repo_path": "integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <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="df362ace56338da8173d30d3e09e08c42c1accfa">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <!-- 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
@@ -10,17 +10,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <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="df362ace56338da8173d30d3e09e08c42c1accfa">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <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/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="0e94c080bee081a50aa2097527b0b40852f9143f">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- 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"/>
@@ -113,18 +113,20 @@
   <project name="platform/libnativehelper" path="libnativehelper" revision="4792069e90385889b0638e97ae62c67cdf274e22"/>
   <project name="platform/ndk" path="ndk" revision="7666b97bbaf1d645cdd6b4430a367b7a2bb53369"/>
   <project name="platform/prebuilts/misc" path="prebuilts/misc" revision="f6ab40b3257abc07741188fd173ac392575cc8d2"/>
   <project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="e52099755d0bd3a579130eefe8e58066cc6c0cb6"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="02c32feb2fe97037be0ac4dace3a6a5025ac895d"/>
   <project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="842e33e43a55ea44833b9e23e4d180fa17c843af"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5db24726f0f42124304195a6bdea129039eeeaeb"/>
   <project name="platform/system/bluetooth" path="system/bluetooth" revision="930ae098543881f47eac054677726ee4b998b2f8"/>
+  <project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="449d3b2b2a0c87be2133deb72f2a8e939e33305d"/>
   <project name="platform_system_core" path="system/core" remote="b2g" revision="542d1f59dc331b472307e5bd043101d14d5a3a3e"/>
   <project name="platform/system/extras" path="system/extras" revision="18c1180e848e7ab8691940481f5c1c8d22c37b3e"/>
+  <project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="fe95bc6f83af5c18a73aa86c96e7fa7f79b91477"/>
   <project name="platform/system/media" path="system/media" revision="d90b836f66bf1d9627886c96f3a2d9c3007fbb80"/>
   <project name="platform/system/netd" path="system/netd" revision="56112dd7b811301b718d0643a82fd5cac9522073"/>
   <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"/>
   <!-- Nexus 4 specific things -->
   <project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
   <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <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="df362ace56338da8173d30d3e09e08c42c1accfa">
     <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="1fff49c664f905f11a86426a9835e6df6b58e825"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="7cc460af0f6f491d1afa6b6043cdea5025f0e15f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="6499615ecece69e726657dc5caaeefa05fbb66bf"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -24,16 +24,17 @@
 #include "nsIWebNavigation.h"
 #include "nsIContentViewerEdit.h"
 #include "nsIContentViewer.h"
 #include "nsFocusManager.h"
 #include "nsCopySupport.h"
 #include "nsIClipboard.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BasicEvents.h"
+#include "mozilla/dom/Selection.h"
 
 #include "nsIClipboardDragDropHooks.h"
 #include "nsIClipboardDragDropHookList.h"
 
 using namespace mozilla;
 
 const char * const sSelectAllString = "cmd_selectAll";
 const char * const sSelectNoneString = "cmd_selectNone";
@@ -477,43 +478,53 @@ public:
 NS_IMPL_ISUPPORTS(nsClipboardCommand, nsIControllerCommand)
 
 nsresult
 nsClipboardCommand::IsCommandEnabled(const char* aCommandName, nsISupports *aContext, bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   *outCmdEnabled = false;
 
-  if (strcmp(aCommandName, "cmd_copy"))
+  if (strcmp(aCommandName, "cmd_copy") &&
+      strcmp(aCommandName, "cmd_copyAndCollapseToEnd"))
     return NS_OK;
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
   *outCmdEnabled = nsCopySupport::CanCopy(doc);
   return NS_OK;
 }
 
 nsresult
 nsClipboardCommand::DoCommand(const char *aCommandName, nsISupports *aContext)
 {
-  if (strcmp(aCommandName, "cmd_copy"))
+  if (strcmp(aCommandName, "cmd_copy") &&
+      strcmp(aCommandName, "cmd_copyAndCollapseToEnd"))
     return NS_OK;
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   nsIDocShell *docShell = window->GetDocShell();
   NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
   NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
   nsCopySupport::FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard, presShell, nullptr);
+
+  if (!strcmp(aCommandName, "cmd_copyAndCollapseToEnd")) {
+    dom::Selection *sel =
+      presShell->GetCurrentSelection(nsISelectionController::SELECTION_NORMAL);
+    NS_ENSURE_TRUE(sel, NS_ERROR_FAILURE);
+    sel->CollapseToEnd();
+  }
+
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboardCommand::GetCommandStateParams(const char *aCommandName,
                                               nsICommandParams *aParams, nsISupports *aCommandContext)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
@@ -1040,16 +1051,17 @@ nsWindowCommandRegistration::RegisterWin
   NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectDownString);
   NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectLeft2String);
   NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectRight2String);
   NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectUp2String);
   NS_REGISTER_LAST_COMMAND(nsPhysicalSelectCommand, sSelectDown2String);
 
   NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_cut");
   NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_copy");
+  NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_copyAndCollapseToEnd");
   NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_paste");
   NS_REGISTER_ONE_COMMAND(nsClipboardCopyLinkCommand, "cmd_copyLink");
   NS_REGISTER_FIRST_COMMAND(nsClipboardImageCommands, sCopyImageLocationString);
   NS_REGISTER_NEXT_COMMAND(nsClipboardImageCommands, sCopyImageContentsString);
   NS_REGISTER_LAST_COMMAND(nsClipboardImageCommands, sCopyImageString);
   NS_REGISTER_FIRST_COMMAND(nsClipboardSelectAllNoneCommands, sSelectAllString);
   NS_REGISTER_LAST_COMMAND(nsClipboardSelectAllNoneCommands, sSelectNoneString);
 
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -54,17 +54,17 @@ const OBSERVED_EVENTS = [
   'ask-parent-to-exit-fullscreen',
   'ask-parent-to-rollback-fullscreen',
   'xpcom-shutdown',
   'activity-done'
 ];
 
 const COMMAND_MAP = {
   'cut': 'cmd_cut',
-  'copy': 'cmd_copy',
+  'copy': 'cmd_copyAndCollapseToEnd',
   'paste': 'cmd_paste',
   'selectall': 'cmd_selectAll'
 };
 
 /**
  * The BrowserElementChild implements one half of <iframe mozbrowser>.
  * (The other half is, unsurprisingly, BrowserElementParent.)
  *
--- a/dom/browser-element/mochitest/browserElement_CopyPaste.js
+++ b/dom/browser-element/mochitest/browserElement_CopyPaste.js
@@ -185,16 +185,17 @@ function testCopy1(e) {
   SimpleTest.waitForClipboard(compareData, setup, success, fail);
 }
 
 function testPaste1(e) {
   // Next test paste command, first we copy to global clipboard in parent side.
   // Then paste it to child side.
   copyToClipboard(pasteData);
 
+  doCommand('selectall');
   doCommand("paste");
   SimpleTest.executeSoon(function() { testPaste2(e); });
 }
 
 function testPaste2(e) {
   mm.addMessageListener('content-text', function messageforpaste(msg) {
     mm.removeMessageListener('content-text', messageforpaste);
     if (state == 4) {
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -1931,17 +1931,19 @@ RadioInterface.prototype = {
         break;
       case "emergencyCbModeChange":
         gMobileConnectionService.notifyEmergencyCallbackModeChanged(this.clientId,
                                                                     message);
         break;
       case "networkinfochanged":
         gMobileConnectionService.notifyNetworkInfoChanged(this.clientId,
                                                           message);
-        connHandler.updateRILNetworkInterface();
+        if (message[RIL.NETWORK_INFO_DATA_REGISTRATION_STATE]) {
+          connHandler.updateRILNetworkInterface();
+        }
         break;
       case "networkselectionmodechange":
         gMobileConnectionService.notifyNetworkSelectModeChanged(this.clientId,
                                                                 message.mode);
         break;
       case "voiceregistrationstatechange":
         gMobileConnectionService.notifyVoiceInfoChanged(this.clientId, message);
         break;
--- a/editor/libeditor/nsEditorCommands.cpp
+++ b/editor/libeditor/nsEditorCommands.cpp
@@ -1,14 +1,13 @@
 /* -*- 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 "mozFlushType.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Assertions.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsDebug.h"
 #include "nsEditorCommands.h"
 #include "nsError.h"
@@ -23,462 +22,495 @@
 #include "nsISelection.h"
 #include "nsISelectionController.h"
 #include "nsITransferable.h"
 #include "nsString.h"
 #include "nsAString.h"
 
 class nsISupports;
 
-
-#define STATE_ENABLED  "state_enabled"
+#define STATE_ENABLED "state_enabled"
 #define STATE_DATA "state_data"
 
-
-nsBaseEditorCommand::nsBaseEditorCommand()
-{
-}
+nsBaseEditorCommand::nsBaseEditorCommand() {}
 
 NS_IMPL_ISUPPORTS(nsBaseEditorCommand, nsIControllerCommand)
 
-
 NS_IMETHODIMP
-nsUndoCommand::IsCommandEnabled(const char * aCommandName, 
-                                nsISupports *aCommandRefCon, 
+nsUndoCommand::IsCommandEnabled(const char *aCommandName,
+                                nsISupports *aCommandRefCon,
                                 bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     bool isEnabled, isEditable = false;
     nsresult rv = editor->GetIsSelectionEditable(&isEditable);
     NS_ENSURE_SUCCESS(rv, rv);
     if (isEditable)
       return editor->CanUndo(&isEnabled, outCmdEnabled);
   }
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsUndoCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->Undo(1);
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsUndoCommand::DoCommandParams(const char *aCommandName,
                                nsICommandParams *aParams,
                                nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsUndoCommand::GetCommandStateParams(const char *aCommandName,
                                      nsICommandParams *aParams,
                                      nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
-nsRedoCommand::IsCommandEnabled(const char * aCommandName,
+nsRedoCommand::IsCommandEnabled(const char *aCommandName,
                                 nsISupports *aCommandRefCon,
                                 bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     bool isEnabled, isEditable = false;
     nsresult rv = editor->GetIsSelectionEditable(&isEditable);
     NS_ENSURE_SUCCESS(rv, rv);
     if (isEditable)
       return editor->CanRedo(&isEnabled, outCmdEnabled);
   }
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsRedoCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->Redo(1);
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsRedoCommand::DoCommandParams(const char *aCommandName,
                                nsICommandParams *aParams,
                                nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsRedoCommand::GetCommandStateParams(const char *aCommandName,
                                      nsICommandParams *aParams,
                                      nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
-nsClearUndoCommand::IsCommandEnabled(const char * aCommandName,
+nsClearUndoCommand::IsCommandEnabled(const char *aCommandName,
                                      nsISupports *refCon, bool *outCmdEnabled)
-{ 
+{
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (editor)
     return editor->GetIsSelectionEditable(outCmdEnabled);
 
   *outCmdEnabled = false;
   return NS_OK;
 }
-  
 
 NS_IMETHODIMP
 nsClearUndoCommand::DoCommand(const char *aCommandName, nsISupports *refCon)
-{ 
+{
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   NS_ENSURE_TRUE(editor, NS_ERROR_NOT_IMPLEMENTED);
-  
-  editor->EnableUndo(false);  // Turning off undo clears undo/redo stacks.
-  editor->EnableUndo(true);   // This re-enables undo/redo.
-  
+
+  editor->EnableUndo(false); // Turning off undo clears undo/redo stacks.
+  editor->EnableUndo(true);  // This re-enables undo/redo.
+
   return NS_OK;
 }
-                                  
-NS_IMETHODIMP                       
+
+NS_IMETHODIMP
 nsClearUndoCommand::DoCommandParams(const char *aCommandName,
                                     nsICommandParams *aParams,
                                     nsISupports *refCon)
 {
   return DoCommand(aCommandName, refCon);
 }
-                                                  
-NS_IMETHODIMP                                     
+
+NS_IMETHODIMP
 nsClearUndoCommand::GetCommandStateParams(const char *aCommandName,
                                           nsICommandParams *aParams,
                                           nsISupports *refCon)
-{ 
+{
   NS_ENSURE_ARG_POINTER(aParams);
-  
+
   bool enabled;
   nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
   NS_ENSURE_SUCCESS(rv, rv);
-   
+
   return aParams->SetBooleanValue(STATE_ENABLED, enabled);
 }
 
 NS_IMETHODIMP
-nsCutCommand::IsCommandEnabled(const char * aCommandName,
-                               nsISupports *aCommandRefCon,
-                               bool *outCmdEnabled)
+nsCutCommand::IsCommandEnabled(const char *aCommandName,
+                               nsISupports *aCommandRefCon, bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     bool isEditable = false;
     nsresult rv = editor->GetIsSelectionEditable(&isEditable);
     NS_ENSURE_SUCCESS(rv, rv);
     if (isEditable)
       return editor->CanCut(outCmdEnabled);
   }
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsCutCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->Cut();
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCutCommand::DoCommandParams(const char *aCommandName,
                               nsICommandParams *aParams,
                               nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCutCommand::GetCommandStateParams(const char *aCommandName,
                                     nsICommandParams *aParams,
                                     nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
-
 NS_IMETHODIMP
-nsCutOrDeleteCommand::IsCommandEnabled(const char * aCommandName,
+nsCutOrDeleteCommand::IsCommandEnabled(const char *aCommandName,
                                        nsISupports *aCommandRefCon,
                                        bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->GetIsSelectionEditable(outCmdEnabled);
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsCutOrDeleteCommand::DoCommand(const char *aCommandName,
                                 nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     nsCOMPtr<nsISelection> selection;
     nsresult rv = editor->GetSelection(getter_AddRefs(selection));
     if (NS_SUCCEEDED(rv) && selection && selection->Collapsed()) {
       return editor->DeleteSelection(nsIEditor::eNext, nsIEditor::eStrip);
     }
     return editor->Cut();
   }
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCutOrDeleteCommand::DoCommandParams(const char *aCommandName,
                                       nsICommandParams *aParams,
                                       nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCutOrDeleteCommand::GetCommandStateParams(const char *aCommandName,
                                             nsICommandParams *aParams,
                                             nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
-nsCopyCommand::IsCommandEnabled(const char * aCommandName,
+nsCopyCommand::IsCommandEnabled(const char *aCommandName,
                                 nsISupports *aCommandRefCon,
                                 bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->CanCopy(outCmdEnabled);
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsCopyCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->Copy();
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCopyCommand::DoCommandParams(const char *aCommandName,
                                nsICommandParams *aParams,
                                nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCopyCommand::GetCommandStateParams(const char *aCommandName,
                                      nsICommandParams *aParams,
                                      nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
-nsCopyOrDeleteCommand::IsCommandEnabled(const char * aCommandName,
+nsCopyOrDeleteCommand::IsCommandEnabled(const char *aCommandName,
                                         nsISupports *aCommandRefCon,
                                         bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->GetIsSelectionEditable(outCmdEnabled);
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsCopyOrDeleteCommand::DoCommand(const char *aCommandName,
                                  nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     nsCOMPtr<nsISelection> selection;
     nsresult rv = editor->GetSelection(getter_AddRefs(selection));
     if (NS_SUCCEEDED(rv) && selection && selection->Collapsed()) {
       return editor->DeleteSelection(nsIEditor::eNextWord, nsIEditor::eStrip);
     }
     return editor->Copy();
   }
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCopyOrDeleteCommand::DoCommandParams(const char *aCommandName,
                                        nsICommandParams *aParams,
                                        nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsCopyOrDeleteCommand::GetCommandStateParams(const char *aCommandName,
                                              nsICommandParams *aParams,
                                              nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
+}
+
+NS_IMETHODIMP
+nsCopyAndCollapseToEndCommand::IsCommandEnabled(const char *aCommandName,
+                                                nsISupports *aCommandRefCon,
+                                                bool *outCmdEnabled)
+{
+  NS_ENSURE_ARG_POINTER(outCmdEnabled);
+  nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
+  if (editor)
+    return editor->CanCopy(outCmdEnabled);
+
+  *outCmdEnabled = false;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsCopyAndCollapseToEndCommand::DoCommand(const char *aCommandName,
+                                         nsISupports *aCommandRefCon)
+{
+  nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
+  if (editor) {
+    nsresult rv = editor->Copy();
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
+
+    nsCOMPtr<nsISelection> selection;
+    rv = editor->GetSelection(getter_AddRefs(selection));
+    if (NS_SUCCEEDED(rv) && selection) {
+      selection->CollapseToEnd();
+    }
+    return rv;
+  }
+
+  return NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsCopyAndCollapseToEndCommand::DoCommandParams(const char *aCommandName,
+                                               nsICommandParams *aParams,
+                                               nsISupports *aCommandRefCon)
+{
+  return DoCommand(aCommandName, aCommandRefCon);
+}
+
+NS_IMETHODIMP
+nsCopyAndCollapseToEndCommand::GetCommandStateParams(
+  const char *aCommandName, nsICommandParams *aParams,
+  nsISupports *aCommandRefCon)
+{
+  bool canUndo;
+  IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
 nsPasteCommand::IsCommandEnabled(const char *aCommandName,
                                  nsISupports *aCommandRefCon,
                                  bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     bool isEditable = false;
     nsresult rv = editor->GetIsSelectionEditable(&isEditable);
     NS_ENSURE_SUCCESS(rv, rv);
     if (isEditable)
       return editor->CanPaste(nsIClipboard::kGlobalClipboard, outCmdEnabled);
   }
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsPasteCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
-  
+
   return editor->Paste(nsIClipboard::kGlobalClipboard);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsPasteCommand::DoCommandParams(const char *aCommandName,
                                 nsICommandParams *aParams,
                                 nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsPasteCommand::GetCommandStateParams(const char *aCommandName,
                                       nsICommandParams *aParams,
                                       nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
 nsPasteTransferableCommand::IsCommandEnabled(const char *aCommandName,
                                              nsISupports *aCommandRefCon,
                                              bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
-  if (editor)
-  {
+  if (editor) {
     bool isEditable = false;
     nsresult rv = editor->GetIsSelectionEditable(&isEditable);
     NS_ENSURE_SUCCESS(rv, rv);
     if (isEditable)
       return editor->CanPasteTransferable(nullptr, outCmdEnabled);
   }
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsPasteTransferableCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
+nsPasteTransferableCommand::DoCommand(const char *aCommandName,
+                                      nsISupports *aCommandRefCon)
 {
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsPasteTransferableCommand::DoCommandParams(const char *aCommandName,
                                             nsICommandParams *aParams,
                                             nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
-  
+
   nsCOMPtr<nsISupports> supports;
   aParams->GetISupportsValue("transferable", getter_AddRefs(supports));
   NS_ENSURE_TRUE(supports, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsITransferable> trans = do_QueryInterface(supports);
   NS_ENSURE_TRUE(trans, NS_ERROR_FAILURE);
 
   return editor->PasteTransferable(trans);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsPasteTransferableCommand::GetCommandStateParams(const char *aCommandName,
                                                   nsICommandParams *aParams,
                                                   nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsITransferable> trans;
@@ -494,59 +526,60 @@ nsPasteTransferableCommand::GetCommandSt
   nsresult rv = editor->CanPasteTransferable(trans, &canPaste);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aParams->SetBooleanValue(STATE_ENABLED, canPaste);
 }
 
 NS_IMETHODIMP
 nsSwitchTextDirectionCommand::IsCommandEnabled(const char *aCommandName,
-                                 nsISupports *aCommandRefCon,
-                                 bool *outCmdEnabled)
+                                               nsISupports *aCommandRefCon,
+                                               bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->GetIsSelectionEditable(outCmdEnabled);
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSwitchTextDirectionCommand::DoCommand(const char *aCommandName, nsISupports *aCommandRefCon)
+nsSwitchTextDirectionCommand::DoCommand(const char *aCommandName,
+                                        nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
 
   return editor->SwitchTextDirection();
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsSwitchTextDirectionCommand::DoCommandParams(const char *aCommandName,
-                                nsICommandParams *aParams,
-                                nsISupports *aCommandRefCon)
+                                              nsICommandParams *aParams,
+                                              nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsSwitchTextDirectionCommand::GetCommandStateParams(const char *aCommandName,
-                                      nsICommandParams *aParams,
-                                      nsISupports *aCommandRefCon)
+                                                    nsICommandParams *aParams,
+                                                    nsISupports *aCommandRefCon)
 {
   bool canSwitchTextDirection = true;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canSwitchTextDirection);
   return aParams->SetBooleanValue(STATE_ENABLED, canSwitchTextDirection);
 }
 
 NS_IMETHODIMP
-nsDeleteCommand::IsCommandEnabled(const char* aCommandName,
-                                  nsISupports* aCommandRefCon,
-                                  bool* outCmdEnabled)
+nsDeleteCommand::IsCommandEnabled(const char *aCommandName,
+                                  nsISupports *aCommandRefCon,
+                                  bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   *outCmdEnabled = false;
 
   NS_ENSURE_TRUE(editor, NS_OK);
 
   // We can generally delete whenever the selection is editable.  However,
@@ -558,20 +591,19 @@ nsDeleteCommand::IsCommandEnabled(const 
   if (!nsCRT::strcmp("cmd_delete", aCommandName) && *outCmdEnabled) {
     rv = editor->CanCut(outCmdEnabled);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
-nsDeleteCommand::DoCommand(const char* aCommandName,
-                           nsISupports* aCommandRefCon)
+nsDeleteCommand::DoCommand(const char *aCommandName,
+                           nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
 
   nsIEditor::EDirection deleteDir = nsIEditor::eNone;
 
   if (!nsCRT::strcmp("cmd_delete", aCommandName)) {
     // Really this should probably be eNone, but it only makes a difference if
@@ -592,36 +624,36 @@ nsDeleteCommand::DoCommand(const char* a
     deleteDir = nsIEditor::eToEndOfLine;
   } else {
     MOZ_CRASH("Unrecognized nsDeleteCommand");
   }
 
   return editor->DeleteSelection(deleteDir, nsIEditor::eStrip);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsDeleteCommand::DoCommandParams(const char *aCommandName,
                                  nsICommandParams *aParams,
                                  nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsDeleteCommand::GetCommandStateParams(const char *aCommandName,
                                        nsICommandParams *aParams,
                                        nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
 NS_IMETHODIMP
-nsSelectAllCommand::IsCommandEnabled(const char * aCommandName,
+nsSelectAllCommand::IsCommandEnabled(const char *aCommandName,
                                      nsISupports *aCommandRefCon,
                                      bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
 
   nsresult rv = NS_OK;
   // You can always select all, unless the selection is editable,
   // and the editable region is empty!
@@ -634,49 +666,47 @@ nsSelectAllCommand::IsCommandEnabled(con
     rv = editor->GetDocumentIsEmpty(&docIsEmpty);
     NS_ENSURE_SUCCESS(rv, rv);
     *outCmdEnabled = !docIsEmpty;
   }
 
   return rv;
 }
 
-
 NS_IMETHODIMP
 nsSelectAllCommand::DoCommand(const char *aCommandName,
                               nsISupports *aCommandRefCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->SelectAll();
-    
+
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsSelectAllCommand::DoCommandParams(const char *aCommandName,
                                     nsICommandParams *aParams,
                                     nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsSelectAllCommand::GetCommandStateParams(const char *aCommandName,
                                           nsICommandParams *aParams,
                                           nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
-
 NS_IMETHODIMP
-nsSelectionMoveCommands::IsCommandEnabled(const char * aCommandName,
+nsSelectionMoveCommands::IsCommandEnabled(const char *aCommandName,
                                           nsISupports *aCommandRefCon,
                                           bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
   if (editor)
     return editor->GetIsSelectionEditable(outCmdEnabled);
 
@@ -760,91 +790,89 @@ nsSelectionMoveCommands::DoCommand(const
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
   if (doc) {
     // Most of the commands below (possibly all of them) need layout to
     // be up to date.
     doc->FlushPendingNotifications(Flush_Layout);
   }
 
   nsCOMPtr<nsISelectionController> selCont;
-  nsresult rv = editor->GetSelectionController(getter_AddRefs(selCont)); 
+  nsresult rv = editor->GetSelectionController(getter_AddRefs(selCont));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(selCont, NS_ERROR_FAILURE);
 
   // scroll commands
   for (size_t i = 0; i < mozilla::ArrayLength(scrollCommands); i++) {
-    const ScrollCommand& cmd = scrollCommands[i];
+    const ScrollCommand &cmd = scrollCommands[i];
     if (!nsCRT::strcmp(aCommandName, cmd.reverseScroll)) {
       return (selCont->*(cmd.scroll))(false);
     } else if (!nsCRT::strcmp(aCommandName, cmd.forwardScroll)) {
       return (selCont->*(cmd.scroll))(true);
     }
   }
 
   // caret movement/selection commands
   for (size_t i = 0; i < mozilla::ArrayLength(moveCommands); i++) {
-    const MoveCommand& cmd = moveCommands[i];
+    const MoveCommand &cmd = moveCommands[i];
     if (!nsCRT::strcmp(aCommandName, cmd.reverseMove)) {
       return (selCont->*(cmd.move))(false, false);
     } else if (!nsCRT::strcmp(aCommandName, cmd.forwardMove)) {
       return (selCont->*(cmd.move))(true, false);
     } else if (!nsCRT::strcmp(aCommandName, cmd.reverseSelect)) {
       return (selCont->*(cmd.move))(false, true);
     } else if (!nsCRT::strcmp(aCommandName, cmd.forwardSelect)) {
       return (selCont->*(cmd.move))(true, true);
     }
   }
 
   // physical-direction movement/selection
   for (size_t i = 0; i < mozilla::ArrayLength(physicalCommands); i++) {
-    const PhysicalCommand& cmd = physicalCommands[i];
+    const PhysicalCommand &cmd = physicalCommands[i];
     if (!nsCRT::strcmp(aCommandName, cmd.move)) {
       return selCont->PhysicalMove(cmd.direction, cmd.amount, false);
     } else if (!nsCRT::strcmp(aCommandName, cmd.select)) {
       return selCont->PhysicalMove(cmd.direction, cmd.amount, true);
     }
   }
 
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsSelectionMoveCommands::DoCommandParams(const char *aCommandName,
                                          nsICommandParams *aParams,
                                          nsISupports *aCommandRefCon)
 {
   return DoCommand(aCommandName, aCommandRefCon);
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 nsSelectionMoveCommands::GetCommandStateParams(const char *aCommandName,
                                                nsICommandParams *aParams,
                                                nsISupports *aCommandRefCon)
 {
   bool canUndo;
   IsCommandEnabled(aCommandName, aCommandRefCon, &canUndo);
-  return aParams->SetBooleanValue(STATE_ENABLED,canUndo);
+  return aParams->SetBooleanValue(STATE_ENABLED, canUndo);
 }
 
-
 NS_IMETHODIMP
-nsInsertPlaintextCommand::IsCommandEnabled(const char * aCommandName,
-                                           nsISupports *refCon, 
+nsInsertPlaintextCommand::IsCommandEnabled(const char *aCommandName,
+                                           nsISupports *refCon,
                                            bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (editor)
     return editor->GetIsSelectionEditable(outCmdEnabled);
 
   *outCmdEnabled = false;
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-
 NS_IMETHODIMP
 nsInsertPlaintextCommand::DoCommand(const char *aCommandName,
                                     nsISupports *refCon)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
@@ -875,69 +903,65 @@ nsInsertPlaintextCommand::GetCommandStat
 {
   NS_ENSURE_ARG_POINTER(aParams);
 
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED, outCmdEnabled);
 }
 
-
 NS_IMETHODIMP
-nsPasteQuotationCommand::IsCommandEnabled(const char * aCommandName,
+nsPasteQuotationCommand::IsCommandEnabled(const char *aCommandName,
                                           nsISupports *refCon,
                                           bool *outCmdEnabled)
 {
   NS_ENSURE_ARG_POINTER(outCmdEnabled);
 
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
-  nsCOMPtr<nsIEditorMailSupport>  mailEditor = do_QueryInterface(refCon);
+  nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(refCon);
   if (editor && mailEditor) {
     uint32_t flags;
     editor->GetFlags(&flags);
     if (!(flags & nsIPlaintextEditor::eEditorSingleLineMask))
       return editor->CanPaste(nsIClipboard::kGlobalClipboard, outCmdEnabled);
   }
 
   *outCmdEnabled = false;
   return NS_OK;
 }
 
-
 NS_IMETHODIMP
 nsPasteQuotationCommand::DoCommand(const char *aCommandName,
                                    nsISupports *refCon)
 {
-  nsCOMPtr<nsIEditorMailSupport>  mailEditor = do_QueryInterface(refCon);
+  nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(refCon);
   if (mailEditor)
     return mailEditor->PasteAsQuotation(nsIClipboard::kGlobalClipboard);
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsPasteQuotationCommand::DoCommandParams(const char *aCommandName,
                                          nsICommandParams *aParams,
                                          nsISupports *refCon)
 {
-  nsCOMPtr<nsIEditorMailSupport>  mailEditor = do_QueryInterface(refCon);
+  nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(refCon);
   if (mailEditor)
     return mailEditor->PasteAsQuotation(nsIClipboard::kGlobalClipboard);
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsPasteQuotationCommand::GetCommandStateParams(const char *aCommandName,
                                                nsICommandParams *aParams,
                                                nsISupports *refCon)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
-  if (editor)
-  {
+  if (editor) {
     bool enabled = false;
     editor->CanPaste(nsIClipboard::kGlobalClipboard, &enabled);
     aParams->SetBooleanValue(STATE_ENABLED, enabled);
   }
- 
+
   return NS_OK;
 }
-
--- a/editor/libeditor/nsEditorCommands.h
+++ b/editor/libeditor/nsEditorCommands.h
@@ -47,16 +47,17 @@ public:                                 
 NS_DECL_EDITOR_COMMAND(nsUndoCommand)
 NS_DECL_EDITOR_COMMAND(nsRedoCommand)
 NS_DECL_EDITOR_COMMAND(nsClearUndoCommand)
 
 NS_DECL_EDITOR_COMMAND(nsCutCommand)
 NS_DECL_EDITOR_COMMAND(nsCutOrDeleteCommand)
 NS_DECL_EDITOR_COMMAND(nsCopyCommand)
 NS_DECL_EDITOR_COMMAND(nsCopyOrDeleteCommand)
+NS_DECL_EDITOR_COMMAND(nsCopyAndCollapseToEndCommand)
 NS_DECL_EDITOR_COMMAND(nsPasteCommand)
 NS_DECL_EDITOR_COMMAND(nsPasteTransferableCommand)
 NS_DECL_EDITOR_COMMAND(nsSwitchTextDirectionCommand)
 NS_DECL_EDITOR_COMMAND(nsDeleteCommand)
 NS_DECL_EDITOR_COMMAND(nsSelectAllCommand)
 
 NS_DECL_EDITOR_COMMAND(nsSelectionMoveCommands)
 
--- a/editor/libeditor/nsEditorController.cpp
+++ b/editor/libeditor/nsEditorController.cpp
@@ -48,16 +48,18 @@ nsresult nsEditorController::RegisterEdi
   NS_REGISTER_ONE_COMMAND(nsUndoCommand, "cmd_undo");
   NS_REGISTER_ONE_COMMAND(nsRedoCommand, "cmd_redo");
   NS_REGISTER_ONE_COMMAND(nsClearUndoCommand, "cmd_clearUndo");
 
   NS_REGISTER_ONE_COMMAND(nsCutCommand, "cmd_cut");
   NS_REGISTER_ONE_COMMAND(nsCutOrDeleteCommand, "cmd_cutOrDelete");
   NS_REGISTER_ONE_COMMAND(nsCopyCommand, "cmd_copy");
   NS_REGISTER_ONE_COMMAND(nsCopyOrDeleteCommand, "cmd_copyOrDelete");
+  NS_REGISTER_ONE_COMMAND(nsCopyAndCollapseToEndCommand,
+                          "cmd_copyAndCollapseToEnd");
   NS_REGISTER_ONE_COMMAND(nsSelectAllCommand, "cmd_selectAll");
 
   NS_REGISTER_ONE_COMMAND(nsPasteCommand, "cmd_paste");
   NS_REGISTER_ONE_COMMAND(nsPasteTransferableCommand, "cmd_pasteTransferable");
 
   NS_REGISTER_ONE_COMMAND(nsSwitchTextDirectionCommand, "cmd_switchTextDirection");
 
   NS_REGISTER_FIRST_COMMAND(nsDeleteCommand, "cmd_delete");
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -15,16 +15,17 @@ skip-if = buildapp == 'mulet'
 [test_bug616590.xul]
 [test_bug635636.html]
 [test_bug636465.xul]
 [test_bug646194.xul]
 [test_bug780908.xul]
 [test_bug830600.html]
 [test_bug1053048.html]
 [test_bug1102906.html]
+[test_bug1101392.html]
 [test_composition_event_created_in_chrome.html]
 [test_contenteditable_text_input_handling.html]
 [test_dragdrop.html]
 skip-if = buildapp == 'mulet'
 [test_htmleditor_keyevent_handling.html]
 [test_selection_move_commands.xul]
 [test_texteditor_keyevent_handling.html]
 # disables the key handling test on gtk because gtk overrides some key events
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/tests/test_bug1101392.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1101392
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1101392</title>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+
+  /** Test for Bug 1101392 **/
+  SimpleTest.waitForExplicitFinish();
+  SimpleTest.waitForFocus(runTests);
+
+  function runCopyCommand(element, compareText, nextTest)
+  {
+    element.focus();
+    if (element.editor) {
+      var sel = element.editor.selection;
+      element.select();
+    } else {
+      var sel = window.getSelection();
+      sel.selectAllChildren(element.parentNode);
+    }
+
+    var expectedEndpoint = [
+      sel.getRangeAt(0).endContainer,
+      sel.getRangeAt(0).endOffset
+    ];
+
+    function checkCollapse() {
+      is(sel.isCollapsed, true, "collapsed after cmd_copyAndCollapseToEnd");
+      is(sel.anchorNode, expectedEndpoint[0], "node after cmd_copyAndCollapseToEnd");
+      is(sel.anchorOffset, expectedEndpoint[1], "offset after cmd_copyAndCollapseToEnd");
+
+      nextTest();
+    }
+
+    const kCmd = "cmd_copyAndCollapseToEnd";
+    var controller = top.document.commandDispatcher
+                     .getControllerForCommand(kCmd);
+    ok((controller && controller.isCommandEnabled(kCmd)), "have cmd_copyAndCollapseToEnd command");
+    SimpleTest.waitForClipboard(compareText,
+        () => { controller.doCommand(kCmd); },
+        checkCollapse, checkCollapse);
+  }
+
+  function testDiv()
+  {
+    var content = document.getElementById("content");
+    runCopyCommand(content, 'abc', testTextarea);
+  }
+
+  function testTextarea()
+  {
+    var textarea = document.getElementById("textarea");
+    runCopyCommand(textarea, 'def', SimpleTest.finish);
+  }
+
+  function runTests()
+  {
+    testDiv();
+  }
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1101392">Mozilla Bug 1101392</a>
+<div><div id="content">abc</div></div>
+
+<textarea id="textarea">def</textarea>
+
+<pre id="test">
+</pre>
+</body>
+</html>
--- a/layout/base/TouchCaret.cpp
+++ b/layout/base/TouchCaret.cpp
@@ -349,17 +349,20 @@ TouchCaret::NotifySelectionChanged(nsIDO
   // the caret is currently interested in , then there is nothing to do!
   if (aSel != caret->GetSelection()) {
     TOUCHCARET_LOG("Return for selection mismatch!");
     return NS_OK;
   }
 
   // Update touch caret position and visibility.
   // Hide touch caret while key event causes selection change.
-  if (aReason & nsISelectionListener::KEYPRESS_REASON) {
+  // Also hide touch caret when gecko or javascript collapse the selection.
+  if (aReason & nsISelectionListener::KEYPRESS_REASON ||
+      aReason & nsISelectionListener::COLLAPSETOSTART_REASON ||
+      aReason & nsISelectionListener::COLLAPSETOEND_REASON) {
     TOUCHCARET_LOG("KEYPRESS_REASON");
     SetVisibility(false);
   } else {
     SyncVisibilityWithCaret();
   }
 
   return NS_OK;
 }