merge b2g-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 04 Dec 2014 17:03:38 +0100
changeset 218348 29d086b32a2607108f2b7ffaef22925cf9e9a190
parent 218315 5bc6c5b77e287db8c96d6d7149ee0818467345cb (current diff)
parent 218347 2de23c4d6a1f19c319213e23601a5bf6334a5fd2 (diff)
child 218353 a66da898b434574bed884cce246645cc68d71c71
child 218391 e4e7772034e9d3d404dc91bee658a3ec33918837
child 218463 80f09cc935295bb859205a9e380ce69ae23d4456
push id27929
push usercbook@mozilla.com
push dateThu, 04 Dec 2014 16:03:49 +0000
treeherdermozilla-central@29d086b32a26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone37.0a1
first release with
nightly linux32
29d086b32a26 / 37.0a1 / 20141205030202 / files
nightly linux64
29d086b32a26 / 37.0a1 / 20141205030202 / files
nightly mac
29d086b32a26 / 37.0a1 / 20141205030202 / files
nightly win32
29d086b32a26 / 37.0a1 / 20141205030202 / files
nightly win64
29d086b32a26 / 37.0a1 / 20141205030202 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge b2g-inbound to mozilla-central a=merge
b2g/app/b2g.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -10,16 +10,17 @@ pref("browser.chromeURL", "chrome://b2g/
 #endif
 
 #ifdef MOZ_MULET
 // Set FxOS as the default homepage
 // bug 1000122: this pref is fetched as a complex value,
 // so that it can't be set a just a string.
 // data: url is a workaround this.
 pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=chrome://b2g/content/shell.html");
+pref("b2g.is_mulet", true);
 // Prevent having the firstrun page
 pref("startup.homepage_welcome_url", "");
 pref("browser.shell.checkDefaultBrowser", false);
 // Automatically open devtools on the firefox os panel
 pref("devtools.toolbox.host", "side");
 pref("devtools.toolbox.sidebar.width", 800);
 // Disable session store to ensure having only one tab opened
 pref("browser.sessionstore.max_tabs_undo", 0);
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -10,25 +10,25 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <!-- Stock Android things -->
   <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="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="8b880805d454664b3eed11d0f053cdeafa1ff06e"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="a1e239a0bb5cd1d69680bf1075883aa9a7bf2429"/>
   <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="c7931763d41be602407ed9d71e2c0292c6597e00"/>
   <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="83760d213fb3bec7b4117d266fcfbf6fe2ba14ab"/>
   <project name="device/common" path="device/common" revision="6a2995683de147791e516aae2ccb31fdfbe2ad30"/>
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -14,23 +14,23 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
   <project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
   <project name="platform/bootable/recovery" path="bootable/recovery" revision="425f8b5fadf5889834c5acd27d23c9e0b2129c28"/>
   <project name="device/common" path="device/common" revision="42b808b7e93d0619286ae8e59110b176b7732389"/>
   <project name="device/sample" path="device/sample" revision="237bd668d0f114d801a8d6455ef5e02cc3577587"/>
   <project name="platform_external_apriori" path="external/apriori" remote="b2g" revision="11816ad0406744f963537b23d68ed9c2afb412bd"/>
   <project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" revision="52a1a862a8bac319652b8f82d9541ba40bfa45ce"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -12,20 +12,20 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <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"/>
   <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"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="b89fda71fcd0fa0cf969310e75be3ea33e048b44"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="2e7d5348f35575870b3c7e567a9a9f6d66f8d6c5"/>
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -10,25 +10,25 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <!-- Stock Android things -->
   <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="f92a936f2aa97526d4593386754bdbf02db07a12"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="1950e4760fa14688b83cdbb5acaa1af9f82ef434"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="ac6eb97a37035c09fb5ede0852f0881e9aadf9ad"/>
   <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="737f591c5f95477148d26602c7be56cbea0cdeb9"/>
   <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="51da9b1981be481b92a59a826d4d78dc73d0989a"/>
   <project name="device/common" path="device/common" revision="798a3664597e6041985feab9aef42e98d458bc3d"/>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -14,23 +14,23 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
   <project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
   <project name="platform/bootable/recovery" path="bootable/recovery" revision="425f8b5fadf5889834c5acd27d23c9e0b2129c28"/>
   <project name="device/common" path="device/common" revision="42b808b7e93d0619286ae8e59110b176b7732389"/>
   <project name="device/sample" path="device/sample" revision="237bd668d0f114d801a8d6455ef5e02cc3577587"/>
   <project name="platform_external_apriori" path="external/apriori" remote="b2g" revision="11816ad0406744f963537b23d68ed9c2afb412bd"/>
   <project name="platform/external/bluetooth/bluez" path="external/bluetooth/bluez" revision="52a1a862a8bac319652b8f82d9541ba40bfa45ce"/>
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -10,25 +10,25 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <!-- Stock Android things -->
   <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="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="8b880805d454664b3eed11d0f053cdeafa1ff06e"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="a1e239a0bb5cd1d69680bf1075883aa9a7bf2429"/>
   <project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="c7931763d41be602407ed9d71e2c0292c6597e00"/>
   <project groups="linux,x86" name="platform/prebuilts/python/linux-x86/2.7.5" path="prebuilts/python/linux-x86/2.7.5" revision="a32003194f707f66a2d8cdb913ed1869f1926c5d"/>
   <project name="device/common" path="device/common" revision="96d4d2006c4fcb2f19a3fa47ab10cb409faa017b"/>
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -12,20 +12,20 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <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"/>
   <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="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="8b880805d454664b3eed11d0f053cdeafa1ff06e"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
         "git_revision": "", 
         "remote": "", 
         "branch": ""
     }, 
-    "revision": "d7e815eb184c843a9d7e5784e99d5e39a31c59da", 
+    "revision": "9a69c3f26819cc3ee8060307289ca8712d0c5e22", 
     "repo_path": "integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -12,21 +12,21 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <!-- 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"/>
   <project name="platform/development" path="development" revision="2460485184bc8535440bb63876d4e63ec1b4770c"/>
   <project name="device/common" path="device/common" revision="0dcc1e03659db33b77392529466f9eb685cdd3c7"/>
   <project name="device/sample" path="device/sample" revision="68b1cb978a20806176123b959cb05d4fa8adaea4"/>
   <project name="platform_external_apriori" path="external/apriori" remote="b2g" revision="11816ad0406744f963537b23d68ed9c2afb412bd"/>
--- 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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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,20 +12,20 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <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"/>
   <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"/>
   <project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="b89fda71fcd0fa0cf969310e75be3ea33e048b44"/>
   <project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="2e7d5348f35575870b3c7e567a9a9f6d66f8d6c5"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -12,22 +12,22 @@
   <!--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="984e6d79aa799d2695f9ca132dfdc1665a56c019"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="0462090a99093049add9268d14cbc7e44c1d1ccb"/>
   <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="8695c248b5347120bf56c3d1a3a8493d791ea712"/>
+  <project name="apitrace" path="external/apitrace" remote="apitrace" revision="3734105921db5e802c9257c81ca707cae1500742"/>
   <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"/>
   <project name="platform/bootable/recovery" path="bootable/recovery" revision="e0a9ac010df3afaa47ba107192c05ac8b5516435"/>
   <project name="platform/development" path="development" revision="a384622f5fcb1d2bebb9102591ff7ae91fe8ed2d"/>
   <project name="device/common" path="device/common" revision="7c65ea240157763b8ded6154a17d3c033167afb7"/>
   <project name="device/sample" path="device/sample" revision="c328f3d4409db801628861baa8d279fb8855892f"/>
--- a/dom/apps/PermissionsTable.jsm
+++ b/dom/apps/PermissionsTable.jsm
@@ -406,18 +406,23 @@ this.PermissionsTable =  { geolocation: 
                              trusted: PROMPT_ACTION,
                              privileged: PROMPT_ACTION,
                              certified: ALLOW_ACTION
                            },
                            "nfc": {
                              app: DENY_ACTION,
                              trusted: DENY_ACTION,
                              privileged: DENY_ACTION,
-                             certified: ALLOW_ACTION,
-                             access: ["read", "write"]
+                             certified: ALLOW_ACTION
+                           },
+                           "nfc-share": {
+                             app: DENY_ACTION,
+                             trusted: DENY_ACTION,
+                             privileged: DENY_ACTION,
+                             certified: ALLOW_ACTION
                            },
                            "nfc-manager": {
                              app: DENY_ACTION,
                              trusted: DENY_ACTION,
                              privileged: DENY_ACTION,
                              certified: ALLOW_ACTION
                            },
                            "nfc-hci-events": {
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1409,16 +1409,29 @@ Navigator::GetFeature(const nsAString& a
         mozilla::dom::ContentChild::GetSingleton();
       nsRefPtr<Promise> ipcRef(p);
       cc->SendGetSystemMemory(reinterpret_cast<uint64_t>(ipcRef.forget().take()));
     }
     return p.forget();
   } // hardware.memory
 #endif
 
+  p->MaybeResolve(JS::UndefinedHandleValue);
+  return p.forget();
+}
+
+already_AddRefed<Promise>
+Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
+{
+  nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
+  nsRefPtr<Promise> p = Promise::Create(go, aRv);
+  if (aRv.Failed()) {
+    return nullptr;
+  }
+
   // Hardcoded manifest features. Some are still b2g specific.
   const char manifestFeatures[][64] = {
     "manifest.origin"
   , "manifest.redirects"
 #ifdef MOZ_B2G
   , "manifest.chrome.navigation"
   , "manifest.precompile"
 #endif
@@ -1427,29 +1440,16 @@ Navigator::GetFeature(const nsAString& a
   nsAutoCString feature = NS_ConvertUTF16toUTF8(aName);
   for (uint32_t i = 0; i < MOZ_ARRAY_LENGTH(manifestFeatures); i++) {
     if (feature.Equals(manifestFeatures[i])) {
       p->MaybeResolve(true);
       return p.forget();
     }
   }
 
-  p->MaybeResolve(JS::UndefinedHandleValue);
-  return p.forget();
-}
-
-already_AddRefed<Promise>
-Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
-{
-  nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
-  nsRefPtr<Promise> p = Promise::Create(go, aRv);
-  if (aRv.Failed()) {
-    return nullptr;
-  }
-
   NS_NAMED_LITERAL_STRING(apiWindowPrefix, "api.window.");
   if (StringBeginsWith(aName, apiWindowPrefix)) {
     const nsAString& featureName = Substring(aName, apiWindowPrefix.Length());
 
     // Temporary hardcoded entry points due to technical constraints
     if (featureName.EqualsLiteral("Navigator.mozTCPSocket")) {
       p->MaybeResolve(Preferences::GetBool("dom.mozTCPSocket.enabled"));
       return p.forget();
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -47,16 +47,17 @@
 #include "nsISHistoryInternal.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIXULWindow.h"
 #include "nsIEditor.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsIPermissionManager.h"
 #include "nsISHistory.h"
 #include "nsNullPrincipal.h"
+#include "nsIScriptError.h"
 
 #include "nsLayoutUtils.h"
 #include "nsView.h"
 
 #include "nsIURI.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 
@@ -1757,16 +1758,40 @@ nsFrameLoader::MaybeCreateDocShell()
                         "inprocess-browser-shown", nullptr);
   }
 
   if (OwnerIsBrowserOrAppFrame() && mMessageManager) {
     mMessageManager->LoadFrameScript(
       NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
       /* allowDelayedLoad = */ true,
       /* aRunInGlobalScope */ true);
+    // For inproc frames, set the docshell properties.
+    nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
+    nsAutoString name;
+    if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
+      item->SetName(name);
+    }
+    mDocShell->SetFullscreenAllowed(
+      mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
+      mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen));
+    bool isPrivate = mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
+    if (isPrivate) {
+      bool nonBlank;
+      mDocShell->GetHasLoadedNonBlankURI(&nonBlank);
+      if (nonBlank) {
+        nsContentUtils::ReportToConsoleNonLocalized(
+          NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
+          nsIScriptError::warningFlag,
+          NS_LITERAL_CSTRING("mozprivatebrowsing"),
+          nullptr);
+      } else {
+        nsCOMPtr<nsILoadContext> context = do_GetInterface(mDocShell);
+        context->SetUsePrivateBrowsing(true);
+      }
+    }
   }
 
   return NS_OK;
 }
 
 void
 nsFrameLoader::GetURL(nsString& aURI)
 {
--- a/dom/base/test/test_getFeature_with_perm.html
+++ b/dom/base/test/test_getFeature_with_perm.html
@@ -46,35 +46,45 @@ function testSupported() {
 }
 
 function testNotSupported() {
   var tv;
   navigator.getFeature("hardware.tv").then(function(tv) {
     ok(typeof tv === 'undefined', "Resolve the Promise with undefined value (hardware.tv)");
     runNextTest();
   },function(tv) {
-    ok(false, "The Promise should not be rejected")
+    ok(false, "The Promise should not be rejected");
+  });
+}
+
+function testNotSupportedManifest() {
+  navigator.getFeature("manifest.origin").then(function(feature) {
+    ok(typeof feature == 'undefined', "manifest.* resolves with undefined on getFeature");
+    runNextTest();
+  }, function() {
+    ok(false, "The Promise should not be rejected");
   });
 }
 
 function createManifestTest(aFeature) {
   return function() {
     var res;
-    navigator.getFeature(aFeature).then(function(res) {
+    navigator.hasFeature(aFeature).then(function(res) {
       ok(res === true, "Resolve the Promise with 'true' for " + aFeature);
       runNextTest();
-    },function(tv) {
-      ok(false, "The Promise should not be rejected")
+    }, function(tv) {
+      ok(false, "The Promise should not be rejected");
     });
   }
 }
 
 var currentTest = -1;
 var tests = [
   testNotSupported,
+  testNotSupportedManifest,
   testSupported,
   createManifestTest("manifest.origin"),
   createManifestTest("manifest.redirects")
 ];
 
 function runNextTest() {
   currentTest++;
   if (currentTest < tests.length) {
@@ -85,16 +95,17 @@ function runNextTest() {
 }
 
 info("About to run " + tests.length + " tests");
 
 SpecialPowers.pushPermissions([
   {type: "feature-detection", allow: 1, context: document}
 ], function() {
   ok('getFeature' in navigator, "navigator.getFeature should exist");
+  ok('hasFeature' in navigator, "navigator.hasFeature should exist");
   // B2G specific manifest features.
   // Touching navigator before pushPermissions makes it fail.
   if (!navigator.userAgent.contains("Android") &&
         /Mobile|Tablet/.test(navigator.userAgent)) {
     info("Adding B2G specific tests");
     tests.push(createManifestTest("manifest.chrome.navigation"));
     tests.push(createManifestTest("manifest.precompile"));
   }
--- a/dom/browser-element/BrowserElementChild.js
+++ b/dom/browser-element/BrowserElementChild.js
@@ -47,19 +47,10 @@ if (!('BrowserElementIsPreloaded' in thi
 
   Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js");
 } else {
   ContentPanning.init();
 }
 
 var BrowserElementIsReady = true;
 
-let infos = sendSyncMessage('browser-element-api:call',
-                            { 'msg_name': 'hello' })[0];
-docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
-docShell.setFullscreenAllowed(infos.fullscreenAllowed);
-if (infos.isPrivate) {
-  if (docShell.hasLoadedNonBlankURI) {
-    Cu.reportError("We should not switch to Private Browsing after loading a document.");
-  } else {
-    docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
-  }
-}
+
+sendAsyncMessage('browser-element-api:call', { 'msg_name': 'hello' });
--- a/dom/browser-element/BrowserElementParent.js
+++ b/dom/browser-element/BrowserElementParent.js
@@ -320,24 +320,16 @@ BrowserElementParent.prototype = {
     }
 
     if (!this._domRequestReady) {
       // At least, one message listener such as for hello is registered.
       // So we can use sendAsyncMessage now.
       this._domRequestReady = true;
       this._runPendingAPICall();
     }
-
-    return {
-      name: this._frameElement.getAttribute('name'),
-      fullscreenAllowed:
-        this._frameElement.hasAttribute('allowfullscreen') ||
-        this._frameElement.hasAttribute('mozallowfullscreen'),
-      isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing')
-    };
   },
 
   _fireCtxMenuEvent: function(data) {
     let detail = data.json;
     let evtName = detail.msg_name;
 
     debug('fireCtxMenuEventFromMsg: ' + evtName + ' ' + detail);
     let evt = this._createEvent(evtName, detail, /* cancellable */ true);
--- a/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames2_Outer.html
+++ b/dom/browser-element/mochitest/file_browserElement_SetVisibleFrames2_Outer.html
@@ -10,20 +10,16 @@ iframe.addEventListener('mozbrowsershowm
     setTimeout(function() {
       iframe.setVisible(false);
       iframe.setVisible(true);
       setTimeout(function() {
         alert('parent:finish');
       }, 0);
     }, 0);
   }
-  else {
-    // Pass the message up to our parent.
-    alert(e.detail.message);
-  }
 });
 
 document.body.appendChild(iframe);
 iframe.src = 'file_browserElement_SetVisibleFrames_Inner.html?child';
 
 </script>
 </body>
 </html>
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -64,16 +64,23 @@ struct NativeKeyBinding
 };
 
 union MaybeNativeKeyBinding
 {
   NativeKeyBinding;
   void_t;
 };
 
+struct ShowInfo
+{
+  nsString name;
+  bool fullscreenAllowed;
+  bool isPrivate;
+};
+
 prio(normal upto urgent) intr protocol PBrowser
 {
     manager PContent or PContentBridge;
 
     manages PColorPicker;
     manages PDocumentRenderer;
     manages PContentPermissionRequest;
     manages PFilePicker;
@@ -406,16 +413,17 @@ child:
      * side, with the given |visibleRect|.  This message is expected
      * to trigger creation of the remote browser's "widget".
      *
      * |Show()| and |Move()| take IntSizes rather than Rects because
      * content processes always render to a virtual <0, 0> top-left
      * point.
      */
     Show(nsIntSize size,
+         ShowInfo info,
          ScrollingBehavior scrolling,
          TextureFactoryIdentifier textureFactoryIdentifier,
          uint64_t layersId,
          nullable PRenderFrame renderFrame);
 
     LoadURL(nsCString uri);
 
     CacheFileDescriptor(nsString path, FileDescriptor fd);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -85,16 +85,17 @@
 #include "LayersLogging.h"
 #include "nsIOService.h"
 #include "nsDOMClassInfoID.h"
 #include "nsColorPickerProxy.h"
 #include "nsPresShell.h"
 #include "nsIAppsService.h"
 #include "nsNetUtil.h"
 #include "nsIPermissionManager.h"
+#include "nsIScriptError.h"
 
 #define BROWSER_ELEMENT_CHILD_SCRIPT \
     NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
 
 #define TABC_LOG(...)
 // #define TABC_LOG(...) printf_stderr("TABC: " __VA_ARGS__)
 
 using namespace mozilla;
@@ -1876,20 +1877,46 @@ TabChild::CancelCachedFileDescriptorCall
 }
 
 void
 TabChild::DoFakeShow(const ScrollingBehavior& aScrolling,
                      const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                      const uint64_t& aLayersId,
                      PRenderFrameChild* aRenderFrame)
 {
-  RecvShow(nsIntSize(0, 0), aScrolling, aTextureFactoryIdentifier, aLayersId, aRenderFrame);
+  ShowInfo info(EmptyString(), false, false);
+  RecvShow(nsIntSize(0, 0), info, aScrolling, aTextureFactoryIdentifier, aLayersId, aRenderFrame);
   mDidFakeShow = true;
 }
 
+void
+TabChild::ApplyShowInfo(const ShowInfo& aInfo)
+{
+  nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
+  if (docShell) {
+    nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
+    item->SetName(aInfo.name());
+    docShell->SetFullscreenAllowed(aInfo.fullscreenAllowed());
+    if (aInfo.isPrivate()) {
+      bool nonBlank;
+      docShell->GetHasLoadedNonBlankURI(&nonBlank);
+      if (nonBlank) {
+        nsContentUtils::ReportToConsoleNonLocalized(
+          NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
+          nsIScriptError::warningFlag,
+          NS_LITERAL_CSTRING("mozprivatebrowsing"),
+          nullptr);
+      } else {
+        nsCOMPtr<nsILoadContext> context = do_GetInterface(docShell);
+        context->SetUsePrivateBrowsing(true);
+      }
+    }
+  }
+}
+
 #ifdef MOZ_WIDGET_GONK
 void
 TabChild::MaybeRequestPreinitCamera()
 {
     // Check if this tab will use the `camera` permission.
     nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
     if (NS_WARN_IF(!appsService)) {
       return;
@@ -1940,24 +1967,26 @@ TabChild::MaybeRequestPreinitCamera()
     }
 
     observerService->NotifyObservers(nullptr, "init-camera-hw", nullptr);
 }
 #endif
 
 bool
 TabChild::RecvShow(const nsIntSize& aSize,
+                   const ShowInfo& aInfo,
                    const ScrollingBehavior& aScrolling,
                    const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                    const uint64_t& aLayersId,
                    PRenderFrameChild* aRenderFrame)
 {
     MOZ_ASSERT((!mDidFakeShow && aRenderFrame) || (mDidFakeShow && !aRenderFrame));
 
     if (mDidFakeShow) {
+        ApplyShowInfo(aInfo);
         return true;
     }
 
     nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(WebNavigation());
     if (!baseWindow) {
         NS_ERROR("WebNavigation() doesn't QI to nsIBaseWindow");
         return false;
     }
@@ -1971,17 +2000,19 @@ TabChild::RecvShow(const nsIntSize& aSiz
     }
 
     baseWindow->SetVisibility(true);
 
 #ifdef MOZ_WIDGET_GONK
     MaybeRequestPreinitCamera();
 #endif
 
-    return InitTabChildGlobal();
+    bool res = InitTabChildGlobal();
+    ApplyShowInfo(aInfo);
+    return res;
 }
 
 bool
 TabChild::RecvUpdateDimensions(const nsIntRect& rect, const nsIntSize& size, const ScreenOrientation& orientation)
 {
     if (!mRemoteFrame) {
         return true;
     }
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -312,16 +312,17 @@ public:
                                          const ViewID& aViewId,
                                          const bool& aIsRoot,
                                          const ZoomConstraints& aConstraints) MOZ_OVERRIDE;
     virtual bool RecvLoadURL(const nsCString& uri) MOZ_OVERRIDE;
     virtual bool RecvCacheFileDescriptor(const nsString& aPath,
                                          const FileDescriptor& aFileDescriptor)
                                          MOZ_OVERRIDE;
     virtual bool RecvShow(const nsIntSize& aSize,
+                          const ShowInfo& aInfo,
                           const ScrollingBehavior& aScrolling,
                           const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                           const uint64_t& aLayersId,
                           PRenderFrameChild* aRenderFrame) MOZ_OVERRIDE;
     virtual bool RecvUpdateDimensions(const nsIntRect& rect,
                                       const nsIntSize& size,
                                       const ScreenOrientation& orientation) MOZ_OVERRIDE;
     virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
@@ -547,16 +548,18 @@ private:
     void SetProcessNameToAppName();
 
     // Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
     void DoFakeShow(const ScrollingBehavior& aScrolling,
                     const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                     const uint64_t& aLayersId,
                     PRenderFrameChild* aRenderFrame);
 
+    void ApplyShowInfo(const ShowInfo& aInfo);
+
     // These methods are used for tracking synthetic mouse events
     // dispatched for compatibility.  On each touch event, we
     // UpdateTapState().  If we've detected that the current gesture
     // isn't a tap, then we CancelTapTracking().  In the meantime, we
     // may detect a context-menu event, and if so we
     // FireContextMenuEvent().
     void FireContextMenuEvent();
     void CancelTapTracking();
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -595,17 +595,29 @@ TabParent::Show(const nsIntSize& size)
                                     scrolling,
                                     &textureFactoryIdentifier,
                                     &layersId,
                                     &success);
           MOZ_ASSERT(success);
           unused << SendPRenderFrameConstructor(renderFrame);
         }
     }
-    unused << SendShow(size, scrolling, textureFactoryIdentifier, layersId, renderFrame);
+
+    ShowInfo info(EmptyString(), false, false);
+    if (mFrameElement) {
+      nsAutoString name;
+      mFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
+      bool allowFullscreen =
+        mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
+        mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen);
+      bool isPrivate = mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
+      info = ShowInfo(name, allowFullscreen, isPrivate);
+    }
+
+    unused << SendShow(size, info, scrolling, textureFactoryIdentifier, layersId, renderFrame);
 }
 
 void
 TabParent::UpdateDimensions(const nsIntRect& rect, const nsIntSize& size)
 {
   if (mIsDestroyed) {
     return;
   }
--- a/dom/nfc/NfcContentHelper.js
+++ b/dom/nfc/NfcContentHelper.js
@@ -126,31 +126,16 @@ NfcContentHelper.prototype = {
         type: record.type || undefined,
         id: record.id || undefined,
         payload: record.payload || undefined,
       });
     }
     return encodedRecords;
   },
 
-  // NFC interface:
-  checkSessionToken: function checkSessionToken(sessionToken, isP2P) {
-    if (sessionToken == null) {
-      throw Components.Exception("No session token!",
-                                  Cr.NS_ERROR_UNEXPECTED);
-      return false;
-    }
-    // Report session to Nfc.js only.
-    let val = cpmm.sendSyncMessage("NFC:CheckSessionToken", {
-      sessionToken: sessionToken,
-      isP2P: isP2P
-    });
-    return (val[0] === NFC.NFC_GECKO_SUCCESS);
-  },
-
   // NFCTag interface
   readNDEF: function readNDEF(sessionToken, callback) {
     let requestId = callback.getCallbackId();
     this._requestMap[requestId] = callback;
 
     cpmm.sendAsyncMessage("NFC:ReadNDEF", {
       requestId: requestId,
       sessionToken: sessionToken
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -49,35 +49,31 @@ function updateDebug() {
   }
 };
 updateDebug();
 
 const NFC_CONTRACTID = "@mozilla.org/nfc;1";
 const NFC_CID =
   Components.ID("{2ff24790-5e74-11e1-b86c-0800200c9a66}");
 
-const NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES = [
-  "NFC:AddEventListener"
-];
-
 const NFC_IPC_MSG_NAMES = [
-  "NFC:CheckSessionToken",
+  "NFC:AddEventListener",
   "NFC:QueryInfo"
 ];
 
-const NFC_IPC_READ_PERM_MSG_NAMES = [
+const NFC_IPC_NFC_PERM_MSG_NAMES = [
   "NFC:ReadNDEF",
   "NFC:Connect",
   "NFC:Close",
-];
-
-const NFC_IPC_WRITE_PERM_MSG_NAMES = [
   "NFC:WriteNDEF",
   "NFC:MakeReadOnly",
   "NFC:Format",
+];
+
+const NFC_IPC_NFC_SHARE_PERM_MSG_NAMES = [
   "NFC:SendFile",
   "NFC:RegisterPeerReadyTarget",
   "NFC:UnregisterPeerReadyTarget"
 ];
 
 const NFC_IPC_MANAGER_PERM_MSG_NAMES = [
   "NFC:CheckP2PRegistration",
   "NFC:NotifyUserAcceptedP2P",
@@ -126,53 +122,45 @@ XPCOMUtils.defineLazyGetter(this, "gMess
       Services.obs.removeObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED);
       Services.obs.removeObserver(this, NFC.TOPIC_XPCOM_SHUTDOWN);
       this._unregisterMessageListeners();
     },
 
     _registerMessageListeners: function _registerMessageListeners() {
       ppmm.addMessageListener("child-process-shutdown", this);
 
-      for (let message of NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES) {
-        ppmm.addMessageListener(message, this);
-      }
-
       for (let message of NFC_IPC_MSG_NAMES) {
         ppmm.addMessageListener(message, this);
       }
 
-      for (let message of NFC_IPC_READ_PERM_MSG_NAMES) {
+      for (let message of NFC_IPC_NFC_PERM_MSG_NAMES) {
         ppmm.addMessageListener(message, this);
       }
 
-      for (let message of NFC_IPC_WRITE_PERM_MSG_NAMES) {
+      for (let message of NFC_IPC_NFC_SHARE_PERM_MSG_NAMES) {
         ppmm.addMessageListener(message, this);
       }
 
       for (let message of NFC_IPC_MANAGER_PERM_MSG_NAMES) {
         ppmm.addMessageListener(message, this);
       }
     },
 
     _unregisterMessageListeners: function _unregisterMessageListeners() {
       ppmm.removeMessageListener("child-process-shutdown", this);
 
-      for (let message of NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES) {
-        ppmm.removeMessageListener(message, this);
-      }
-
       for (let message of NFC_IPC_MSG_NAMES) {
         ppmm.removeMessageListener(message, this);
       }
 
-      for (let message of NFC_IPC_READ_PERM_MSG_NAMES) {
+      for (let message of NFC_IPC_NFC_PERM_MSG_NAMES) {
         ppmm.removeMessageListener(message, this);
       }
 
-      for (let message of NFC_IPC_WRITE_PERM_MSG_NAMES) {
+      for (let message of NFC_IPC_NFC_SHARE_PERM_MSG_NAMES) {
         ppmm.removeMessageListener(message, this);
       }
 
       for (let message of NFC_IPC_MANAGER_PERM_MSG_NAMES) {
         ppmm.removeMessageListener(message, this);
       }
 
       ppmm = null;
@@ -285,29 +273,28 @@ XPCOMUtils.defineLazyGetter(this, "gMess
 
       if (message.name == "child-process-shutdown") {
         this.removePeerTarget(message.target);
         this.nfc.removeTarget(message.target);
         this.removeEventListener(message.target);
         return null;
       }
 
-      if (NFC_IPC_MSG_NAMES.indexOf(message.name) != -1 ||
-          NFC_IPC_ADD_EVENT_TARGET_MSG_NAMES.indexOf(message.name) != -1 ) {
+      if (NFC_IPC_MSG_NAMES.indexOf(message.name) != -1) {
         // Do nothing.
-      } else if (NFC_IPC_READ_PERM_MSG_NAMES.indexOf(message.name) != -1) {
-        if (!message.target.assertPermission("nfc-read")) {
-          debug("Nfc message " + message.name +
-                " from a content process with no 'nfc-read' privileges.");
+      } else if (NFC_IPC_NFC_PERM_MSG_NAMES.indexOf(message.name) != -1) {
+        if (!message.target.assertPermission("nfc")) {
+          debug("Nfc Peer message  " + message.name +
+                " from a content process with no 'nfc' privileges.");
           return null;
         }
-      } else if (NFC_IPC_WRITE_PERM_MSG_NAMES.indexOf(message.name) != -1) {
-        if (!message.target.assertPermission("nfc-write")) {
+      } else if (NFC_IPC_NFC_SHARE_PERM_MSG_NAMES.indexOf(message.name) != -1) {
+        if (!message.target.assertPermission("nfc-share")) {
           debug("Nfc Peer message  " + message.name +
-                " from a content process with no 'nfc-write' privileges.");
+                " from a content process with no 'nfc-share' privileges.");
           return null;
         }
       } else if (NFC_IPC_MANAGER_PERM_MSG_NAMES.indexOf(message.name) != -1) {
         if (!message.target.assertPermission("nfc-manager")) {
           debug("NFC message " + message.name +
                 " from a content process with no 'nfc-manager' privileges.");
           return null;
         }
@@ -315,38 +302,33 @@ XPCOMUtils.defineLazyGetter(this, "gMess
         debug("Ignoring unknown message type: " + message.name);
         return null;
       }
 
       switch (message.name) {
         case "NFC:AddEventListener":
           this.addEventListener(message.target);
           return null;
-        case "NFC:CheckSessionToken":
-          let sessionToken = message.data.sessionToken;
-          return SessionHelper.isValidToken(sessionToken, message.data.isP2P) ?
-                   NFC.NFC_GECKO_SUCCESS :
-                   NFC.NFC_GECKO_ERROR_BAD_SESSION_TOKEN;
         case "NFC:RegisterPeerReadyTarget":
           this.registerPeerReadyTarget(message.target, message.data.appId);
           return null;
         case "NFC:UnregisterPeerReadyTarget":
           this.unregisterPeerReadyTarget(message.data.appId);
           return null;
         case "NFC:CheckP2PRegistration":
           this.checkP2PRegistration(message);
           return null;
         case "NFC:NotifyUserAcceptedP2P":
           this.notifyUserAcceptedP2P(message.data.appId);
           return null;
         case "NFC:NotifySendFileStatus":
           // Upon receiving the status of sendFile operation, send the response
           // to appropriate content process.
           message.data.type = "NotifySendFileStatusResponse";
-          if (message.data.status !== NFC.NFC_SUCCESS) {
+          if (message.data.status) {
             message.data.errorMsg =
               this.nfc.getErrorMessage(NFC.NFC_GECKO_ERROR_SEND_FILE_FAILED);
           }
           this.nfc.sendNfcResponse(message.data);
           return null;
         default:
           return this.nfc.receiveMessage(message);
       }
@@ -416,27 +398,16 @@ let SessionHelper = {
       }
     }
 
     return 0;
   },
 
   isP2PSession: function isP2PSession(id) {
     return (this.tokenMap[id] != null) && this.tokenMap[id].isP2P;
-  },
-
-  isValidToken: function isValidToken(token, isP2P) {
-    for (let id in this.tokenMap) {
-      if ((this.tokenMap[id].token == token) &&
-          (this.tokenMap[id].isP2P == isP2P)) {
-        return true;
-      }
-    }
-
-    return false;
   }
 };
 
 function Nfc() {
   debug("Starting Nfc Service");
 
   let nfcService = Cc["@mozilla.org/nfc/service;1"].getService(Ci.nsINfcService);
   if (!nfcService) {
@@ -506,18 +477,17 @@ Nfc.prototype = {
     }
 
     let nfcMsgType = message.name + "Response";
     message.data.errorMsg = this.getErrorMessage(errorCode);
     message.target.sendAsyncMessage(nfcMsgType, message.data);
   },
 
   getErrorMessage: function getErrorMessage(errorCode) {
-    return NFC.NFC_ERROR_MSG[errorCode] ||
-           NFC.NFC_ERROR_MSG[NFC.NFC_GECKO_ERROR_GENERIC_FAILURE];
+    return NFC.NFC_ERROR_MSG[errorCode];
   },
 
   /**
    * Process the incoming message from the NFC Service.
    */
   onEvent: function onEvent(event) {
     let message = Cu.cloneInto(event, this);
     DEBUG && debug("Received message from NFC Service: " + JSON.stringify(message));
--- a/dom/nfc/gonk/nfc_consts.js
+++ b/dom/nfc/gonk/nfc_consts.js
@@ -18,27 +18,22 @@
 // Set to true to debug all NFC layers
 this.DEBUG_ALL = false;
 
 // Set individually to debug specific layers
 this.DEBUG_CONTENT_HELPER = DEBUG_ALL || false;
 this.DEBUG_NFC = DEBUG_ALL || false;
 
 // Gecko specific error codes
-this.NFC_GECKO_SUCCESS = 0;
-this.NFC_GECKO_ERROR_GENERIC_FAILURE = 1;
-this.NFC_GECKO_ERROR_P2P_REG_INVALID = 2;
-this.NFC_GECKO_ERROR_SEND_FILE_FAILED = 3;
-this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN = 4;
+this.NFC_GECKO_ERROR_P2P_REG_INVALID = 1;
+this.NFC_GECKO_ERROR_SEND_FILE_FAILED = 2;
 
 this.NFC_ERROR_MSG = {};
-this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_GENERIC_FAILURE] = "NfcGenericFailureError";
 this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_P2P_REG_INVALID] = "NfcP2PRegistrationInvalid";
 this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_SEND_FILE_FAILED] = "NfcSendFileFailed";
-this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN] = "NfcBadSessionToken";
 
 this.NFC_RF_STATE_IDLE = "idle";
 this.NFC_RF_STATE_LISTEN = "listen";
 this.NFC_RF_STATE_DISCOVERY = "discovery";
 
 this.TOPIC_MOZSETTINGS_CHANGED      = "mozsettings-changed";
 this.TOPIC_XPCOM_SHUTDOWN           = "xpcom-shutdown";
 
--- a/dom/nfc/nsINfcContentHelper.idl
+++ b/dom/nfc/nsINfcContentHelper.idl
@@ -82,23 +82,21 @@ interface nsINfcRequestCallback : nsISup
 
   void notifySuccessWithBoolean(in boolean result);
 
   void notifySuccessWithNDEFRecords(in nsIVariant records);
 
   void notifyError(in DOMString errorMsg);
 };
 
-[scriptable, uuid(bcf214de-885b-43e6-9e53-9b7d880e1633)]
+[scriptable, uuid(c5fdf956-735e-45d3-aa25-3a871bd3e2f8)]
 interface nsINfcContentHelper : nsISupports
 {
   void init(in nsIDOMWindow window);
 
-  boolean checkSessionToken(in DOMString sessionToken, in boolean isP2P);
-
   /**
    * Read current NDEF data on the tag.
    *
    * @param sessionToken
    *        Current token
    *
    * @param callback
    *        Called when request is finished
--- a/dom/nfc/nsNfc.js
+++ b/dom/nfc/nsNfc.js
@@ -327,33 +327,16 @@ MozNFCImpl.prototype = {
   },
 
   powerOff: function powerOff() {
     let callback = new NfcCallback(this._window);
     this._nfcContentHelper.changeRFState(this.rfState.IDLE, callback);
     return callback.promise;
   },
 
-  _createNFCPeer: function _createNFCPeer(sessionToken) {
-    let peer = new MozNFCPeerImpl(this._window, sessionToken);
-    return this._window.MozNFCPeer._create(this._window, peer);
-  },
-
-  getNFCPeer: function getNFCPeer(sessionToken) {
-    if (!sessionToken || !this._nfcContentHelper.checkSessionToken(sessionToken, true)) {
-      return null;
-    }
-
-    if (!this.nfcPeer || this.nfcPeer.session != sessionToken) {
-      this.nfcPeer = this._createNFCPeer(sessionToken);
-    }
-
-    return this.nfcPeer;
-  },
-
   defineEventHandlerGetterSetter: function defineEventHandlerGetterSetter(name) {
     Object.defineProperty(this, name, {
       get: function get() {
         return this.__DOM_IMPL__.getEventHandler(name);
       },
       set: function set(handler) {
         this.__DOM_IMPL__.setEventHandler(name, handler);
       }
@@ -384,17 +367,17 @@ MozNFCImpl.prototype = {
       return;
     }
 
     if (!this.eventService.hasListenersFor(this.__DOM_IMPL__, "tagfound")) {
       debug("ontagfound is not registered.");
       return;
     }
 
-    if (!this.checkPermissions(["nfc-read", "nfc-write"])) {
+    if (!this.checkPermissions(["nfc"])) {
       return;
     }
 
     this.eventService.addSystemEventListener(this._window, "visibilitychange",
       this, /* useCapture */false);
 
     let tagImpl = new MozNFCTagImpl(this._window, sessionToken, event);
     let tag = this._window.MozNFCTag._create(this._window, tagImpl);
@@ -421,17 +404,17 @@ MozNFCImpl.prototype = {
   },
 
   notifyTagLost: function notifyTagLost(sessionToken) {
     if (this.hasDeadWrapper()) {
       dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
       return;
     }
 
-    if (!this.checkPermissions(["nfc-read", "nfc-write"])) {
+    if (!this.checkPermissions(["nfc"])) {
       return;
     }
 
     if (!this.nfcTag) {
       debug("No NFCTag object existing.");
       return;
     }
 
@@ -456,39 +439,41 @@ MozNFCImpl.prototype = {
     }
 
     if (!isPeerReady &&
         !this.eventService.hasListenersFor(this.__DOM_IMPL__, "peerfound")) {
       debug("onpeerfound is not registered.");
       return;
     }
 
-    if (!this.checkPermissions(["nfc-write"])) {
+    let perm = isPeerReady ? ["nfc-share"] : ["nfc"];
+    if (!this.checkPermissions(perm)) {
       return;
     }
 
     this.eventService.addSystemEventListener(this._window, "visibilitychange",
       this, /* useCapture */false);
 
-    this.nfcPeer = this._createNFCPeer(sessionToken);
+    let peerImpl = new MozNFCPeerImpl(this._window, sessionToken);
+    this.nfcPeer = this._window.MozNFCPeer._create(this._window, peerImpl)
     let eventData = { "peer": this.nfcPeer };
     let type = (isPeerReady) ? "peerready" : "peerfound";
 
     debug("fire on" + type + " " + sessionToken);
     let event = new this._window.MozNFCPeerEvent(type, eventData);
     this.__DOM_IMPL__.dispatchEvent(event);
   },
 
   notifyPeerLost: function notifyPeerLost(sessionToken) {
     if (this.hasDeadWrapper()) {
       dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
       return;
     }
 
-    if (!this.checkPermissions(["nfc-write"])) {
+    if (!this.checkPermissions(["nfc", "nfc-share"])) {
       return;
     }
 
     if (!this.nfcPeer) {
       debug("No NFCPeer object existing.");
       return;
     }
 
--- a/dom/nfc/tests/marionette/test_nfc_checkP2PRegistration.js
+++ b/dom/nfc/tests/marionette/test_nfc_checkP2PRegistration.js
@@ -141,16 +141,16 @@ let tests = [
   testWithSessionTokenWithTarget,
   testWithSessionTokenNoTarget,
   testWithSessionTokenWrongTarget
 ];
 
 /**
  * nfc-manager for mozNfc.checkP2PRegistration(manifestUrl)
  *  -> "NFC:CheckP2PRegistration" IPC
- * nfc-write to set/unset onpeerready
+ * nfc-share to set/unset onpeerready
  *  -> "NFC:RegisterPeerTarget", "NFC:UnregisterPeerTarget" IPC
  */
 SpecialPowers.pushPermissions(
   [
     {'type': 'nfc-manager', 'allow': true, context: document},
-    {'type': 'nfc-write', 'allow': true, context: document}
+    {'type': 'nfc-share', 'allow': true, context: document}
   ], runTests);
--- a/dom/nfc/tests/marionette/test_nfc_error_messages.js
+++ b/dom/nfc/tests/marionette/test_nfc_error_messages.js
@@ -141,16 +141,16 @@ let tests = [
   testNfcNotEnabledError,
   testNfcBadSessionIdError,
   testNoErrorInTechMsg
 ];
 
 /**
  * nfc-manager for mozNfc.checkP2PRegistration(manifestUrl)
  *  -> "NFC:CheckP2PRegistration" IPC
- * nfc-write to set/unset onpeerready
+ * nfc-share to set/unset onpeerready
  *  -> "NFC:RegisterPeerTarget", "NFC:UnregisterPeerTarget" IPC
  */
 SpecialPowers.pushPermissions(
   [
     {'type': 'nfc-manager', 'allow': true, context: document},
-    {'type': 'nfc-write', 'allow': true, context: document}
+    {'type': 'nfc-share', 'allow': true, context: document}
   ], runTests);
--- a/dom/nfc/tests/marionette/test_nfc_peer.js
+++ b/dom/nfc/tests/marionette/test_nfc_peer.js
@@ -61,20 +61,17 @@ function handleTechnologyDiscoveredRE0Fo
 function testPeerReady() {
   sysMsgHelper.waitForTechDiscovered(handleTechnologyDiscoveredRE0);
 
   toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 function testGetNFCPeer() {
   sysMsgHelper.waitForTechDiscovered(function (msg) {
-    let peer = nfc.getNFCPeer(msg.sessionToken);
-    ok(peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
-    let peer1 = nfc.getNFCPeer(msg.sessionToken);
-    ok(peer == peer1, "Should get the same MozNFCPeer object");
+    ok(msg.peer instanceof MozNFCPeer, "Should get a NFCPeer object.");
 
     NCI.deactivate().then(() => toggleNFC(false)).then(runNextTest);
   });
 
   toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
 function testCheckP2PRegFailure() {
@@ -176,29 +173,22 @@ function testPeerShouldThrow() {
     log("testPeerShouldThrow techDiscovered");
     nfc.notifyUserAcceptedP2P(MANIFEST_URL);
   });
 
   toggleNFC(true)
     .then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
-function testPeerInvalidToken() {
-  log("testPeerInvalidToken");
-  let peer = nfc.getNFCPeer("fakeSessionToken");
-  is(peer, null, "NFCPeer should be null on wrong session token");
-
-  runNextTest();
-}
-
 let tests = [
   testPeerReady,
   testGetNFCPeer,
   testCheckP2PRegFailure,
   testPeerLostShouldBeCalled,
   testPeerLostShouldNotBeCalled,
-  testPeerShouldThrow,
-  testPeerInvalidToken
+  testPeerShouldThrow
 ];
 
 SpecialPowers.pushPermissions(
   [{"type": "nfc-manager", "allow": true, context: document},
-   {"type": "nfc-write", "allow": true, context: document}], runTests);
+   {"type": "nfc", "allow": true, context: document},
+   {"type": "nfc-share", "allow": true, context: document}], runTests);
+
--- a/dom/nfc/tests/marionette/test_nfc_peer_sendFile.js
+++ b/dom/nfc/tests/marionette/test_nfc_peer_sendFile.js
@@ -3,18 +3,17 @@
 
 MARIONETTE_TIMEOUT = 30000;
 MARIONETTE_HEAD_JS = "head.js";
 
 let MANIFEST_URL = "app://system.gaiamobile.org/manifest.webapp";
 
 function sendFile(msg) {
   log("sendFile msg="+JSON.stringify(msg));
-  let peer = nfc.getNFCPeer(msg.sessionToken);
-  ok(peer instanceof MozNFCPeer, "should get a MozNFCPeer");
+  ok(msg.peer instanceof MozNFCPeer, "should get a MozNFCPeer");
   ok(msg.blob instanceof Blob, "should get a Blob");
 
   nfc.peerready = null;
   NCI.deactivate().then(() => toggleNFC(false)).then(runNextTest);
 }
 
 function testSendFile() {
   nfc.onpeerready = function(evt) {
--- a/dom/nfc/tests/marionette/test_nfc_peer_sendndef.js
+++ b/dom/nfc/tests/marionette/test_nfc_peer_sendndef.js
@@ -1,23 +1,22 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 30000;
 MARIONETTE_HEAD_JS = "head.js";
 
 let url = "https://www.example.com";
 
-function sendNDEF(techType, sessionToken) {
+function sendNDEF(techType, peer) {
   let tnf = NDEF.TNF_WELL_KNOWN;
   let type = new Uint8Array(NfcUtils.fromUTF8("U"));
   let payload = new Uint8Array(NfcUtils.fromUTF8(url));
   let ndef = [new MozNDEFRecord({tnf: tnf, type: type, payload: payload})];
 
-  let peer = window.navigator.mozNfc.getNFCPeer(sessionToken);
   let promise = peer.sendNDEF(ndef);
   promise.then(() => {
     log("Successfully sent NDEF message");
 
     let cmd = "nfc snep put -1 -1"; /* read last SNEP PUT from emulator */
     log("Executing \'" + cmd + "\'");
     emulator.run(cmd, function(result) {
       is(result.pop(), "OK", "check SNEP PUT result");
@@ -30,17 +29,17 @@ function sendNDEF(techType, sessionToken
   });
 }
 
 function handleTechnologyDiscoveredRE0(msg) {
   log("Received \'nfc-manager-tech-discovered\' " + JSON.stringify(msg));
   is(msg.type, "techDiscovered", "check for correct message type");
   let index = msg.techList.indexOf("P2P");
   isnot(index, -1, "check for \'P2P\' in tech list");
-  sendNDEF(msg.techList[index], msg.sessionToken);
+  sendNDEF(msg.techList[index], msg.peer);
 }
 
 function testOnPeerReadyRE0() {
   log("Running \'testOnPeerReadyRE0\'");
   sysMsgHelper.waitForTechDiscovered(handleTechnologyDiscoveredRE0);
   toggleNFC(true).then(() => NCI.activateRE(emulator.P2P_RE_INDEX_0));
 }
 
--- a/dom/system/gonk/SystemWorkerManager.cpp
+++ b/dom/system/gonk/SystemWorkerManager.cpp
@@ -125,17 +125,17 @@ SystemWorkerManager::Shutdown()
   nsCOMPtr<nsIWifi> wifi(do_QueryInterface(mWifiWorker));
   if (wifi) {
     wifi->Shutdown();
     wifi = nullptr;
   }
   mWifiWorker = nullptr;
 
   if (mKeyStore) {
-    mKeyStore->CloseSocket();
+    mKeyStore->Shutdown();
     mKeyStore = nullptr;
   }
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (obs) {
     obs->RemoveObserver(this, WORKERS_SHUTDOWN_TOPIC);
   }
 }
--- a/dom/webidl/MozNFC.webidl
+++ b/dom/webidl/MozNFC.webidl
@@ -24,22 +24,16 @@ enum NfcErrorMessage {
   "NotSupport",
   "FailEnableLowPowerMode",
   "FailDisableLowPowerMode"
 };
 
 [NoInterfaceObject]
 interface MozNFCManager {
   /**
-   * Returns MozNFCPeer object or null in case of invalid sessionToken
-   */
-   [CheckPermissions="nfc-manager"]
-  MozNFCPeer? getNFCPeer(DOMString sessionToken);
-
-  /**
    * API to check if the given application's manifest
    * URL is registered with the Chrome Process or not.
    *
    * Returns success if given manifestUrl is registered for 'onpeerready',
    * otherwise error
    */
   [CheckPermissions="nfc-manager"]
   Promise<boolean> checkP2PRegistration(DOMString manifestUrl);
@@ -73,50 +67,46 @@ interface MozNFCManager {
    */
   [CheckPermissions="nfc-manager"]
   Promise<void> powerOff();
 };
 
 [JSImplementation="@mozilla.org/navigatorNfc;1",
  NavigatorProperty="mozNfc",
  Func="Navigator::HasNFCSupport",
- CheckPermissions="nfc-read nfc-write",
+ CheckPermissions="nfc nfc-share",
  AvailableIn="CertifiedApps"]
 interface MozNFC : EventTarget {
   /**
    * This event will be fired when another NFCPeer is detected, and user confirms
    * to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P.
    * The event will be type of NFCPeerEvent.
    */
-  [CheckPermissions="nfc-write"]
+  [CheckPermissions="nfc-share"]
   attribute EventHandler onpeerready;
 
   /**
    * This event will be fired when a NFCPeer is detected.
    */
-  [CheckPermissions="nfc-write"]
   attribute EventHandler onpeerfound;
 
   /**
    * This event will be fired when NFCPeer, earlier detected in onpeerready
    * or onpeerfound, moves out of range.
    */
-  [CheckPermissions="nfc-write"]
   attribute EventHandler onpeerlost;
 
   /**
    * Ths event will be fired when a NFCTag is detected.
    */
-  [CheckPermissions="nfc-read nfc-write"]
   attribute EventHandler ontagfound;
 
   /**
    * This event will be fired if the tag detected in ontagfound has been removed.
    */
-  [CheckPermissions="nfc-read nfc-write"]
   attribute EventHandler ontaglost;
 };
 
 // Mozilla Only
 partial interface MozNFC {
   [ChromeOnly]
   void eventListenerWasAdded(DOMString aType);
   [ChromeOnly]
--- a/dom/webidl/MozNFCPeer.webidl
+++ b/dom/webidl/MozNFCPeer.webidl
@@ -14,17 +14,17 @@ interface MozNFCPeer {
    * Send NDEF data to peer device.
    */
   [Throws]
   Promise<void> sendNDEF(sequence<MozNDEFRecord> records);
 
   /**
    * Send file to peer device.
    */
-  [Throws]
+  [Throws, CheckPermissions="nfc-share"]
   Promise<void> sendFile(Blob blob);
 };
 
 // Mozilla Only
 partial interface MozNFCPeer {
   [ChromeOnly]
   attribute DOMString session;
 
--- a/dom/webidl/MozNFCPeerEvent.webidl
+++ b/dom/webidl/MozNFCPeerEvent.webidl
@@ -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/.
  */
 
 [Constructor(DOMString type, optional MozNFCPeerEventInit eventInitDict),
- Func="Navigator::HasNFCSupport", CheckPermissions="nfc-write",
+ Func="Navigator::HasNFCSupport", CheckPermissions="nfc nfc-share",
  AvailableIn="CertifiedApps"]
 interface MozNFCPeerEvent : Event
 {
   /**
    * The detected NFCPeer.
    */
   readonly attribute MozNFCPeer? peer;
 };
--- a/dom/webidl/MozNFCTagEvent.webidl
+++ b/dom/webidl/MozNFCTagEvent.webidl
@@ -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/.
  */
 
 [Constructor(DOMString type, optional MozNFCTagEventInit eventInitDict),
- Func="Navigator::HasNFCSupport", CheckPermissions="nfc-read nfc-write",
+ Func="Navigator::HasNFCSupport", CheckPermissions="nfc",
  AvailableIn="CertifiedApps"]
 interface MozNFCTagEvent : Event
 {
   /**
    * The detected NFCTag.
    */
   readonly attribute MozNFCTag? tag;
 
--- a/ipc/keystore/KeyStore.cpp
+++ b/ipc/keystore/KeyStore.cpp
@@ -1,10 +1,10 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=4 ts=8 et ft=cpp: */
+/* vim: set sw=2 ts=2 et ft=cpp: tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <fcntl.h>
 #include <limits.h>
 #include <pwd.h>
 #include <sys/stat.h>
@@ -364,39 +364,150 @@ KeyStoreConnector::SetUpListenSocket(int
 void
 KeyStoreConnector::GetSocketAddr(const sockaddr_any& aAddr,
                                  nsAString& aAddrStr)
 {
   // Unused.
   MOZ_CRASH("This should never be called!");
 }
 
+//
+// KeyStore::ListenSocket
+//
+
+KeyStore::ListenSocket::ListenSocket(KeyStore* aKeyStore)
+: mKeyStore(aKeyStore)
+{
+  MOZ_ASSERT(mKeyStore);
+
+  MOZ_COUNT_CTOR(KeyStore::ListenSocket);
+}
+
+void
+KeyStore::ListenSocket::OnConnectSuccess()
+{
+  mKeyStore->OnConnectSuccess(LISTEN_SOCKET);
+
+  MOZ_COUNT_DTOR(KeyStore::ListenSocket);
+}
+
+void
+KeyStore::ListenSocket::OnConnectError()
+{
+  mKeyStore->OnConnectError(LISTEN_SOCKET);
+}
+
+void
+KeyStore::ListenSocket::OnDisconnect()
+{
+  mKeyStore->OnDisconnect(LISTEN_SOCKET);
+}
+
+//
+// KeyStore::StreamSocket
+//
+
+KeyStore::StreamSocket::StreamSocket(KeyStore* aKeyStore)
+: mKeyStore(aKeyStore)
+{
+  MOZ_ASSERT(mKeyStore);
+
+  MOZ_COUNT_CTOR(KeyStore::StreamSocket);
+}
+
+KeyStore::StreamSocket::~StreamSocket()
+{
+  MOZ_COUNT_DTOR(KeyStore::StreamSocket);
+}
+
+void
+KeyStore::StreamSocket::OnConnectSuccess()
+{
+  mKeyStore->OnConnectSuccess(STREAM_SOCKET);
+}
+
+void
+KeyStore::StreamSocket::OnConnectError()
+{
+  mKeyStore->OnConnectError(STREAM_SOCKET);
+}
+
+void
+KeyStore::StreamSocket::OnDisconnect()
+{
+  mKeyStore->OnDisconnect(STREAM_SOCKET);
+}
+
+void
+KeyStore::StreamSocket::ReceiveSocketData(
+  nsAutoPtr<UnixSocketRawData>& aMessage)
+{
+  mKeyStore->ReceiveSocketData(aMessage);
+}
+
+ConnectionOrientedSocketIO*
+KeyStore::StreamSocket::GetIO()
+{
+  return PrepareAccept(new KeyStoreConnector());
+}
+
+//
+// KeyStore
+//
+
 KeyStore::KeyStore()
+: mShutdown(false)
 {
   MOZ_COUNT_CTOR(KeyStore);
   ::startKeyStoreService();
   Listen();
 }
 
 KeyStore::~KeyStore()
 {
   MOZ_COUNT_DTOR(KeyStore);
+
+  MOZ_ASSERT(!mListenSocket);
+  MOZ_ASSERT(!mStreamSocket);
 }
 
 void
 KeyStore::Shutdown()
 {
+  // We set mShutdown first, so that |OnDisconnect| won't try to reconnect.
   mShutdown = true;
-  CloseSocket();
+
+  if (mStreamSocket) {
+    mStreamSocket->Close();
+    mStreamSocket = nullptr;
+  }
+  if (mListenSocket) {
+    mListenSocket->Close();
+    mListenSocket = nullptr;
+  }
 }
 
 void
 KeyStore::Listen()
 {
-  ListenSocket(new KeyStoreConnector());
+  // We only allocate one |StreamSocket|, but re-use it for every connection.
+  if (mStreamSocket) {
+    mStreamSocket->Close();
+  } else {
+    mStreamSocket = new StreamSocket(this);
+  }
+
+  if (!mListenSocket) {
+    // We only ever allocate one |ListenSocket|...
+    mListenSocket = new ListenSocket(this);
+    mListenSocket->Listen(new KeyStoreConnector(), mStreamSocket);
+  } else {
+    // ... but keep it open.
+    mListenSocket->Listen(mStreamSocket);
+  }
 
   ResetHandlerInfo();
 }
 
 void
 KeyStore::ResetHandlerInfo()
 {
   mHandlerInfo.state = STATE_IDLE;
@@ -507,35 +618,39 @@ KeyStore::ReadData(UnixSocketRawData *aM
 
   return SUCCESS;
 }
 
 // Status response
 void
 KeyStore::SendResponse(ResponseCode aResponse)
 {
+  MOZ_ASSERT(mStreamSocket);
+
   if (aResponse == NO_RESPONSE)
     return;
 
   uint8_t response = (uint8_t)aResponse;
   UnixSocketRawData* data = new UnixSocketRawData((const void *)&response, 1);
-  SendSocketData(data);
+  mStreamSocket->SendSocketData(data);
 }
 
 // Data response
 void
 KeyStore::SendData(const uint8_t *aData, int aLength)
 {
+  MOZ_ASSERT(mStreamSocket);
+
   unsigned short dataLength = htons(aLength);
 
   UnixSocketRawData* length = new UnixSocketRawData((const void *)&dataLength, 2);
-  SendSocketData(length);
+  mStreamSocket->SendSocketData(length);
 
   UnixSocketRawData* data = new UnixSocketRawData((const void *)aData, aLength);
-  SendSocketData(data);
+  mStreamSocket->SendSocketData(data);
 }
 
 void
 KeyStore::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   // Handle request.
@@ -578,31 +693,50 @@ KeyStore::ReceiveSocketData(nsAutoPtr<Un
       SendResponse(result);
       ResetHandlerInfo();
       return;
     }
   }
 }
 
 void
-KeyStore::OnConnectSuccess()
+KeyStore::OnConnectSuccess(SocketType aSocketType)
 {
-  mShutdown = false;
+  if (aSocketType == STREAM_SOCKET) {
+    mShutdown = false;
+  }
 }
 
 void
-KeyStore::OnConnectError()
+KeyStore::OnConnectError(SocketType aSocketType)
 {
-  if (!mShutdown) {
+  if (mShutdown) {
+    return;
+  }
+
+  if (aSocketType == STREAM_SOCKET) {
+    // Stream socket error; start listening again
     Listen();
   }
 }
 
 void
-KeyStore::OnDisconnect()
+KeyStore::OnDisconnect(SocketType aSocketType)
 {
-  if (!mShutdown) {
-    Listen();
+  if (mShutdown) {
+    return;
+  }
+
+  switch (aSocketType) {
+    case LISTEN_SOCKET:
+      // Listen socket disconnected; start anew.
+      mListenSocket = nullptr;
+      Listen();
+      break;
+    case STREAM_SOCKET:
+      // Stream socket disconnected; start listening again.
+      Listen();
+      break;
   }
 }
 
 } // namespace ipc
 } // namespace mozilla
--- a/ipc/keystore/KeyStore.h
+++ b/ipc/keystore/KeyStore.h
@@ -1,22 +1,23 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=8 et ft=cpp: */
+/* vim: set sw=2 ts=2 et ft=cpp: tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ipc_KeyStore_h
 #define mozilla_ipc_KeyStore_h 1
 
-#include "mozilla/ipc/UnixSocket.h"
 #include <sys/socket.h>
 #include <sys/un.h>
-
 #include "cert.h"
+#include "mozilla/ipc/ListenSocket.h"
+#include "mozilla/ipc/StreamSocket.h"
+#include "mozilla/ipc/UnixSocketConnector.h"
 
 namespace mozilla {
 namespace ipc {
 
 enum ResponseCode {
   SUCCESS           =  1,
   LOCKED            =  2,
   UNINITIALIZED     =  3,
@@ -89,31 +90,79 @@ public:
                           sockaddr_any& aAddr,
                           const char* aAddress);
   virtual bool SetUp(int aFd);
   virtual bool SetUpListenSocket(int aFd);
   virtual void GetSocketAddr(const sockaddr_any& aAddr,
                              nsAString& aAddrStr);
 };
 
-class KeyStore : public mozilla::ipc::UnixSocketConsumer
+class KeyStore MOZ_FINAL
 {
 public:
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(KeyStore)
+
   KeyStore();
 
   void Shutdown();
 
 private:
-  virtual ~KeyStore();
+  enum SocketType {
+    LISTEN_SOCKET,
+    STREAM_SOCKET
+  };
+
+  class ListenSocket MOZ_FINAL : public mozilla::ipc::ListenSocket
+  {
+  public:
+    ListenSocket(KeyStore* aKeyStore);
+    ListenSocket();
 
-  virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage);
+    // SocketBase
+    //
+
+    void OnConnectSuccess() MOZ_OVERRIDE;
+    void OnConnectError() MOZ_OVERRIDE;
+    void OnDisconnect() MOZ_OVERRIDE;
+
+  private:
+    KeyStore* mKeyStore;
+  };
 
-  virtual void OnConnectSuccess();
-  virtual void OnConnectError();
-  virtual void OnDisconnect();
+  class StreamSocket MOZ_FINAL : public mozilla::ipc::StreamSocket
+  {
+  public:
+    StreamSocket(KeyStore* aKeyStore);
+    ~StreamSocket();
+
+    // SocketConsumerBase
+    //
+
+    void OnConnectSuccess() MOZ_OVERRIDE;
+    void OnConnectError() MOZ_OVERRIDE;
+    void OnDisconnect() MOZ_OVERRIDE;
+
+    void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage) MOZ_OVERRIDE;
+
+    // ConnectionOrientedSocket
+    //
+
+    ConnectionOrientedSocketIO* GetIO() MOZ_OVERRIDE;
+
+  private:
+    KeyStore* mKeyStore;
+  };
+
+  ~KeyStore();
+
+  void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage);
+
+  void OnConnectSuccess(enum SocketType aSocketType);
+  void OnConnectError(enum SocketType aSocketType);
+  void OnDisconnect(enum SocketType aSocketType);
 
   struct {
     ProtocolHandlerState          state;
     uint8_t                       command;
     struct ProtocolParam          param[MAX_PARAM];
     int                           paramCount;
     const struct ProtocolCommand  *commandPattern;
   } mHandlerInfo;
@@ -123,14 +172,17 @@ private:
   bool CheckSize(UnixSocketRawData *aMessage, size_t aExpectSize);
   ResponseCode ReadCommand(UnixSocketRawData *aMessage);
   ResponseCode ReadLength(UnixSocketRawData *aMessage);
   ResponseCode ReadData(UnixSocketRawData *aMessage);
   void SendResponse(ResponseCode response);
   void SendData(const uint8_t *data, int length);
 
   bool mShutdown;
+
+  nsRefPtr<ListenSocket> mListenSocket;
+  nsRefPtr<StreamSocket> mStreamSocket;
 };
 
 } // namespace ipc
 } // namespace mozilla
 
 #endif // mozilla_ipc_KeyStore_h
--- a/testing/marionette/marionette-server.js
+++ b/testing/marionette/marionette-server.js
@@ -32,18 +32,26 @@ let specialpowers = {};
 loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js",
                      specialpowers);
 specialpowers.specialPowersObserver = new specialpowers.SpecialPowersObserver();
 specialpowers.specialPowersObserver.init();
 
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
 
+function isMulet() {
+  let isMulet = false;
+  try {
+   isMulet = Services.prefs.getBoolPref("b2g.is_mulet");
+  } catch (ex) { }
+  return isMulet;
+}
+
 Services.prefs.setBoolPref("marionette.contentListener", false);
-let appName = Services.appinfo.name;
+let appName = isMulet() ? "B2G" : Services.appinfo.name;
 
 let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
 let DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
 this.DevToolsUtils = DevToolsUtils;
 loader.loadSubScript("resource://gre/modules/devtools/transport/transport.js");
 
 let bypassOffline = false;
 let qemu = "0";
@@ -2938,20 +2946,19 @@ BrowserObj.prototype = {
    * Set the browser if the application is not B2G
    *
    * @param nsIDOMWindow win
    *        current window reference
    */
   setBrowser: function BO_setBrowser(win) {
     switch (appName) {
       case "Firefox":
-        if (this.window.location.href.indexOf("chrome://b2g") == -1) {
+        if (!isMulet()) {
           this.browser = win.gBrowser;
-        }
-        else {
+        } else {
           // this is Mulet
           appName = "B2G";
         }
         break;
       case "Fennec":
         this.browser = win.BrowserApp;
         break;
     }