Merge b2g-inbound to m-c.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 17 Jan 2014 15:04:32 -0500
changeset 164096 298f262f21ff15750346ede893b49345cfa1964a
parent 164042 fad7172d4542466897874b160feb32db8a94c8c0 (current diff)
parent 164095 fbf1ad27d7ac61948ac14ed9bb3cb7b5e0c44285 (diff)
child 164097 b7717200fb18b205e69cd88e8e21ce55458e1c86
child 164139 a5b834f42c7c6c4ea5f7e71e8303867048224ca8
child 164162 3c020d3c55f2d88dd554df68f853f741812bdd29
child 164218 38da84aeee23537b1a665909fb73ebfb5bb5ebe6
push id38618
push userryanvm@gmail.com
push dateFri, 17 Jan 2014 20:18:06 +0000
treeherdermozilla-inbound@b7717200fb18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone29.0a1
first release with
nightly linux32
298f262f21ff / 29.0a1 / 20140118030204 / files
nightly linux64
298f262f21ff / 29.0a1 / 20140118030204 / files
nightly mac
298f262f21ff / 29.0a1 / 20140118030204 / files
nightly win32
298f262f21ff / 29.0a1 / 20140118030204 / files
nightly win64
298f262f21ff / 29.0a1 / 20140118030204 / 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 m-c.
dom/network/interfaces/nsIDOMMobileConnection.idl
dom/network/interfaces/nsIMobileConnectionProvider.idl
dom/network/src/MobileConnection.cpp
dom/network/src/MobileConnection.h
dom/network/src/MobileConnectionArray.cpp
dom/network/src/MobileConnectionArray.h
dom/network/tests/marionette/manifest.ini
dom/network/tests/marionette/test_call_barring_change_password.js
dom/network/tests/marionette/test_call_barring_get_option.js
dom/network/tests/marionette/test_call_barring_set_error.js
dom/network/tests/marionette/test_mobile_connections_array_uninitialized.js
dom/network/tests/marionette/test_mobile_data_connection.js
dom/network/tests/marionette/test_mobile_data_location.js
dom/network/tests/marionette/test_mobile_data_state.js
dom/network/tests/marionette/test_mobile_last_known_network.js
dom/network/tests/marionette/test_mobile_mmi.js
dom/network/tests/marionette/test_mobile_networks.js
dom/network/tests/marionette/test_mobile_operator_names.js
dom/network/tests/marionette/test_mobile_preferred_network_type.js
dom/network/tests/marionette/test_mobile_preferred_network_type_by_setting.js
dom/network/tests/marionette/test_mobile_roaming_preference.js
dom/network/tests/marionette/test_mobile_set_radio.js
dom/network/tests/marionette/test_mobile_voice_state.js
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- 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
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="fce1a137746dbd354bca1918f02f96d51c40bad2">
     <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="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.1" path="prebuilts/clang/darwin-x86/3.1" revision="8a10d50e8caab8c18224588f0531f1c9363965b5"/>
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.2" path="prebuilts/clang/darwin-x86/3.2" revision="2d96fcbab6efee560c2004725b21bdc06d090933"/>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "18bd82325a82f5b9a3a4b976e213515cd3e5866b", 
+    "revision": "f1421b9d57e81c3823a32eb02e6ab6e3c74b12f1", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -5,17 +5,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <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/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="fce1a137746dbd354bca1918f02f96d51c40bad2">
     <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="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.1" path="prebuilts/clang/darwin-x86/3.1" revision="8a10d50e8caab8c18224588f0531f1c9363965b5"/>
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.2" path="prebuilts/clang/darwin-x86/3.2" revision="2d96fcbab6efee560c2004725b21bdc06d090933"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ef8bb31b462f364b57432a0724c78034d3f4f303"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="73a7e0c15969a058964e92fad1925efead38dcfc"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -161,16 +161,17 @@
 @BINPATH@/components/dom_wifi.xpt
 @BINPATH@/components/dom_system_gonk.xpt
 #endif
 #ifdef MOZ_B2G_RIL
 @BINPATH@/components/dom_voicemail.xpt
 @BINPATH@/components/dom_icc.xpt
 @BINPATH@/components/dom_cellbroadcast.xpt
 @BINPATH@/components/dom_wappush.xpt
+@BINPATH@/components/dom_mobileconnection.xpt
 #endif
 #ifdef MOZ_B2G_BT
 @BINPATH@/components/dom_bluetooth.xpt
 #endif
 @BINPATH@/components/dom_camera.xpt
 @BINPATH@/components/dom_canvas.xpt
 @BINPATH@/components/dom_contacts.xpt
 @BINPATH@/components/dom_alarm.xpt
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -35,17 +35,17 @@
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/StaticPtr.h"
 #include "Connection.h"
 #include "nsDOMEvent.h"
 #include "nsGlobalWindow.h"
 #ifdef MOZ_B2G_RIL
 #include "mozilla/dom/IccManager.h"
 #include "mozilla/dom/CellBroadcast.h"
-#include "mozilla/dom/network/MobileConnectionArray.h"
+#include "mozilla/dom/MobileConnectionArray.h"
 #include "mozilla/dom/Voicemail.h"
 #endif
 #include "nsIIdleObserver.h"
 #include "nsIPermissionManager.h"
 #include "nsNetUtil.h"
 #include "nsIHttpChannel.h"
 #include "TimeManager.h"
 #include "DeviceStorage.h"
@@ -1175,25 +1175,25 @@ Navigator::GetMozTelephony(ErrorResult& 
     mTelephony = Telephony::Create(mWindow, aRv);
   }
 
   return mTelephony;
 }
 
 #ifdef MOZ_B2G_RIL
 
-network::MobileConnectionArray*
+MobileConnectionArray*
 Navigator::GetMozMobileConnections(ErrorResult& aRv)
 {
   if (!mMobileConnections) {
     if (!mWindow) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return nullptr;
     }
-    mMobileConnections = new network::MobileConnectionArray(mWindow);
+    mMobileConnections = new MobileConnectionArray(mWindow);
   }
 
   return mMobileConnections;
 }
 
 CellBroadcast*
 Navigator::GetMozCellBroadcast(ErrorResult& aRv)
 {
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -67,30 +67,28 @@ class Gamepad;
 #ifdef MOZ_MEDIA_NAVIGATOR
 class NavigatorUserMediaSuccessCallback;
 class NavigatorUserMediaErrorCallback;
 class MozGetUserMediaDevicesSuccessCallback;
 #endif // MOZ_MEDIA_NAVIGATOR
 
 namespace network {
 class Connection;
-#ifdef MOZ_B2G_RIL
-class MobileConnectionArray;
-#endif
 } // namespace Connection;
 
 #ifdef MOZ_B2G_BT
 namespace bluetooth {
 class BluetoothManager;
 } // namespace bluetooth
 #endif // MOZ_B2G_BT
 
 #ifdef MOZ_B2G_RIL
 class CellBroadcast;
 class IccManager;
+class MobileConnectionArray;
 class Voicemail;
 #endif
 
 class PowerManager;
 class Telephony;
 
 namespace time {
 class TimeManager;
@@ -197,17 +195,17 @@ public:
   Telephony* GetMozTelephony(ErrorResult& aRv);
   network::Connection* GetMozConnection();
   nsDOMCameraManager* GetMozCameras(ErrorResult& aRv);
   void MozSetMessageHandler(const nsAString& aType,
                             systemMessageCallback* aCallback,
                             ErrorResult& aRv);
   bool MozHasPendingMessage(const nsAString& aType, ErrorResult& aRv);
 #ifdef MOZ_B2G_RIL
-  network::MobileConnectionArray* GetMozMobileConnections(ErrorResult& aRv);
+  MobileConnectionArray* GetMozMobileConnections(ErrorResult& aRv);
   CellBroadcast* GetMozCellBroadcast(ErrorResult& aRv);
   Voicemail* GetMozVoicemail(ErrorResult& aRv);
   nsIDOMMozIccManager* GetMozIccManager(ErrorResult& aRv);
 #endif // MOZ_B2G_RIL
 #ifdef MOZ_GAMEPAD
   void GetGamepads(nsTArray<nsRefPtr<Gamepad> >& aGamepads, ErrorResult& aRv);
 #endif // MOZ_GAMEPAD
 #ifdef MOZ_B2G_FM
@@ -313,17 +311,17 @@ private:
 #ifdef MOZ_B2G_FM
   nsRefPtr<FMRadio> mFMRadio;
 #endif
   nsRefPtr<PowerManager> mPowerManager;
   nsRefPtr<MobileMessageManager> mMobileMessageManager;
   nsRefPtr<Telephony> mTelephony;
   nsRefPtr<network::Connection> mConnection;
 #ifdef MOZ_B2G_RIL
-  nsRefPtr<network::MobileConnectionArray> mMobileConnections;
+  nsRefPtr<MobileConnectionArray> mMobileConnections;
   nsRefPtr<CellBroadcast> mCellBroadcast;
   nsRefPtr<IccManager> mIccManager;
   nsRefPtr<Voicemail> mVoicemail;
 #endif
 #ifdef MOZ_B2G_BT
   nsCOMPtr<bluetooth::BluetoothManager> mBluetooth;
 #endif
 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -804,17 +804,17 @@ DOMInterfaces = {
     'nativeType': 'mozilla::dom::network::Connection',
 },
 
 'MozIcc': {
     'nativeType': 'mozilla::dom::Icc',
 },
 
 'MozMobileConnectionArray': {
-    'nativeType': 'mozilla::dom::network::MobileConnectionArray',
+    'nativeType': 'mozilla::dom::MobileConnectionArray',
     'resultNotAddRefed': [ 'item' ]
 },
 
 'MozNamedAttrMap': {
     'nativeType': 'nsDOMAttributeMap',
 },
 
 'MozSpeakerManager': {
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/interfaces/moz.build
@@ -0,0 +1,12 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+XPIDL_SOURCES += [
+    'nsIDOMMobileConnection.idl',
+    'nsIMobileConnectionProvider.idl',
+]
+
+XPIDL_MODULE = 'dom_mobileconnection'
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/interfaces/nsIDOMMobileConnection.idl
@@ -0,0 +1,775 @@
+/* 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 "nsIDOMEventTarget.idl"
+
+interface nsIDOMEventListener;
+interface nsIDOMDOMRequest;
+interface nsIDOMMozMobileConnectionInfo;
+interface nsIDOMMozMobileNetworkInfo;
+interface nsIDOMMozMobileCellInfo;
+interface nsIDOMMozMobileCFInfo;
+interface nsIVariant;
+
+[scriptable, builtinclass, uuid(389ad352-4e43-4c1a-85e9-bae745554326)]
+interface nsIDOMMozMobileConnection : nsIDOMEventTarget
+{
+  const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
+  const long ICC_SERVICE_CLASS_DATA = (1 << 1);
+  const long ICC_SERVICE_CLASS_FAX = (1 << 2);
+  const long ICC_SERVICE_CLASS_SMS = (1 << 3);
+  const long ICC_SERVICE_CLASS_DATA_SYNC = (1 << 4);
+  const long ICC_SERVICE_CLASS_DATA_ASYNC = (1 << 5);
+  const long ICC_SERVICE_CLASS_PACKET = (1 << 6);
+  const long ICC_SERVICE_CLASS_PAD = (1 << 7);
+  const long ICC_SERVICE_CLASS_MAX = (1 << 7);
+
+  /**
+   * Call barring program.
+   *
+   * (0) all outgoing.
+   * (1) outgoing international.
+   * (2) outgoing international except to home country.
+   * (3) all incoming.
+   * (4) incoming when roaming outside the home country.
+   */
+  const long CALL_BARRING_PROGRAM_ALL_OUTGOING                       = 0;
+  const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL             = 1;
+  const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
+  const long CALL_BARRING_PROGRAM_ALL_INCOMING                       = 3;
+  const long CALL_BARRING_PROGRAM_INCOMING_ROAMING                   = 4;
+
+  /**
+   * Calling line identification restriction constants.
+   *
+   * @see 3GPP TS 27.007 7.7 Defined values
+   *
+   * (0) Uses subscription default value.
+   * (1) Restricts CLI presentation.
+   * (2) Allows CLI presentation.
+   */
+  const long CLIR_DEFAULT     = 0;
+  const long CLIR_INVOCATION  = 1;
+  const long CLIR_SUPPRESSION = 2;
+
+  /**
+   * These two fields can be accessed by privileged applications with the
+   * 'mobilenetwork' permission.
+   */
+  readonly attribute DOMString lastKnownNetwork;
+  readonly attribute DOMString lastKnownHomeNetwork;
+
+  /**
+   * Information about the voice connection.
+   */
+  readonly attribute nsIDOMMozMobileConnectionInfo voice;
+
+  /**
+   * Information about the data connection.
+   */
+  readonly attribute nsIDOMMozMobileConnectionInfo data;
+
+  /**
+   * Integrated Circuit Card Identifier of the SIM this
+   * mobile connection corresponds to.
+   */
+  readonly attribute DOMString iccId;
+
+  /**
+   * The selection mode of the voice and data networks.
+   *
+   * Possible values: null (unknown), 'automatic', 'manual'
+   */
+  readonly attribute DOMString networkSelectionMode;
+
+  /**
+   * The current radio state.
+   *
+   * Possible values: null (unknown), 'enabling', 'enabled', 'disabling',
+   * 'disabled'
+   */
+  readonly attribute DOMString radioState;
+
+  /**
+   * Array of network types that are supported by this radio.
+   *
+   * Possible values: 'gsm', 'wcdma', 'cdma', 'evdo', 'lte'
+   */
+  readonly attribute nsIVariant supportedNetworkTypes;
+
+  /**
+   * Search for available networks.
+   *
+   * If successful, the request's onsuccess will be called, and the request's
+   * result will be an array of nsIDOMMozMobileNetworkInfo.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * or 'GenericFailure'.
+   */
+  nsIDOMDOMRequest getNetworks();
+
+  /**
+   * Manually selects the passed in network, overriding the radio's current
+   * selection.
+   *
+   * If successful, the request's onsuccess will be called.
+   * Note: If the network was actually changed by this request,
+   * the 'voicechange' and 'datachange' events will also be fired.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest selectNetwork(in nsIDOMMozMobileNetworkInfo network);
+
+  /**
+   * Tell the radio to automatically select a network.
+   *
+   * If successful, the request's onsuccess will be called.
+   * Note: If the network was actually changed by this request, the
+   * 'voicechange' and 'datachange' events will also be fired.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest selectNetworkAutomatically();
+
+  /**
+   * Set preferred network type
+   *
+   * @param type
+   *        DOMString indicates the desired preferred network type.
+   *        Possible values: 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
+   *                         'cdma/evdo', 'cdma', 'evdo', or
+   *                         'wcdma/gsm/cdma/evdo'.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'InvalidParameter', 'ModeNotSupported' or 'GenericFailure'
+   *
+   * TODO: param "type" should be a WebIDL enum when this interface is converted
+   *       to WebIDL
+   */
+  nsIDOMDOMRequest setPreferredNetworkType(in DOMString type);
+
+  /**
+   * Query current preferred network type
+   *
+   * If successful, the request's onsuccess will be called. And the request's
+   * result will be a string indicating the current preferred network type.
+   * The value will be either 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
+   * 'cdma/evdo', 'cdma', 'evdo', or 'wcdma/gsm/cdma/evdo'.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * or 'GenericFailure'
+   */
+  nsIDOMDOMRequest getPreferredNetworkType();
+
+  /**
+   * Set roaming preference
+   *
+   * @param mode
+   *        DOMString indicates the desired roaming preference.
+   *        Possible values: 'home', 'affiliated', or 'any'.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
+   *
+   * TODO: param "mode" should be a WebIDL enum when this interface is converted
+   *       to WebIDL
+   */
+  nsIDOMDOMRequest setRoamingPreference(in DOMString mode);
+
+  /**
+   * Query current roaming preference
+   *
+   * If successful, the request's onsuccess will be called. And the request's
+   * result will be a string indicating the current roaming preference.
+   * The value will be either 'home', 'affiliated', or 'any'.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest getRoamingPreference();
+
+  /**
+   * Set voice privacy preference.
+   *
+   * @param enabled
+   *        Boolean indicates the preferred voice privacy mode used in voice
+   *        scrambling in CDMA networks. 'True' means the enhanced voice security
+   *        is required.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest setVoicePrivacyMode(in bool enabled);
+
+  /**
+   * Query current voice privacy mode.
+   *
+   * If successful, the request's onsuccess will be called. And the request's
+   * result will be a boolean indicating the current voice privacy mode.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest getVoicePrivacyMode();
+
+  /**
+   * Send a MMI message.
+   *
+   * @param mmi
+   *        DOMString containing an MMI string that can be associated to a
+   *        USSD request or other RIL functionality.
+   *
+   * @return a nsIDOMDOMRequest
+   *         The request's result will be an object containing information
+   *         about the operation.
+   *
+   * In case that the MMI code requires sending an USSD request, the DOMrequest
+   * 'success' event means that the RIL has successfully processed and sent the
+   * USSD request to the network. The network reply will be reported via
+   * 'onussdreceived' event. If the MMI code is not associated to a USSD but to
+   * other RIL request its result, if one is needed, will be notified via the
+   * returned DOMRequest 'success' or 'error' event.
+   */
+  nsIDOMDOMRequest sendMMI(in DOMString mmi);
+
+  /**
+   * Cancel the current MMI request if one exists.
+   */
+  nsIDOMDOMRequest cancelMMI();
+
+  /**
+   * Configures call forward options.
+   *
+   * @param CFInfo
+   *        An object containing the call forward rule to set.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest setCallForwardingOption(in nsIDOMMozMobileCFInfo CFInfo);
+
+  /**
+   * Queries current call forward options.
+   *
+   * @param reason
+   *        Indicates the reason the call is being forwarded. It will be either
+   *        unconditional (0), mobile busy (1), no reply (2), not reachable (3),
+   *        all call forwarding (4), or all conditional call forwarding (5).
+   *
+   * If successful, the request's onsuccess will be called, and the request's
+   * result will be an array of nsIDOMMozMobileCFInfo.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'InvalidParameter', or 'GenericFailure'.
+   */
+  nsIDOMDOMRequest getCallForwardingOption(in unsigned short reason);
+
+  /**
+   * Configures call barring option.
+   *
+   * @param option
+   *        An object containing the call barring rule to set.
+   * @see MozCallBarringOption for the detail of info.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest setCallBarringOption(in jsval option);
+
+  /**
+   * Queries current call barring status.
+   *
+   * @param info
+   *        An object containing the call barring rule to query. No need to
+   *        specify 'enabled' property.
+   * @see MozCallBarringOption for the detail of info.
+   *
+   * If successful, the request's onsuccess will be called, and the request's
+   * result will be an object of MozCallBarringOption with correct 'enabled'
+   * property indicating the status of this rule.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'InvalidParameter', or 'GenericFailure'.
+   */
+  nsIDOMDOMRequest getCallBarringOption(in jsval option);
+
+  /**
+   * Change call barring facility password.
+   *
+   * @param info
+   *        An object containing information about pin and newPin, and,
+   *        this object must have both "pin" and "newPin" attributes
+   *        to change the call barring facility password.
+   *
+   * Example:
+   *
+   *   changeCallBarringPassword({pin: "...",
+   *                              newPin: "..."});
+   */
+  nsIDOMDOMRequest changeCallBarringPassword(in jsval info);
+
+  /**
+   * Configures call waiting options.
+   *
+   * @param enabled
+   *        Value containing the desired call waiting status.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * 'IllegalSIMorME', or 'GenericFailure'
+   */
+  nsIDOMDOMRequest setCallWaitingOption(in bool enabled);
+
+  /**
+   * Queries current call waiting options.
+   *
+   * If successful, the request's onsuccess will be called, and the request's
+   * result will be a boolean indicating the call waiting status.
+   *
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * or 'GenericFailure'.
+   */
+  nsIDOMDOMRequest getCallWaitingOption();
+
+  /**
+   * Enables or disables the presentation of the calling line identity (CLI) to
+   * the called party when originating a call.
+   *
+   * @param clirMode
+   *        Is one of the CLIR_* constants.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   */
+  nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned short clirMode);
+
+  /**
+   * Queries current CLIR status.
+   *
+   * If successful, the request's onsuccess will be called, and the request's
+   * result will be a DOMCLIRStatus dictionary containing CLIR 'n' and 'm'
+   * parameter.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RadioNotAvailable', 'RequestNotSupported',
+   * or 'GenericFailure'.
+   */
+  nsIDOMDOMRequest getCallingLineIdRestriction();
+
+  /**
+   * Exit emergency callback mode.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'RequestNotSupported'  or 'GenericFailure'.
+   */
+  nsIDOMDOMRequest exitEmergencyCbMode();
+
+  /**
+   * Set radio enabled/disabled.
+   *
+   * @param enabled
+   *        True to enable the radio.
+   *
+   * If successful, the request's onsuccess will be called.
+   *
+   * Otherwise, the request's onerror will be called, and the request's error
+   * will be either 'InvalidStateError', 'RadioNotAvailable', or
+   * 'GenericFailure'.
+   *
+   * Note: Request is not available when radioState is null, 'enabling', or
+   *       'disabling'. Calling the function in above conditions will receive
+   *       'InvalidStateError' error.
+   */
+  nsIDOMDOMRequest setRadioEnabled(in boolean enabled);
+
+  /**
+   * The 'voicechange' event is notified whenever the voice connection object
+   * changes.
+   */
+  [implicit_jscontext] attribute jsval onvoicechange;
+
+  /**
+   * The 'datachange' event is notified whenever the data connection object
+   * changes values.
+   */
+  [implicit_jscontext] attribute jsval ondatachange;
+
+  /**
+   * The 'ussdreceived' event is notified whenever a new USSD message is
+   * received.
+   */
+  [implicit_jscontext] attribute jsval onussdreceived;
+
+  /**
+   * The 'dataerror' event is notified whenever the data connection object
+   * receives an error from the RIL
+   */
+  [implicit_jscontext] attribute jsval ondataerror;
+
+  /**
+   * The 'oncfstatechange' event is notified whenever the call forwarding
+   * state changes.
+   */
+  [implicit_jscontext] attribute jsval oncfstatechange;
+
+  /**
+   * The 'emergencycbmodechange' event is notified whenever the emergency
+   * callback mode changes.
+   */
+  [implicit_jscontext] attribute jsval onemergencycbmodechange;
+
+  /**
+   * The 'onotastatuschange' event is notified whenever the ota provision status
+   * changes.
+   */
+  [implicit_jscontext] attribute jsval onotastatuschange;
+
+  /**
+   * The 'oniccchange' event is notified whenever the iccid value
+   * changes.
+   */
+  [implicit_jscontext] attribute jsval oniccchange;
+
+  /**
+   * The 'onradiostatechange' event is notified whenever the radio state
+   * changes.
+   */
+  [implicit_jscontext] attribute jsval onradiostatechange;
+};
+
+[scriptable, uuid(49706beb-a160-40b7-b745-50f62e389a2c)]
+interface nsIDOMMozMobileConnectionInfo : nsISupports
+{
+  /**
+   * State of the connection.
+   *
+   * Possible values: 'notSearching', 'searching', 'denied', 'registered'.
+   * null if the state is unknown.
+   */
+  readonly attribute DOMString state;
+
+  /**
+   * Indicates whether the connection is ready. This may be different
+   */
+  readonly attribute bool connected;
+
+  /**
+   * Indicates whether only emergency calls are possible.
+   *
+   * This flag is only relevant to voice connections and when 'connected' is
+   * false.
+   */
+  readonly attribute bool emergencyCallsOnly;
+
+  /**
+   * Indicates whether the connection is going through a foreign operator
+   * (roaming) or not.
+   */
+  readonly attribute bool roaming;
+
+  /**
+   * Network operator
+   */
+  readonly attribute nsIDOMMozMobileNetworkInfo network;
+
+  /**
+   * Type of connection.
+   *
+   * Possible values: 'gsm', 'cdma', gprs', 'edge', 'umts', 'hsdpa', 'evdo0',
+   * 'evdoa', 'evdob', etc.
+   */
+  readonly attribute DOMString type;
+
+  /**
+   * Signal strength in dBm, or null if no service is available.
+   */
+  readonly attribute jsval signalStrength;
+
+  /**
+   * Signal strength, represented linearly as a number between 0 (weakest
+   * signal) and 100 (full signal).
+   */
+  readonly attribute jsval relSignalStrength;
+
+  /**
+   * Cell location.
+   */
+  readonly attribute nsIDOMMozMobileCellInfo cell;
+
+};
+
+[scriptable, uuid(40018fc7-4c42-47b6-8de6-3591a9c622bc)]
+interface nsIDOMMozMobileNetworkInfo: nsISupports
+{
+  /**
+   * Short name of the network operator
+   */
+  readonly attribute DOMString shortName;
+
+  /**
+   * Long name of the network operator
+   */
+  readonly attribute DOMString longName;
+
+  /**
+   * Mobile Country Code (MCC) of the network operator
+   */
+  readonly attribute DOMString mcc;
+
+  /**
+   * Mobile Network Code (MNC) of the network operator
+   */
+  readonly attribute DOMString mnc;
+
+  /**
+   * State of this network operator.
+   *
+   * Possible values: 'available', 'connected', 'forbidden', or null (unknown)
+   */
+  readonly attribute DOMString state;
+};
+
+[scriptable, uuid(9750b3a7-d913-436e-95d4-7ef2973ec6a1)]
+interface nsIDOMMozMobileCellInfo: nsISupports
+{
+  /**
+   * Mobile Location Area Code (LAC) for GSM/WCDMA networks.
+   *
+   * Possible ranges from 0x0000 to 0xffff.
+   * -1 if the LAC is unknown.
+   */
+  readonly attribute long gsmLocationAreaCode;
+
+  /**
+   * Mobile Cell ID for GSM/WCDMA networks.
+   *
+   * Possible ranges from 0x00000000 to 0xffffffff.
+   * -1 if the cell id is unknown.
+   */
+  readonly attribute long long gsmCellId;
+
+  /**
+   * Base Station ID for CDMA networks.
+   *
+   * Possible ranges from 0 to 65535
+   * -1 if the base station id is unknown.
+   */
+  readonly attribute long cdmaBaseStationId;
+
+  /**
+   * Base Station Latitude for CDMA networks.
+   *
+   * Possible ranges from -1296000 to 1296000.
+   * -2147483648 if the latitude is unknown.
+   *
+   * @see 3GPP2 C.S0005-A v6.0.
+   */
+  readonly attribute long cdmaBaseStationLatitude;
+
+  /**
+   * Base Station Longitude for CDMA networks.
+   *
+   * Possible ranges from -2592000 to 2592000.
+   * -2147483648 if the longitude is unknown.
+   *
+   * @see 3GPP2 C.S0005-A v6.0.
+   */
+  readonly attribute long cdmaBaseStationLongitude;
+
+  /**
+   * System ID for CDMA networks.
+   *
+   * Possible ranges from 0 to 32767.
+   * -1 if the system id is unknown.
+   */
+  readonly attribute long cdmaSystemId;
+
+  /**
+   * Network ID for CDMA networks.
+   *
+   * Possible ranges from 0 to 65535.
+   * -1 if the network id is unknown.
+   */
+  readonly attribute long cdmaNetworkId;
+};
+
+[scriptable, uuid(d1b35ad8-99aa-47cc-ab49-2e72b00e39df)]
+interface nsIDOMMozMobileCFInfo : nsISupports
+{
+  /**
+   * Call forwarding rule status.
+   *
+   * It will be either not active (false), or active (true).
+   *
+   * Note: Unused for setting call forwarding options. It reports
+   *       the status of the rule when getting how the rule is
+   *       configured.
+   *
+   * @see 3GPP TS 27.007 7.11 "status".
+   */
+  readonly attribute bool active;
+
+  const long CALL_FORWARD_ACTION_DISABLE = 0;
+  const long CALL_FORWARD_ACTION_ENABLE = 1;
+  const long CALL_FORWARD_ACTION_QUERY_STATUS = 2;
+  const long CALL_FORWARD_ACTION_REGISTRATION = 3;
+  const long CALL_FORWARD_ACTION_ERASURE = 4;
+
+  /**
+   * Indicates what to do with the rule.
+   *
+   * One of the CALL_FORWARD_ACTION_* constants. It will be either disable (0),
+   * enable (1), query status (2), registration (3), or erasure (4).
+   *
+   * @see 3GPP TS 27.007 7.11 "mode".
+   */
+  readonly attribute unsigned short action;
+
+  const long CALL_FORWARD_REASON_UNCONDITIONAL = 0;
+  const long CALL_FORWARD_REASON_MOBILE_BUSY = 1;
+  const long CALL_FORWARD_REASON_NO_REPLY = 2;
+  const long CALL_FORWARD_REASON_NOT_REACHABLE = 3;
+  const long CALL_FORWARD_REASON_ALL_CALL_FORWARDING = 4;
+  const long CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING = 5;
+
+  /**
+   * Indicates the reason the call is being forwarded.
+   *
+   * One of the CALL_FORWARD_REASON_* constants. It will be either
+   * unconditional (0), mobile busy (1), no reply (2), not reachable (3),
+   * all call forwarding (4), or all conditional call forwarding (5).
+   *
+   * @see 3GPP TS 27.007 7.11 "reason".
+   */
+  readonly attribute unsigned short reason;
+
+  /**
+   * Phone number of forwarding address.
+   */
+  readonly attribute DOMString number;
+
+  /**
+   * When "no reply" is enabled or queried, this gives the time in
+   * seconds to wait before call is forwarded.
+   */
+  readonly attribute unsigned short timeSeconds;
+
+  /**
+   * Service for which the call forward is set up. It should be one of the
+   * nsIDOMMozMobileConnection.ICC_SERVICE_CLASS_* values.
+   */
+  readonly attribute unsigned short serviceClass;
+};
+
+
+dictionary MozCallBarringOption
+{
+  /**
+   * Indicates the program the call is being barred.
+   *
+   * It shall be one of the nsIDOMMozMobileConnection.CALL_BARRING_PROGRAM_*
+   * values.
+   */
+   unsigned short program;
+
+  /**
+   * Enable or disable the call barring program.
+   */
+  boolean enabled;
+
+  /**
+   * Barring password. Use "" if no password specified.
+   */
+  DOMString password;
+
+  /**
+   * Service for which the call barring is set up.
+   *
+   * It shall be one of the nsIDOMMozMobileConnection.ICC_SERVICE_CLASS_*
+   * values.
+   */
+  unsigned short serviceClass;
+};
+
+dictionary DOMMMIResult
+{
+  /**
+   * String key that identifies the service associated with the MMI code
+   * request. The UI is supposed to handle the localization of the strings
+   * associated with this string key.
+   */
+  DOMString serviceCode;
+
+  /**
+   * String key containing the status message of the associated MMI request.
+   * The UI is supposed to handle the localization of the strings associated
+   * with this string key.
+   */
+  DOMString statusMessage;
+
+  /**
+   * Some MMI requests like call forwarding or PIN/PIN2/PUK/PUK2 related
+   * requests provide extra information along with the status message, this
+   * information can be a number, a string key or an array of string keys.
+   */
+  jsval additionalInformation;
+};
+
+dictionary DOMCLIRStatus
+{
+  /**
+   * CLIR parameter 'n': parameter sets the adjustment for outgoing calls.
+   *
+   * 0 Presentation indicator is used according to the subscription of the
+   *   CLIR service (uses subscription default value).
+   * 1 CLIR invocation (restricts CLI presentation).
+   * 2 CLIR suppression (allows CLI presentation).
+   */
+  unsigned short n;
+
+  /**
+   * CLIR parameter 'm': parameter shows the subscriber CLIR service status in
+   *                     the network.
+   * 0 CLIR not provisioned.
+   * 1 CLIR provisioned in permanent mode.
+   * 2 unknown (e.g. no network, etc.).
+   * 3 CLIR temporary mode presentation restricted.
+   *
+   * @see 3GPP TS 27.007 7.7 Defined values
+   */
+  unsigned short m;
+};
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/interfaces/nsIMobileConnectionProvider.idl
@@ -0,0 +1,133 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIDOMDOMRequest;
+interface nsIDOMMozMobileCFInfo;
+interface nsIDOMMozMobileConnectionInfo;
+interface nsIDOMMozMobileNetworkInfo;
+interface nsIDOMWindow;
+interface nsIVariant;
+
+[scriptable, uuid(5013f5cc-24f9-45dc-ba03-f5dc031a3a6b)]
+interface nsIMobileConnectionListener : nsISupports
+{
+  void notifyVoiceChanged();
+  void notifyDataChanged();
+  void notifyUssdReceived(in DOMString message,
+                          in boolean sessionEnded);
+  void notifyDataError(in DOMString message);
+  void notifyCFStateChange(in boolean success,
+                           in unsigned short action,
+                           in unsigned short reason,
+                           in DOMString number,
+                           in unsigned short timeSeconds,
+                           in unsigned short serviceClass);
+  void notifyEmergencyCbModeChanged(in boolean active,
+                                    in unsigned long timeoutMs);
+  void notifyOtaStatusChanged(in DOMString status);
+  void notifyIccChanged();
+  void notifyRadioStateChanged();
+};
+
+/**
+ * XPCOM component (in the content process) that provides the mobile
+ * network information.
+ */
+[scriptable, uuid(987fc93a-e538-4fd3-9e4d-0e0f0934f019)]
+interface nsIMobileConnectionProvider : nsISupports
+{
+  /**
+   * Called when a content process registers receiving unsolicited messages from
+   * RadioInterfaceLayer in the chrome process. Only a content process that has
+   * the 'mobileconnection' permission is allowed to register.
+   */
+  void registerMobileConnectionMsg(in unsigned long clientId,
+                                   in nsIMobileConnectionListener listener);
+  void unregisterMobileConnectionMsg(in unsigned long clientId,
+                                     in nsIMobileConnectionListener listener);
+
+  /**
+   * These two fields require the 'mobilenetwork' permission.
+   */
+  DOMString getLastKnownNetwork(in unsigned long clientId);
+  DOMString getLastKnownHomeNetwork(in unsigned long clientId);
+
+  /**
+   * All fields below require the 'mobileconnection' permission.
+   */
+  nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long clientId);
+  nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long clientId);
+  DOMString getIccId(in unsigned long clientId);
+  DOMString getNetworkSelectionMode(in unsigned long clientId);
+  DOMString getRadioState(in unsigned long clientId);
+  nsIVariant getSupportedNetworkTypes(in unsigned long clientId);
+
+  nsIDOMDOMRequest getNetworks(in unsigned long clientId,
+                               in nsIDOMWindow window);
+  nsIDOMDOMRequest selectNetwork(in unsigned long clientId,
+                                 in nsIDOMWindow window,
+                                 in nsIDOMMozMobileNetworkInfo network);
+  nsIDOMDOMRequest selectNetworkAutomatically(in unsigned long clientId,
+                                              in nsIDOMWindow window);
+
+  nsIDOMDOMRequest setPreferredNetworkType(in unsigned long clientId,
+                                           in nsIDOMWindow window,
+                                           in DOMString type);
+  nsIDOMDOMRequest getPreferredNetworkType(in unsigned long clientId,
+                                           in nsIDOMWindow window);
+
+  nsIDOMDOMRequest setRoamingPreference(in unsigned long clientId,
+                                        in nsIDOMWindow window,
+                                        in DOMString mode);
+  nsIDOMDOMRequest getRoamingPreference(in unsigned long clientId,
+                                        in nsIDOMWindow window);
+
+  nsIDOMDOMRequest setVoicePrivacyMode(in unsigned long clientId,
+                                       in nsIDOMWindow window,
+                                       in bool enabled);
+  nsIDOMDOMRequest getVoicePrivacyMode(in unsigned long clientId,
+                                       in nsIDOMWindow window);
+
+  nsIDOMDOMRequest sendMMI(in unsigned long clientId,
+                           in nsIDOMWindow window,
+                           in DOMString mmi);
+  nsIDOMDOMRequest cancelMMI(in unsigned long clientId,
+                             in nsIDOMWindow window);
+
+  nsIDOMDOMRequest getCallForwardingOption(in unsigned long clientId,
+                                           in nsIDOMWindow window,
+                                           in unsigned short reason);
+  nsIDOMDOMRequest setCallForwardingOption(in unsigned long clientId,
+                                           in nsIDOMWindow window,
+                                           in nsIDOMMozMobileCFInfo CFInfo);
+
+  nsIDOMDOMRequest getCallBarringOption(in unsigned long clientId,
+                                        in nsIDOMWindow window,
+                                        in jsval option);
+  nsIDOMDOMRequest setCallBarringOption(in unsigned long clientId,
+                                        in nsIDOMWindow window,
+                                        in jsval option);
+  nsIDOMDOMRequest changeCallBarringPassword(in unsigned long clientId,
+                                             in nsIDOMWindow window,
+                                             in jsval info);
+
+  nsIDOMDOMRequest setCallWaitingOption(in unsigned long clientId,
+                                        in nsIDOMWindow window,
+                                        in bool enabled);
+  nsIDOMDOMRequest getCallWaitingOption(in unsigned long clientId,
+                                        in nsIDOMWindow window);
+
+  nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned long clientId,
+                                               in nsIDOMWindow window,
+                                               in unsigned short clirMode);
+  nsIDOMDOMRequest getCallingLineIdRestriction(in unsigned long clientId,
+                                               in nsIDOMWindow window);
+
+  nsIDOMDOMRequest exitEmergencyCbMode(in unsigned long clientId,
+                                       in nsIDOMWindow window);
+
+  nsIDOMDOMRequest setRadioEnabled(in unsigned long clientId, in nsIDOMWindow window, in bool enabled);
+};
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/moz.build
@@ -0,0 +1,7 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+PARALLEL_DIRS += ['interfaces', 'src']
copy from dom/network/src/MobileConnection.cpp
copy to dom/mobileconnection/src/MobileConnection.cpp
--- a/dom/network/src/MobileConnection.cpp
+++ b/dom/mobileconnection/src/MobileConnection.cpp
@@ -1,13 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/dom/network/MobileConnection.h"
+#include "mozilla/dom/MobileConnection.h"
 
 #include "GeneratedEvents.h"
 #include "mozilla/dom/CFStateChangeEvent.h"
 #include "mozilla/dom/DataErrorEvent.h"
 #include "mozilla/dom/MozEmergencyCbModeEvent.h"
 #include "mozilla/dom/MozOtaStatusEvent.h"
 #include "mozilla/dom/USSDReceivedEvent.h"
 #include "mozilla/Preferences.h"
@@ -18,17 +18,17 @@
 #include "nsIVariant.h"
 
 #include "nsJSUtils.h"
 #include "nsJSON.h"
 #include "mozilla/Services.h"
 
 #define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
 
-using namespace mozilla::dom::network;
+using namespace mozilla::dom;
 
 class MobileConnection::Listener MOZ_FINAL : public nsIMobileConnectionListener
 {
   MobileConnection* mMobileConnection;
 
 public:
   NS_DECL_ISUPPORTS
   NS_FORWARD_SAFE_NSIMOBILECONNECTIONLISTENER(mMobileConnection)
copy from dom/network/src/MobileConnection.h
copy to dom/mobileconnection/src/MobileConnection.h
--- a/dom/network/src/MobileConnection.h
+++ b/dom/mobileconnection/src/MobileConnection.h
@@ -8,17 +8,16 @@
 #include "nsIDOMMobileConnection.h"
 #include "nsIMobileConnectionProvider.h"
 #include "nsDOMEventTargetHelper.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsWeakPtr.h"
 
 namespace mozilla {
 namespace dom {
-namespace network {
 
 class MobileConnection : public nsDOMEventTargetHelper
                        , public nsIDOMMozMobileConnection
 {
   /**
    * Class MobileConnection doesn't actually inherit
    * nsIMobileConnectionListener. Instead, it owns an
    * nsIMobileConnectionListener derived instance mListener and passes it to
@@ -48,13 +47,12 @@ private:
   nsRefPtr<Listener> mListener;
   nsWeakPtr mWindow;
 
   uint32_t mClientId;
 
   bool CheckPermission(const char* aType);
 };
 
-} // namespace network
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_network_MobileConnection_h
copy from dom/network/src/MobileConnectionArray.cpp
copy to dom/mobileconnection/src/MobileConnectionArray.cpp
--- a/dom/network/src/MobileConnectionArray.cpp
+++ b/dom/mobileconnection/src/MobileConnectionArray.cpp
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MobileConnectionArray.h"
 #include "mozilla/dom/MozMobileConnectionArrayBinding.h"
 #include "mozilla/Preferences.h"
 
-using namespace mozilla::dom::network;
+using namespace mozilla::dom;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(MobileConnectionArray)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(MobileConnectionArray)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
   // Notify our mobile connections that we're going away.
   tmp->DropConnections();
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
copy from dom/network/src/MobileConnectionArray.h
copy to dom/mobileconnection/src/MobileConnectionArray.h
--- a/dom/network/src/MobileConnectionArray.h
+++ b/dom/mobileconnection/src/MobileConnectionArray.h
@@ -3,23 +3,22 @@
 /* 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_dom_network_MobileConnectionArray_h__
 #define mozilla_dom_network_MobileConnectionArray_h__
 
 #include "nsWrapperCache.h"
-#include "mozilla/dom/network/MobileConnection.h"
+#include "mozilla/dom/MobileConnection.h"
 
 class nsIDOMMozMobileConnection;
 
 namespace mozilla {
 namespace dom {
-namespace network {
 
 class MobileConnectionArray MOZ_FINAL : public nsISupports,
                                         public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileConnectionArray)
 
@@ -52,13 +51,12 @@ private:
   DropConnections();
 
   bool mInitialized;
 
   nsCOMPtr<nsPIDOMWindow> mWindow;
   nsTArray<nsRefPtr<MobileConnection>> mMobileConnections;
 };
 
-} // namespace network
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_network_MobileConnectionArray_h__
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/src/moz.build
@@ -0,0 +1,25 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+EXPORTS.mozilla.dom += [
+    'MobileConnection.h',
+    'MobileConnectionArray.h',
+]
+
+SOURCES += [
+    'MobileConnection.cpp',
+    'MobileConnectionArray.cpp',
+]
+
+FAIL_ON_WARNINGS = True
+
+include('/ipc/chromium/chromium-config.mozbuild')
+
+FINAL_LIBRARY = 'gklayout'
+
+LOCAL_INCLUDES += [
+    '/dom/events',
+]
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/manifest.ini
@@ -0,0 +1,24 @@
+[DEFAULT]
+b2g = true
+browser = false
+qemu = true
+
+[test_mobile_networks.js]
+disabled = Bug 808783
+[test_mobile_voice_state.js]
+[test_mobile_operator_names.js]
+[test_mobile_preferred_network_type.js]
+[test_mobile_preferred_network_type_by_setting.js]
+disabled = Bug 808783
+[test_mobile_data_connection.js]
+[test_mobile_data_location.js]
+[test_mobile_data_state.js]
+[test_mobile_mmi.js]
+[test_mobile_roaming_preference.js]
+[test_call_barring_get_option.js]
+[test_call_barring_set_error.js]
+[test_call_barring_change_password.js]
+[test_mobile_set_radio.js]
+[test_mobile_last_known_network.js]
+[test_mobile_icc_change.js]
+[test_mobile_connections_array_uninitialized.js]
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_call_barring_change_password.js
@@ -0,0 +1,63 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connection;
+ifr.onload = function() {
+  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
+
+  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
+     "connection is instanceof " + connection.constructor);
+
+  setTimeout(testChangeCallBarringPasswordWithFailure, 0);
+};
+document.body.appendChild(ifr);
+
+function testChangeCallBarringPasswordWithFailure() {
+  // Incorrect parameters, expect onerror callback.
+  let options = [
+    {pin: null, newPin: '0000'},
+    {pin: '0000', newPin: null},
+    {pin: null, newPin: null},
+    {pin: '000', newPin: '0000'},
+    {pin: '00000', newPin: '1111'},
+    {pin: 'abcd', newPin: 'efgh'},
+  ];
+
+  function do_test() {
+    for (let i = 0; i < options.length; i++) {
+      let request = connection.changeCallBarringPassword(options[i]);
+
+      request.onsuccess = function() {
+        ok(false, 'Unexpected result.');
+        setTimeout(cleanUp , 0);
+      };
+
+      request.onerror = function() {
+        ok(request.error.name === 'InvalidPassword', 'InvalidPassword');
+        if (i >= options.length) {
+          setTimeout(testChangeCallBarringPasswordWithSuccess, 0);
+        }
+      };
+    }
+  }
+
+  do_test();
+}
+
+function testChangeCallBarringPasswordWithSuccess() {
+  // TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on
+  // Emulator.
+  setTimeout(cleanUp , 0);
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_call_barring_get_option.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connection;
+ifr.onload = function() {
+  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
+
+  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
+     "connection is instanceof " + connection.constructor);
+
+  testGetCallBarringOption();
+};
+document.body.appendChild(ifr);
+
+function testGetCallBarringOption() {
+  let option = {'program': 0, 'password': '', 'serviceClass': 0};
+  let request = connection.getCallBarringOption(option);
+  request.onsuccess = function() {
+    ok(request.result);
+    ok('enabled' in request.result, 'should have "enabled" field');
+    cleanUp();
+  };
+  request.onerror = function() {
+    // Call barring is not supported by current emulator.
+    cleanUp();
+  };
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js
@@ -0,0 +1,74 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connection;
+ifr.onload = function() {
+  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
+
+  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
+     "connection is instanceof " + connection.constructor);
+
+  nextTest();
+};
+document.body.appendChild(ifr);
+
+let caseId = 0;
+let options = [
+  buildOption(5, true, '0000', 0),  // invalid program.
+
+  // test null.
+  buildOption(null, true, '0000', 0),
+  buildOption(0, null, '0000', 0),
+  buildOption(0, true, null, 0),
+  buildOption(0, true, '0000', null),
+
+  // test undefined.
+  {'enabled': true, 'password': '0000', 'serviceClass': 0},
+  {'program': 0, 'password': '0000', 'serviceClass': 0},
+  {'program': 0, 'enabled': true, 'serviceClass': 0},
+  {'program': 0, 'enabled': true, 'password': '0000'},
+];
+
+function buildOption(program, enabled, password, serviceClass) {
+  return {
+    'program': program,
+    'enabled': enabled,
+    'password': password,
+    'serviceClass': serviceClass
+  };
+}
+
+function testSetCallBarringOptionError(option) {
+  let request = connection.setCallBarringOption(option);
+  request.onsuccess = function() {
+    ok(false,
+       'should not fire onsuccess for invaild call barring option: '
+       + JSON.stringify(option));
+  };
+  request.onerror = function(event) {
+    is(event.target.error.name, 'InvalidParameter', JSON.stringify(option));
+    nextTest();
+  };
+}
+
+function nextTest() {
+  if (caseId >= options.length) {
+    cleanUp();
+  } else {
+    let option = options[caseId++];
+    log('test for ' + JSON.stringify(option));
+    testSetCallBarringOptionError(option);
+  }
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
rename from dom/network/tests/marionette/test_mobile_connections_array_uninitialized.js
rename to dom/mobileconnection/tests/marionette/test_mobile_connections_array_uninitialized.js
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_data_connection.js
@@ -0,0 +1,351 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+const DATA_KEY = "ril.data.enabled";
+const DATA_ROAMING_KEY = "ril.data.roaming_enabled";
+const APN_KEY = "ril.data.apnSettings";
+
+SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
+SpecialPowers.addPermission("mobileconnection", true, document);
+SpecialPowers.addPermission("settings-read", true, document);
+SpecialPowers.addPermission("settings-write", true, document);
+
+let settings = window.navigator.mozSettings;
+let connection = window.navigator.mozMobileConnections[0];
+ok(connection instanceof MozMobileConnection,
+   "connection is instanceof " + connection.constructor);
+
+
+let pendingEmulatorCmdCount = 0;
+function sendCmdToEmulator(cmd, callback) {
+  ++pendingEmulatorCmdCount;
+
+  runEmulatorCmd(cmd, function(result) {
+    --pendingEmulatorCmdCount;
+
+    is(result[0], "OK", "Emulator response");
+
+    if (callback) {
+      callback();
+    }
+  });
+}
+
+let tasks = {
+  // List of test fuctions. Each of them should call |tasks.next()| when
+  // completed or |tasks.finish()| to jump to the last one.
+  _tasks: [],
+  _nextTaskIndex: 0,
+
+  push: function(func) {
+    this._tasks.push(func);
+  },
+
+  next: function() {
+    let index = this._nextTaskIndex++;
+    let task = this._tasks[index];
+    try {
+      task();
+    } catch (ex) {
+      ok(false, "test task[" + index + "] throws: " + ex);
+      // Run last task as clean up if possible.
+      if (index != this._tasks.length - 1) {
+        this.finish();
+      }
+    }
+  },
+
+  finish: function() {
+    this._tasks[this._tasks.length - 1]();
+  },
+
+  run: function() {
+    this.next();
+  }
+};
+
+function setSetting(key, value, callback) {
+  let setLock = settings.createLock();
+  let obj = {};
+  obj[key] = value;
+
+  let setReq = setLock.set(obj);
+  setReq.addEventListener("success", function onSetSuccess() {
+    ok(true, "set '" + key + "' to " + obj[key]);
+    if (callback) {
+      callback();
+    }
+  });
+  setReq.addEventListener("error", function onSetError() {
+    ok(false, "cannot set '" + key + "'");
+    tasks.finish();
+  });
+}
+
+function getSetting(key, callback) {
+  let getLock = settings.createLock();
+
+  let getReq = getLock.get(key);
+  getReq.addEventListener("success", function onGetSuccess() {
+    ok(true, "get " + key + " setting okay");
+    let value = getReq.result[key];
+    callback(value);
+  });
+  getReq.addEventListener("error", function onGetError() {
+    ok(false, "cannot get '" + key + "'");
+    tasks.finish();
+  });
+}
+
+function setEmulatorAPN(callback) {
+  let apn =
+    [
+      [
+        {"carrier":"T-Mobile US",
+         "apn":"epc.tmobile.com",
+         "mmsc":"http://mms.msg.eng.t-mobile.com/mms/wapenc",
+         "types":["default","supl","mms"]}
+      ]
+    ];
+  setSetting(APN_KEY, apn, callback);
+}
+
+function setEmulatorRoaming(roaming, callback) {
+  log("Setting emulator roaming state: " + roaming + ".");
+
+  // Set voice registration state first and then data registration state.
+  let cmd = "gsm voice " + (roaming ? "roaming" : "home");
+  sendCmdToEmulator(cmd, function() {
+
+    connection.addEventListener("voicechange", function onvoicechange() {
+      connection.removeEventListener("voicechange", onvoicechange);
+      log("mobileConnection.voice.roaming is now '"
+        + connection.voice.roaming + "'.");
+      is(connection.voice.roaming, roaming, "voice.roaming");
+
+      let cmd = "gsm data " + (roaming ? "roaming" : "home");
+      sendCmdToEmulator(cmd, function() {
+
+        connection.addEventListener("datachange", function ondatachange() {
+          connection.removeEventListener("datachange", ondatachange);
+          log("mobileConnection.data.roaming is now '"
+            + connection.data.roaming + "'.");
+          is(connection.data.roaming, roaming, "data.roaming");
+          if (callback) {
+            callback();
+          }
+        });
+      });
+    });
+  });
+}
+
+function setEmulatorHome(callback) {
+  let voiceRegistration = false;
+  let dataRegistration = false;
+
+  if (connection.voice.state != "registered") {
+    sendCmdToEmulator("gsm voice home", function() {
+      connection.addEventListener("voicechange", function onvoicechange() {
+        connection.removeEventListener("voicechange", onvoicechange);
+        log("mobileConnection.voice.state is now '"
+          + connection.voice.state + "'.");
+        is(connection.voice.state, "registered", "voice.state");
+        voiceRegistration = true;
+      });
+    });
+  } else {
+    voiceRegistration = true;
+  }
+
+  if (connection.data.state != "registered") {
+    sendCmdToEmulator("gsm data home", function() {
+      connection.addEventListener("datachange", function ondatachange() {
+        connection.removeEventListener("datachange", ondatachange);
+        log("mobileConnection.data.state is now '"
+          + connection.data.state + "'.");
+        is(connection.data.state, "registered", "data.state");
+        dataRegistration = true;
+      });
+    });
+  } else {
+    dataRegistration = true;
+  }
+
+  waitFor(callback, function() {
+    return (voiceRegistration && dataRegistration);
+  });
+}
+
+
+tasks.push(function verifyInitialState() {
+  log("Verifying initial state.");
+
+  // Want to start test with mobileConnection.data.state 'registered',
+  // This is the default state; if it is not currently this value then set it.
+  setEmulatorHome(function() {
+    // Want to start test with data off,
+    // This is the default state; if it is not currently this value then set it.
+    getSetting(DATA_KEY, function(result) {
+      let value = result;
+      log("Starting data enabled: " + value);
+      if (value) {
+        setSetting(DATA_KEY, false);
+
+        connection.addEventListener("datachange", function ondatachange() {
+          connection.removeEventListener("datachange", ondatachange);
+          log("mobileConnection.data.connected is now '"
+            + connection.data.connected + "'.");
+          is(connection.data.connected, false, "data.connected");
+          setEmulatorAPN(function() {
+            tasks.next();
+          });
+        });
+      } else {
+        setEmulatorAPN(function() {
+          tasks.next();
+        });
+      }
+    });
+  });
+});
+
+tasks.push(function testEnableData() {
+  log("Turn data on.");
+
+  connection.addEventListener("datachange", function ondatachange() {
+    connection.removeEventListener("datachange", ondatachange);
+    log("mobileConnection.data.connected is now '"
+      + connection.data.connected + "'.");
+    is(connection.data.connected, true, "data.connected");
+    tasks.next();
+  });
+
+  setSetting(DATA_KEY, true);
+});
+
+tasks.push(function testUnregisterDataWhileDataEnabled() {
+  log("Set data registration unregistered while data enabled.");
+
+  // When data registration is unregistered, all data calls
+  // will be automatically deactivated.
+  sendCmdToEmulator("gsm data unregistered", function() {
+    connection.addEventListener("datachange", function ondatachange() {
+      log("mobileConnection.data.state is now '"
+        + connection.data.state + "'.");
+      if (connection.data.state == "notSearching") {
+        connection.removeEventListener("datachange", ondatachange);
+        log("mobileConnection.data.connected is now '"
+          + connection.data.connected + "'.");
+        is(connection.data.connected, false, "data.connected");
+        tasks.next();
+      }
+    });
+  });
+});
+
+tasks.push(function testRegisterDataWhileDataEnabled() {
+  log("Set data registration home while data enabled.");
+
+  // When data registration is registered, data call will be
+  // (re)activated by gecko if ril.data.enabled is set to true.
+  sendCmdToEmulator("gsm data home", function() {
+    connection.addEventListener("datachange", function ondatachange() {
+      connection.removeEventListener("datachange", ondatachange);
+      log("mobileConnection.data.state is now '"
+        + connection.data.state + "'.");
+      is(connection.data.state, "registered", "data.state");
+
+      connection.addEventListener("datachange", function ondatachange() {
+        connection.removeEventListener("datachange", ondatachange);
+        log("mobileConnection.data.connected is now '"
+          + connection.data.connected + "'.");
+        is(connection.data.connected, true, "data.connected");
+        tasks.next();
+      });
+    });
+  });
+});
+
+tasks.push(function testDisableDataRoamingWhileRoaming() {
+  log("Disable data roaming while roaming.");
+
+  setSetting(DATA_ROAMING_KEY, false);
+
+  // Wait for roaming state to change, then data connection should
+  // be disconnected due to data roaming set to off.
+  setEmulatorRoaming(true, function() {
+    connection.addEventListener("datachange", function ondatachange() {
+      connection.removeEventListener("datachange", ondatachange);
+      log("mobileConnection.data.connected is now '"
+        + connection.data.connected + "'.");
+      is(connection.data.connected, false, "data.connected");
+      tasks.next();
+    });
+  });
+});
+
+tasks.push(function testEnableDataRoamingWhileRoaming() {
+  log("Enable data roaming while roaming.");
+
+  // Data should be re-connected as we enabled data roaming.
+  connection.addEventListener("datachange", function ondatachange() {
+    connection.removeEventListener("datachange", ondatachange);
+    log("mobileConnection.data.connected is now '"
+      + connection.data.connected + "'.");
+    is(connection.data.connected, true, "data.connected");
+    tasks.next();
+  });
+
+  setSetting(DATA_ROAMING_KEY, true);
+});
+
+tasks.push(function testDisableDataRoamingWhileNotRoaming() {
+  log("Disable data roaming while not roaming.");
+
+  // Wait for roaming state to change then set data roaming back
+  // to off.
+  setEmulatorRoaming(false, function() {
+    setSetting(DATA_ROAMING_KEY, false);
+
+    // No change event will be received cause data connection state
+    // remains the same.
+    window.setTimeout(function() {
+      is(connection.data.connected, true, "data.connected");
+      tasks.next();
+    }, 1000);
+  });
+});
+
+tasks.push(function testDisableData() {
+  log("Turn data off.");
+
+  connection.addEventListener("datachange", function ondatachange() {
+    connection.removeEventListener("datachange", ondatachange);
+    log("mobileConnection.data.connected is now '"
+      + connection.data.connected + "'.");
+    is(connection.data.connected, false, "data.connected");
+    tasks.next();
+  });
+
+  setSetting(DATA_KEY, false);
+});
+
+// WARNING: All tasks should be pushed before this!!!
+tasks.push(function cleanUp() {
+  if (pendingEmulatorCmdCount) {
+    window.setTimeout(cleanUp, 100);
+    return;
+  }
+
+  SpecialPowers.removePermission("mobileconnection", document);
+  SpecialPowers.removePermission("settings-write", document);
+  SpecialPowers.removePermission("settings-read", document);
+  SpecialPowers.clearUserPref("dom.mozSettings.enabled");
+  finish();
+});
+
+tasks.run();
+
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_data_location.js
@@ -0,0 +1,127 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 20000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let mobileConnection;
+ifr.onload = function() {
+  mobileConnection = ifr.contentWindow.navigator.mozMobileConnections[0];
+
+  // Start the test
+  verifyInitialState();
+};
+document.body.appendChild(ifr);
+
+let emulatorStartLac = 0;
+let emulatorStartCid = 0;
+
+function verifyInitialState() {
+  log("Verifying initial state.");
+  ok(mobileConnection instanceof MozMobileConnection,
+      "mobileConnection is instanceof " + mobileConnection.constructor);
+  testStartingCellLocation();
+}
+
+function testStartingCellLocation() {
+  // Get the current emulator data cell location
+  log("Getting the starting GSM location from the emulator.");
+
+  runEmulatorCmd("gsm location", function(result) {
+    log("Emulator callback.");
+    is(result[0].substring(0,3), "lac", "lac output");
+    is(result[1].substring(0,2), "ci", "ci output");
+    is(result[2], "OK", "emulator ok");
+
+    emulatorStartLac = result[0].substring(5);
+    log("Emulator GSM location LAC is '" + emulatorStartLac + "'.");
+    emulatorStartCid = result[1].substring(4);
+    log("Emulator GSM location CID is '" + emulatorStartCid + "'.");
+
+    log("mobileConnection.data.cell.gsmLocationAreaCode is '"
+        + mobileConnection.data.cell.gsmLocationAreaCode + "'.");
+    log("mobileConnection.data.cell.gsmCellId is '"
+        + mobileConnection.data.cell.gsmCellId + "'.");
+
+    // Verify the mobileConnection.data.cell location matches emulator values
+    if (emulatorStartLac == -1) {
+      // Emulator initializes LAC to -1, corresponds to these values
+      is(mobileConnection.data.cell.gsmLocationAreaCode,
+          65535, "starting LAC");
+    } else {
+      // A previous test changed the LAC, so verify API matches emulator
+      is(mobileConnection.data.cell.gsmLocationAreaCode,
+          emulatorStartLac, "starting LAC");
+    }
+    if (emulatorStartCid == -1) {
+      // Emulator initializes CID to -1, corresponds to these values
+      is(mobileConnection.data.cell.gsmCellId, 268435455, "starting CID");
+    } else {
+      // A previous test changed the CID, so verify API matches emulator
+      is(mobileConnection.data.cell.gsmCellId,
+          emulatorStartCid, "starting CID");
+    }
+
+    // Now test changing the GSM location
+    testChangeCellLocation(emulatorStartLac, emulatorStartCid);
+  });
+}
+
+function testChangeCellLocation() {
+  // Change emulator GSM location and verify mobileConnection.data.cell values
+  let newLac = 1000;
+  let newCid = 2000;
+  let gotCallback = false;
+
+  // Ensure values will actually be changed
+  if (newLac == emulatorStartLac) { newLac++; };
+  if (newCid == emulatorStartCid) { newCid++; };
+
+  // Setup 'ondatachange' event listener
+  mobileConnection.addEventListener("datachange", function ondatachange() {
+    mobileConnection.removeEventListener("datachange", ondatachange);
+    log("Received 'ondatachange' event.");
+    log("mobileConnection.data.cell.gsmLocationAreaCode is now '"
+        + mobileConnection.data.cell.gsmLocationAreaCode + "'.");
+    log("mobileConnection.data.cell.gsmCellId is now '"
+        + mobileConnection.data.cell.gsmCellId + "'.");
+    is(mobileConnection.data.cell.gsmLocationAreaCode, newLac,
+        "data.cell.gsmLocationAreaCode");
+    is(mobileConnection.data.cell.gsmCellId, newCid, "data.cell.gsmCellId");
+    waitFor(restoreLocation, function() {
+      return(gotCallback);
+    });
+  });
+
+  // Use emulator command to change GSM location
+  log("Changing emulator GSM location to '" + newLac + ", " + newCid
+      + "' and waiting for 'ondatachange' event.");
+  gotCallback = false;
+  runEmulatorCmd("gsm location " + newLac + " " + newCid, function(result) {
+    is(result[0], "OK");
+    log("Emulator callback on location change.");
+    gotCallback = true;
+  });
+}
+
+function restoreLocation() {
+  // Restore the emulator GSM location back to what it was originally
+  log("Restoring emulator GSM location back to '" + emulatorStartLac + ", "
+      + emulatorStartCid + "'.");
+  runEmulatorCmd("gsm location " + emulatorStartLac + " " + emulatorStartCid,
+      function(result) {
+    log("Emulator callback on restore.");
+    is(result[0], "OK");
+    cleanUp();
+  });
+}
+
+function cleanUp() {
+  mobileConnection.ondatachange = null;
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_data_state.js
@@ -0,0 +1,123 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 30000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let mobileConnection;
+ifr.onload = function() {
+  mobileConnection = ifr.contentWindow.navigator.mozMobileConnections[0];
+
+  // Start the test
+  verifyInitialState();
+};
+document.body.appendChild(ifr);
+
+function verifyInitialState() {
+  log("Verifying initial state.");
+  ok(mobileConnection instanceof MozMobileConnection,
+      "mobileConnection is instanceof " + mobileConnection.constructor);
+  // Want to start test with mobileConnection.data.state 'registered'
+  // This is the default state; if it is not currently this value then set it
+  log("Starting mobileConnection.data.state is: '"
+      + mobileConnection.data.state + "'.");
+  if (mobileConnection.data.state != "registered") {
+    changeDataStateAndVerify("home", "registered", testUnregistered);
+  } else {
+    testUnregistered();
+  }
+}
+
+function changeDataStateAndVerify(dataState, expected, nextFunction) {
+  let gotCallback = false;
+
+  // Change the mobileConnection.data.state via 'gsm data' command
+  log("Changing emulator data state to '" + dataState
+      + "' and waiting for 'ondatachange' event.");
+
+  // Setup 'ondatachange' event handler
+  mobileConnection.addEventListener("datachange", function ondatachange() {
+    mobileConnection.removeEventListener("datachange", ondatachange);
+    log("Received 'ondatachange' event.");
+    log("mobileConnection.data.state is now '"
+        + mobileConnection.data.state + "'.");
+    is(mobileConnection.data.state, expected, "data.state");
+    waitFor(nextFunction, function() {
+      return(gotCallback);
+    });
+  });
+
+  // Change the emulator data state
+  gotCallback = false;
+  runEmulatorCmd("gsm data " + dataState, function(result) {
+    is(result[0], "OK");
+    log("Emulator callback complete.");
+    gotCallback = true;
+  });
+}
+
+function testUnregistered() {
+  log("Test 1: Unregistered.");
+  // Set emulator data state to 'unregistered' and verify
+  // Expect mobileConnection.data.state to be 'notsearching'
+  changeDataStateAndVerify("unregistered", "notSearching", testRoaming);
+}
+
+function testRoaming() {
+  log("Test 2: Roaming.");
+  // Set emulator data state to 'roaming' and verify
+  // Expect mobileConnection.data.state to be 'registered'
+  changeDataStateAndVerify("roaming", "registered", testOff);
+}
+
+function testOff() {
+  log("Test 3: Off.");
+  // Set emulator data state to 'off' and verify
+  // Expect mobileConnection.data.state to be 'notsearching'
+  changeDataStateAndVerify("off", "notSearching", testSearching);
+}
+
+function testSearching() {
+  log("Test 4: Searching.");
+  // Set emulator data state to 'searching' and verify
+  // Expect mobileConnection.data.state to be 'searching'
+  changeDataStateAndVerify("searching", "searching", testDenied);
+}
+
+function testDenied() {
+  log("Test 5: Denied.");
+  // Set emulator data state to 'denied' and verify
+  // Expect mobileConnection.data.state to be 'denied'
+  changeDataStateAndVerify("denied", "denied", testOn);
+}
+
+function testOn() {
+  log("Test 6: On.");
+  // Set emulator data state to 'on' and verify
+  // Expect mobileConnection.data.state to be 'registered'
+  changeDataStateAndVerify("on", "registered", testOffAgain);
+}
+
+function testOffAgain() {
+  log("Test 7: Off again.");
+  // Set emulator data state to 'off' and verify
+  // Expect mobileConnection.data.state to be 'notsearching'
+  changeDataStateAndVerify("off", "notSearching", testHome);
+}
+
+function testHome() {
+  log("Test 8: Home.");
+  // Set emulator data state to 'home' and verify
+  // Expect mobileConnection.data.state to be 'registered'
+  changeDataStateAndVerify("home", "registered", cleanUp);
+}
+
+function cleanUp() {
+  mobileConnection.ondatachange = null;
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_icc_change.js
@@ -0,0 +1,84 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 30000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connection;
+ifr.onload = function() {
+  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
+  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
+     "connection is instanceof " + connection.constructor);
+
+  // The emulator's hard coded iccid value.
+  // See it here {B2G_HOME}/external/qemu/telephony/sim_card.c.
+  is(connection.iccId, 89014103211118510720);
+
+  runNextTest();
+};
+document.body.appendChild(ifr);
+
+function waitForIccChange(callback) {
+  connection.addEventListener("iccchange", function handler() {
+    connection.removeEventListener("iccchange", handler);
+    callback();
+  });
+}
+
+function setRadioEnabled(enabled) {
+  let request  = connection.setRadioEnabled(enabled);
+
+  request.onsuccess = function onsuccess() {
+    log('setRadioEnabled: ' + enabled);
+  };
+
+  request.onerror = function onerror() {
+    ok(false, "setRadioEnabled should be ok");
+  };
+}
+
+function testIccChangeOnRadioPowerOff() {
+  // Turn off radio
+  setRadioEnabled(false);
+
+  waitForIccChange(function() {
+    is(connection.iccId, null);
+    runNextTest();
+  });
+}
+
+function testIccChangeOnRadioPowerOn() {
+  // Turn on radio
+  setRadioEnabled(true);
+
+  waitForIccChange(function() {
+    // The emulator's hard coded iccid value.
+    is(connection.iccId, 89014103211118510720);
+    runNextTest();
+  });
+}
+
+let tests = [
+  testIccChangeOnRadioPowerOff,
+  testIccChangeOnRadioPowerOn
+];
+
+function runNextTest() {
+  let test = tests.shift();
+  if (!test) {
+    cleanUp();
+    return;
+  }
+
+  test();
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+
+  finish();
+}
rename from dom/network/tests/marionette/test_mobile_last_known_network.js
rename to dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_mmi.js
@@ -0,0 +1,107 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 20000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let mobileConnection;
+ifr.onload = function() {
+  mobileConnection = ifr.contentWindow.navigator.mozMobileConnections[0];
+
+  tasks.run();
+};
+document.body.appendChild(ifr);
+
+let tasks = {
+  // List of test functions. Each of them should call |tasks.next()| when
+  // completed or |tasks.abort()| to jump to the last one.
+  _tasks: [],
+  _nextTaskIndex: 0,
+
+  push: function(func) {
+    this._tasks.push(func);
+  },
+
+  next: function() {
+    let index = this._nextTaskIndex++;
+    let task = this._tasks[index];
+    try {
+      task();
+    } catch (ex) {
+      ok(false, "test task[" + index + "] throws: " + ex);
+      // Run last task as clean up if possible.
+      if (index != this._tasks.length - 1) {
+        this.abort();
+      }
+    }
+  },
+
+  abort: function() {
+    this._tasks[this._tasks.length - 1]();
+  },
+
+  run: function() {
+    this.next();
+  }
+};
+
+tasks.push(function verifyInitialState() {
+  log("Verifying initial state.");
+
+  ok(mobileConnection instanceof ifr.contentWindow.MozMobileConnection,
+      "mobileConnection is instanceof " + mobileConnection.constructor);
+
+  tasks.next();
+});
+
+tasks.push(function testGettingIMEI() {
+  log("Test *#06# ...");
+
+  let request = mobileConnection.sendMMI("*#06#");
+  ok(request instanceof DOMRequest,
+     "request is instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess(event) {
+    ok(true, "request success");
+    is(typeof event.target.result, "object", "typeof result object");
+    ok(event.target.result instanceof Object, "result instanceof Object");
+    is(event.target.result.statusMessage, "000000000000000", "Emulator IMEI");
+    is(event.target.result.serviceCode, "scImei", "Service code IMEI");
+    is(event.target.result.additionalInformation, undefined,
+       "No additional information");
+    tasks.next();
+  }
+  request.onerror = function onerror() {
+    ok(false, "request should not error");
+    tasks.abort();
+  };
+});
+
+tasks.push(function testInvalidMMICode(){
+  log("Test invalid MMI code ...");
+
+  let request = mobileConnection.sendMMI("InvalidMMICode");
+  ok(request instanceof DOMRequest,
+     "request is instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess(event) {
+    ok(false, "request should not success");
+    tasks.abort();
+  };
+
+  request.onerror = function onerror() {
+    ok(true, "request error");
+    is(request.error.name, "emMmiError", "MMI error name");
+    tasks.next();
+  };
+});
+
+// WARNING: All tasks should be pushed before this!!!
+tasks.push(function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+});
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_networks.js
@@ -0,0 +1,238 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// getNetworks() can take some time..
+MARIONETTE_TIMEOUT = 60000;
+ 
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+let connection = navigator.mozMobileConnections[0];
+ok(connection instanceof MozMobileConnection,
+   "connection is instanceof " + connection.constructor);
+
+is(connection.networkSelectionMode, "automatic");
+
+let androidNetwork = null;
+let telkilaNetwork = null;
+
+function isAndroidNetwork(network) {
+  is(network.longName, "Android");
+  is(network.shortName, "Android");
+  is(network.mcc, "310");
+  is(network.mnc, "260");
+}
+
+function isTelkilaNetwork(network) {
+  is(network.longName, "TelKila");
+  is(network.shortName, "TelKila");
+  is(network.mcc, "310");
+  is(network.mnc, "295");
+}
+
+function testConnectionInfo() {
+  let voice = connection.voice;
+  is(voice.connected, true);
+  is(voice.state, "registered");
+  is(voice.emergencyCallsOnly, false);
+  is(voice.roaming, false);
+  isAndroidNetwork(voice.network);
+
+  let data = connection.data;
+  // data.connected = true means there's an active data call which we
+  // can't predict here.
+  is(data.state, "registered");
+  is(data.emergencyCallsOnly, false);
+  is(data.roaming, false);
+  isAndroidNetwork(data.network);
+
+  testGetNetworks();
+}
+
+function testGetNetworks() {
+  let request = connection.getNetworks();
+  ok(request instanceof DOMRequest,
+     "request is instanceof " + request.constructor);
+
+  request.onerror = function() {
+    ok(false, request.error);
+    setTimeout(testSelectNetwork, 0);
+  };
+
+  request.onsuccess = function() {
+    ok('result' in request, "Request did not contain a result");
+    let networks = request.result;
+
+    // The emulator RIL server should always return 2 networks:
+    // {"longName":"Android","shortName":"Android","mcc":310,"mnc":260,"state":"available"}
+    // {"longName":"TelKila","shortName":"TelKila","mcc":310,"mnc":295,"state":"available"}
+    is(networks.length, 2);
+
+    let network1 = androidNetwork = networks[0];
+    isAndroidNetwork(network1);
+    is(network1.state, "available");
+
+    let network2 = telkilaNetwork = networks[1];
+    isTelkilaNetwork(network2);
+    is(network2.state, "available");
+
+    setTimeout(testSelectNetwork, 0);
+  };
+}
+
+function testSelectNetwork() {
+  let request = connection.selectNetwork(telkilaNetwork);
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  connection.addEventListener("voicechange", function voiceChange() {
+    connection.removeEventListener("voicechange", voiceChange);
+
+    isTelkilaNetwork(connection.voice.network);
+    setTimeout(testSelectNetworkAutomatically, 0);
+  });
+
+  request.onsuccess = function() {
+    is(connection.networkSelectionMode, "manual",
+       "selectNetwork sets mode to: " + connection.networkSelectionMode);
+  };
+
+  request.onerror = function() {
+    ok(false, request.error);
+    setTimeout(testSelectNetworkAutomatically, 0);
+  };
+}
+
+function testSelectNetworkAutomatically() {
+  let request = connection.selectNetworkAutomatically();
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  connection.addEventListener("voicechange", function voiceChange() {
+    connection.removeEventListener("voicechange", voiceChange);
+
+    isAndroidNetwork(connection.voice.network);
+    setTimeout(testSelectNetworkErrors, 0);
+  });
+
+  request.onsuccess = function() {
+    is(connection.networkSelectionMode, "automatic",
+       "selectNetworkAutomatically sets mode to: " +
+       connection.networkSelectionMode);
+  };
+
+  request.onerror = function() {
+    ok(false, request.error);
+    setTimeout(testSelectNetworkErrors, 0);
+  };
+}
+
+function throwsException(fn) {
+  try {
+    fn();
+    ok(false, "function did not throw an exception: " + fn);
+  } catch (e) {
+    ok(true, "function successfully caught exception: " + e);
+  }
+}
+
+function testSelectNetworkErrors() {
+  throwsException(function() {
+    connection.selectNetwork(null);
+  });
+
+  throwsException(function() {
+    connection.selectNetwork({});
+  });
+
+  connection.addEventListener("voicechange", function voiceChange() {
+    connection.removeEventListener("voicechange", voiceChange);
+    setTimeout(testSelectExistingNetworkManual, 0);
+  });
+
+  let request1 = connection.selectNetwork(telkilaNetwork);
+  request1.onerror = function() {
+    ok(false, request.error);
+    setTimeout(testSelectExistingNetworkManual, 0);
+  };
+
+  // attempt to selectNetwork while one request has already been sent
+  throwsException(function() {
+    connection.selectNetwork(androidNetwork);
+  });
+}
+
+function testSelectExistingNetworkManual() {
+  // When the current network is selected again, the DOMRequest's onsuccess
+  // should be called, but the network shouldn't actually change
+
+  // Telkila should be the currently selected network
+  log("Selecting TelKila (should already be selected");
+  let request = connection.selectNetwork(telkilaNetwork);
+
+  let voiceChanged = false;
+  connection.addEventListener("voicechange", function voiceChange() {
+    connection.removeEventListener("voicechange", voiceChange);
+    voiceChanged = true;
+  });
+
+  function nextTest() {
+    // Switch back to automatic selection to setup the next test
+    let autoRequest = connection.selectNetworkAutomatically();
+    autoRequest.onsuccess = function() {
+      setTimeout(testSelectExistingNetworkAuto, 0);
+    };
+    autoRequest.onerror = function() {
+      ok(false, autoRequest.error);
+      cleanUp();
+    };
+  }
+
+  request.onsuccess = function() {
+    // Give the voicechange event another opportunity to fire
+    setTimeout(function() {
+      is(voiceChanged, false,
+         "voiceNetwork changed while manually selecting Telkila network? " +
+         voiceChanged);
+      nextTest();
+    }, 0);
+  };
+
+  request.onerror = function() {
+    ok(false, request.error);
+    nextTest();
+  };
+}
+
+function testSelectExistingNetworkAuto() {
+  // Now try the same thing but using automatic selection
+  log("Selecting automatically (should already be auto)");
+  let request = connection.selectNetworkAutomatically();
+
+  let voiceChanged = false;
+  connection.addEventListener("voicechange", function voiceChange() {
+    connection.removeEventListener("voicechange", voiceChange);
+    voiceChanged = true;
+  });
+
+  request.onsuccess = function() {
+    // Give the voicechange event another opportunity to fire
+    setTimeout(function() {
+      is(voiceChanged, false,
+         "voiceNetwork changed while automatically selecting network? " +
+         voiceChanged);
+      cleanUp();
+    }, 0);
+  };
+
+  request.onerror = function() {
+    ok(false, request.error);
+    cleanUp();
+  };
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
+
+testConnectionInfo();
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js
@@ -0,0 +1,218 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+const OPERATOR_HOME = 0;
+const OPERATOR_ROAMING = 1;
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connection;
+let voice;
+let network;
+ifr.onload = function() {
+  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
+  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
+     "connection is instanceof " + connection.constructor);
+
+  voice = connection.voice;
+  ok(voice, "voice connection valid");
+
+  network = voice.network;
+  ok(network, "voice network info valid");
+
+  waitFor(testMobileOperatorNames, function() {
+    return voice.connected;
+  });
+};
+document.body.appendChild(ifr);
+
+let emulatorCmdPendingCount = 0;
+function sendEmulatorCommand(cmd, callback) {
+  emulatorCmdPendingCount++;
+  runEmulatorCmd(cmd, function(result) {
+    emulatorCmdPendingCount--;
+
+    is(result[result.length - 1], "OK");
+
+    callback(result);
+  });
+}
+
+function setEmulatorOperatorNamesAndMccMnc(which, longName, shortName,
+                                           mcc, mnc, callback) {
+  let cmd = "operator set " + which + " " + longName + "," +
+            shortName + "," + mcc + mnc;
+  sendEmulatorCommand(cmd, function(result) {
+    let re = new RegExp("^" + longName + "," +
+                        shortName + "," + mcc + mnc);
+    ok(result[which].match(re), "Long/short name and mcc/mnc should be changed.");
+
+    if (callback) {
+      window.setTimeout(callback, 0);
+    }
+  });
+}
+
+function setEmulatorOperatorNames(which, longName, shortName, callback) {
+  let cmd = "operator set " + which + " " + longName + "," + shortName;
+  sendEmulatorCommand(cmd, function(result) {
+    let re = new RegExp("^" + longName + "," + shortName + ",");
+    ok(result[which].match(re), "Long/short name should be changed.");
+
+    if (callback) {
+      window.setTimeout(callback, 0);
+    }
+  });
+}
+
+function setEmulatorRoaming(roaming, callback) {
+  let cmd = "gsm voice " + (roaming ? "roaming" : "home");
+  sendEmulatorCommand(cmd, function(result) {
+    is(result[0], "OK");
+
+    if (callback) {
+      window.setTimeout(callback, 0);
+    }
+  });
+}
+
+function checkValidMccMnc() {
+  is(network.mcc, "310", "network.mcc");
+  is(network.mnc, "260", "network.mnc");
+}
+
+function waitForVoiceChange(callback) {
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+    callback();
+  });
+}
+
+function doTestMobileOperatorNames(longName, shortName, callback) {
+  log("Testing '" + longName + "', '" + shortName + "':");
+
+  checkValidMccMnc();
+
+  waitForVoiceChange(function() {
+    is(network.longName, longName, "network.longName");
+    is(network.shortName, shortName, "network.shortName");
+
+    checkValidMccMnc();
+
+    window.setTimeout(callback, 0);
+  });
+
+  setEmulatorOperatorNames(OPERATOR_HOME, longName, shortName);
+}
+
+function testMobileOperatorNames() {
+  doTestMobileOperatorNames("Mozilla", "B2G", function() {
+    doTestMobileOperatorNames("Mozilla", "", function() {
+      doTestMobileOperatorNames("", "B2G", function() {
+        doTestMobileOperatorNames("", "", function() {
+          doTestMobileOperatorNames("Android", "Android", testOperatorPLMNList);
+        });
+      });
+    });
+  });
+}
+
+function doTestOperatorPLMNList(mcc, mnc, expectedLongName,
+                                expectedShortName, callback) {
+  log("Testing mcc = " + mcc + ", mnc = " + mnc + ":");
+
+  waitForVoiceChange(function() {
+    is(network.longName, expectedLongName, "network.longName");
+    is(network.shortName, expectedShortName, "network.shortName");
+    is(network.mcc, mcc, "network.mcc");
+    is(network.mnc, mnc, "network.mnc");
+    window.setTimeout(callback, 0);
+  });
+
+  setEmulatorOperatorNamesAndMccMnc(OPERATOR_HOME, "Android", "Android", mcc, mnc);
+}
+
+function testOperatorPLMNList() {
+  doTestOperatorPLMNList("123", "456", "Android", "Android", function() {
+    doTestOperatorPLMNList("310", "070", "AT&T", "", function() {
+      doTestOperatorPLMNList("310", "260", "Android", "Android", testRoamingCheck);
+    });
+  });
+}
+
+// See bug 797972 - B2G RIL: False roaming situation
+//
+// Steps to test:
+// 1. set roaming operator names
+// 2. set emulator roaming
+// 3. wait for onvoicechange event and test passing conditions
+// 4. set emulator roaming back to false
+// 5. wait for onvoicechange event again and callback
+function doTestRoamingCheck(longName, shortName, callback) {
+  log("Testing roaming check '" + longName + "', '" + shortName + "':");
+
+  setEmulatorOperatorNames(OPERATOR_ROAMING, longName, shortName,
+                           window.setTimeout.bind(window, function() {
+      let done = false;
+      function resetRoaming() {
+        if (!done) {
+          window.setTimeout(resetRoaming, 100);
+          return;
+        }
+
+        waitForVoiceChange(callback);
+        setEmulatorRoaming(false);
+      }
+
+      waitForVoiceChange(function() {
+        is(network.longName, longName, "network.longName");
+        is(network.shortName, shortName, "network.shortName");
+        is(voice.roaming, false, "voice.roaming");
+
+        resetRoaming();
+      });
+
+      setEmulatorRoaming(true, function() {
+        done = true;
+      });
+    }, 3000) // window.setTimeout.bind
+  ); // setEmulatorOperatorNames
+}
+
+function testRoamingCheck() {
+  // If Either long name or short name of current registered operator matches
+  // SPN("Android"), then the `roaming` attribute should be set to false.
+  doTestRoamingCheck("Android", "Android", function() {
+    doTestRoamingCheck("Android", "android", function() {
+      doTestRoamingCheck("Android", "Xxx", function() {
+        doTestRoamingCheck("android", "Android", function() {
+          doTestRoamingCheck("android", "android", function() {
+            doTestRoamingCheck("android", "Xxx", function() {
+              doTestRoamingCheck("Xxx", "Android", function() {
+                doTestRoamingCheck("Xxx", "android", function() {
+                  setEmulatorOperatorNames(OPERATOR_ROAMING, "TelKila", "TelKila",
+                                           window.setTimeout.bind(window, cleanUp, 3000));
+                });
+              });
+            });
+          });
+        });
+      });
+    });
+  });
+}
+
+function cleanUp() {
+  if (emulatorCmdPendingCount > 0) {
+    setTimeout(cleanUp, 100);
+    return;
+  }
+
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type.js
@@ -0,0 +1,153 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+let connection = navigator.mozMobileConnections[0];
+ok(connection instanceof MozMobileConnection,
+   "connection is instanceof " + connection.constructor);
+
+function testSupportedNetworkTypes() {
+  let supportedNetworkTypes = connection.supportedNetworkTypes;
+
+  ok(Array.isArray(supportedNetworkTypes), "supportedNetworkTypes should be an array");
+  ok(supportedNetworkTypes.indexOf("gsm") >= 0, "Should support 'gsm'");
+  ok(supportedNetworkTypes.indexOf("wcdma") >= 0, "Should support 'wcdma'");
+  ok(supportedNetworkTypes.indexOf("cdma") >= 0, "Should support 'cdma'");
+  ok(supportedNetworkTypes.indexOf("evdo") >= 0, "Should support 'evdo'");
+
+  runNextTest();
+}
+
+function setPreferredNetworkType(type, callback) {
+  log("setPreferredNetworkType: " + type);
+
+  let request = connection.setPreferredNetworkType(type);
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess() {
+    ok(true, "request success");
+    callback();
+  }
+  request.onerror = function onerror() {
+    ok(false, request.error);
+    callback();
+  }
+}
+
+function getPreferredNetworkType(callback) {
+  log("getPreferredNetworkType");
+
+  let request = connection.getPreferredNetworkType();
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess() {
+    ok(true, "request success");
+    log("getPreferredNetworkType: " + request.result);
+    callback(request.result);
+  }
+  request.onerror = function onerror() {
+    ok(false, request.error);
+    callback();
+  }
+}
+
+function failToSetPreferredNetworkType(type, expectedError, callback) {
+  log("failToSetPreferredNetworkType: " + type + ", expected error: "
+    + expectedError);
+
+  let request = connection.setPreferredNetworkType(type);
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess() {
+    ok(false, "request should not succeed");
+    callback();
+  }
+  request.onerror = function onerror() {
+    ok(true, "request error");
+    is(request.error.name, expectedError);
+    callback();
+  }
+}
+
+function setAndVerifyNetworkType(type) {
+  setPreferredNetworkType(type, function() {
+    getPreferredNetworkType(function(result) {
+      is(result, type);
+      testPreferredNetworkTypes();
+    });
+  });
+}
+
+function testPreferredNetworkTypes() {
+  let networkType = supportedTypes.shift();
+  if (!networkType) {
+    runNextTest();
+    return;
+  }
+  setAndVerifyNetworkType(networkType);
+}
+
+function failToSetAndVerifyNetworkType(type, expectedError, previousType) {
+  failToSetPreferredNetworkType(type, expectedError, function() {
+    getPreferredNetworkType(function(result) {
+      // should return the previous selected type.
+      is(result, previousType);
+      testInvalidNetworkTypes();
+    });
+  });
+}
+
+function testInvalidNetworkTypes() {
+  let networkType = invalidTypes.shift();
+  if (!networkType) {
+    runNextTest();
+    return;
+  }
+  failToSetAndVerifyNetworkType(networkType, "InvalidParameter",
+                                "wcdma/gsm");
+}
+
+let supportedTypes = [
+  'gsm',
+  'wcdma',
+  'wcdma/gsm-auto',
+  'cdma/evdo',
+  'evdo',
+  'cdma',
+  'wcdma/gsm/cdma/evdo',
+  'wcdma/gsm' // restore to default
+];
+
+let invalidTypes = [
+  ' ',
+  'AnInvalidType'
+];
+
+let tests = [
+  testSupportedNetworkTypes,
+  testPreferredNetworkTypes,
+  testInvalidNetworkTypes
+];
+
+function runNextTest() {
+  let test = tests.shift();
+  if (!test) {
+    cleanUp();
+    return;
+  }
+
+  test();
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
+
+runNextTest();
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type_by_setting.js
@@ -0,0 +1,65 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+const KEY = "ril.radio.preferredNetworkType";
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+SpecialPowers.addPermission("settings-read", true, document);
+SpecialPowers.addPermission("settings-write", true, document);
+
+let settings = window.navigator.mozSettings;
+
+function test_revert_previous_setting_on_invalid_value() {
+  log("Testing reverting to previous setting on invalid value received");
+
+  let getLock = settings.createLock();
+  let getReq = getLock.get(KEY);
+  getReq.addEventListener("success", function onGetSuccess() {
+    let originalValue = getReq.result[KEY] || "wcdma/gsm";
+
+    let setDone = false;
+    settings.addObserver(KEY, function observer(setting) {
+      // Mark if the invalid value has been set in db and wait.
+      if (setting.settingValue == obj[KEY]) {
+        setDone = true;
+        return;
+      }
+
+      // Skip any change before marking but keep it as original value.
+      if (!setDone) {
+        originalValue = setting.settingValue;
+        return;
+      }
+
+      settings.removeObserver(KEY, observer);
+      is(setting.settingValue, originalValue, "Settings reverted");
+      window.setTimeout(cleanUp, 0);
+    });
+
+    let obj = {};
+    obj[KEY] = "AnInvalidValue";
+    let setLock = settings.createLock();
+    setLock.set(obj);
+    setLock.addEventListener("error", function onSetError() {
+      ok(false, "cannot set '" + KEY + "'");
+    });
+  });
+  getReq.addEventListener("error", function onGetError() {
+    ok(false, "cannot get default value of '" + KEY + "'");
+  });
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  SpecialPowers.removePermission("settings-write", document);
+  SpecialPowers.removePermission("settings-read", document);
+
+  finish();
+}
+
+waitFor(test_revert_previous_setting_on_invalid_value, function() {
+  return navigator.mozMobileConnections[0].voice.connected;
+});
+
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_roaming_preference.js
@@ -0,0 +1,98 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 60000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+let connection = navigator.mozMobileConnections[0];
+ok(connection instanceof MozMobileConnection,
+   "connection is instanceof " + connection.constructor);
+
+function failedToSetRoamingPreference(mode, expectedErrorMessage, callback) {
+  let request = connection.setRoamingPreference(mode);
+
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess() {
+    ok(false, "Should not be here !!");
+
+    callback();
+  }
+
+  request.onerror = function onerror() {
+    is(request.error.name, expectedErrorMessage);
+
+    callback();
+  }
+}
+
+function testSetRoamingPreferenceWithNullValue() {
+  log("test setRoamingPreference(null)");
+
+  failedToSetRoamingPreference(null, "InvalidParameter", runNextTest);
+}
+
+function testSetRoamingPreferenceWithInvalidValue() {
+  log("test setRoamingPreference(\"InvalidValue\")");
+
+  failedToSetRoamingPreference("InvalidValue", "InvalidParameter", runNextTest);
+}
+
+function testSetRoamingPreferenceToHome() {
+  log("test setRoamingPreference(\"home\")");
+
+  // TODO: Bug 896394.
+  // Currently emulator run as GSM mode by default. So we expect to get a
+  // 'RequestNotSupported' error here.
+  failedToSetRoamingPreference("home", "RequestNotSupported", runNextTest);
+}
+
+function testGetRoamingPreference() {
+  log("test getRoamingPreference()");
+
+  // TODO: Bug 896394.
+  // Currently emulator run as GSM mode by default. So we expect to get a
+  // 'RequestNotSupported' error here.
+  let request = connection.getRoamingPreference();
+
+  ok(request instanceof DOMRequest,
+     "request instanceof " + request.constructor);
+
+  request.onsuccess = function onsuccess() {
+    ok(false, "Should not be here !!");
+
+    runNextTest();
+  }
+
+  request.onerror = function onerror() {
+    is(request.error.name, "RequestNotSupported");
+
+    runNextTest();
+  }
+}
+
+let tests = [
+  testSetRoamingPreferenceWithNullValue,
+  testSetRoamingPreferenceWithInvalidValue,
+  testSetRoamingPreferenceToHome,
+  testGetRoamingPreference
+];
+
+function runNextTest() {
+  let test = tests.shift();
+  if (!test) {
+    cleanUp();
+    return;
+  }
+
+  test();
+}
+
+function cleanUp() {
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
+
+runNextTest();
\ No newline at end of file
rename from dom/network/tests/marionette/test_mobile_set_radio.js
rename to dom/mobileconnection/tests/marionette/test_mobile_set_radio.js
new file mode 100644
--- /dev/null
+++ b/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js
@@ -0,0 +1,189 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+MARIONETTE_TIMEOUT = 30000;
+
+SpecialPowers.addPermission("mobileconnection", true, document);
+
+// Permission changes can't change existing Navigator.prototype
+// objects, so grab our objects from a new Navigator
+let ifr = document.createElement("iframe");
+let connection;
+ifr.onload = function() {
+  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
+  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
+     "connection is instanceof " + connection.constructor);
+  testConnectionInfo();
+};
+document.body.appendChild(ifr);
+
+let emulatorCmdPendingCount = 0;
+function setEmulatorVoiceState(state) {
+  emulatorCmdPendingCount++;
+  runEmulatorCmd("gsm voice " + state, function(result) {
+    emulatorCmdPendingCount--;
+    is(result[0], "OK");
+  });
+}
+
+function setEmulatorGsmLocation(lac, cid) {
+  emulatorCmdPendingCount++;
+  runEmulatorCmd("gsm location " + lac + " " + cid, function(result) {
+    emulatorCmdPendingCount--;
+    is(result[0], "OK");
+  });
+}
+
+function testConnectionInfo() {
+  let voice = connection.voice;
+  is(voice.connected, true);
+  is(voice.state, "registered");
+  is(voice.emergencyCallsOnly, false);
+  is(voice.roaming, false);
+
+  testCellLocation();
+}
+
+function testCellLocation() {
+  let cell = connection.voice.cell;
+
+  // Emulator always reports valid lac/cid value because its AT command parser
+  // insists valid value for every complete response. See source file
+  // hardare/ril/reference-ril/at_tok.c, function at_tok_nexthexint().
+  ok(cell, "location available");
+
+  // Initial LAC/CID. Android emulator initializes both value to 0xffff/0xffffffff.
+  is(cell.gsmLocationAreaCode, 65535);
+  is(cell.gsmCellId, 268435455);
+  is(cell.cdmaBaseStationId, -1);
+  is(cell.cdmaBaseStationLatitude, -2147483648);
+  is(cell.cdmaBaseStationLongitude, -2147483648);
+  is(cell.cdmaSystemId, -1);
+  is(cell.cdmaNetworkId, -1);
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(cell.gsmLocationAreaCode, 100);
+    is(cell.gsmCellId, 100);
+    is(cell.cdmaBaseStationId, -1);
+    is(cell.cdmaBaseStationLatitude, -2147483648);
+    is(cell.cdmaBaseStationLongitude, -2147483648);
+    is(cell.cdmaSystemId, -1);
+    is(cell.cdmaNetworkId, -1);
+
+    testSignalStrength();
+  });
+
+  setEmulatorGsmLocation(100, 100);
+}
+
+function testSignalStrength() {
+  // Android emulator initializes the signal strength to -99 dBm
+  is(connection.voice.signalStrength, -99);
+  is(connection.voice.relSignalStrength, 44);
+
+  testUnregistered();
+}
+
+function testUnregistered() {
+  setEmulatorVoiceState("unregistered");
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(connection.voice.connected, false);
+    is(connection.voice.state, "notSearching");
+    is(connection.voice.emergencyCallsOnly, true);
+    is(connection.voice.roaming, false);
+    is(connection.voice.cell, null);
+    is(connection.voice.signalStrength, null);
+    is(connection.voice.relSignalStrength, null);
+
+    testSearching();
+  });
+}
+
+function testSearching() {
+  setEmulatorVoiceState("searching");
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(connection.voice.connected, false);
+    is(connection.voice.state, "searching");
+    is(connection.voice.emergencyCallsOnly, true);
+    is(connection.voice.roaming, false);
+    is(connection.voice.cell, null);
+    is(connection.voice.signalStrength, null);
+    is(connection.voice.relSignalStrength, null);
+
+    testDenied();
+  });
+}
+
+function testDenied() {
+  setEmulatorVoiceState("denied");
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(connection.voice.connected, false);
+    is(connection.voice.state, "denied");
+    is(connection.voice.emergencyCallsOnly, true);
+    is(connection.voice.roaming, false);
+    is(connection.voice.cell, null);
+    is(connection.voice.signalStrength, null);
+    is(connection.voice.relSignalStrength, null);
+
+    testRoaming();
+  });
+}
+
+function testRoaming() {
+  setEmulatorVoiceState("roaming");
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(connection.voice.connected, true);
+    is(connection.voice.state, "registered");
+    is(connection.voice.emergencyCallsOnly, false);
+    is(connection.voice.roaming, true);
+
+    // Android emulator initializes the signal strength to -99 dBm
+    is(connection.voice.signalStrength, -99);
+    is(connection.voice.relSignalStrength, 44);
+
+    testHome();
+  });
+}
+
+function testHome() {
+  setEmulatorVoiceState("home");
+
+  connection.addEventListener("voicechange", function onvoicechange() {
+    connection.removeEventListener("voicechange", onvoicechange);
+
+    is(connection.voice.connected, true);
+    is(connection.voice.state, "registered");
+    is(connection.voice.emergencyCallsOnly, false);
+    is(connection.voice.roaming, false);
+
+    // Android emulator initializes the signal strength to -99 dBm
+    is(connection.voice.signalStrength, -99);
+    is(connection.voice.relSignalStrength, 44);
+
+    cleanUp();
+  });
+}
+
+function cleanUp() {
+  if (emulatorCmdPendingCount > 0) {
+    setTimeout(cleanUp, 100);
+    return;
+  }
+
+  SpecialPowers.removePermission("mobileconnection", document);
+  finish();
+}
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -90,16 +90,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
         'speakermanager',
         'wifi',
     ]
 
 if CONFIG['MOZ_B2G_RIL']:
     PARALLEL_DIRS += [
         'icc',
         'cellbroadcast',
+        'mobileconnection',
         'voicemail',
         'wappush',
     ]
 
 if CONFIG['MOZ_PAY']:
     PARALLEL_DIRS += ['payment']
 
 if CONFIG['MOZ_GAMEPAD']:
--- a/dom/network/interfaces/moz.build
+++ b/dom/network/interfaces/moz.build
@@ -10,22 +10,16 @@ XPIDL_SOURCES += [
     'nsIMozNavigatorNetwork.idl',
     'nsITCPServerSocketChild.idl',
     'nsITCPServerSocketParent.idl',
     'nsITCPSocketChild.idl',
     'nsITCPSocketParent.idl',
     'nsIUDPSocketChild.idl',
 ]
 
-if CONFIG['MOZ_B2G_RIL']:
-    XPIDL_SOURCES += [
-        'nsIDOMMobileConnection.idl',
-        'nsIMobileConnectionProvider.idl',
-    ]
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     XPIDL_SOURCES += [
         'nsIDOMNetworkStats.idl',
         'nsIDOMNetworkStatsManager.idl',
         'nsINetworkStatsServiceProxy.idl',
     ]
 
 XPIDL_MODULE = 'dom_network'
deleted file mode 100644
--- a/dom/network/interfaces/nsIDOMMobileConnection.idl
+++ /dev/null
@@ -1,775 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIDOMEventTarget.idl"
-
-interface nsIDOMEventListener;
-interface nsIDOMDOMRequest;
-interface nsIDOMMozMobileConnectionInfo;
-interface nsIDOMMozMobileNetworkInfo;
-interface nsIDOMMozMobileCellInfo;
-interface nsIDOMMozMobileCFInfo;
-interface nsIVariant;
-
-[scriptable, builtinclass, uuid(389ad352-4e43-4c1a-85e9-bae745554326)]
-interface nsIDOMMozMobileConnection : nsIDOMEventTarget
-{
-  const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
-  const long ICC_SERVICE_CLASS_DATA = (1 << 1);
-  const long ICC_SERVICE_CLASS_FAX = (1 << 2);
-  const long ICC_SERVICE_CLASS_SMS = (1 << 3);
-  const long ICC_SERVICE_CLASS_DATA_SYNC = (1 << 4);
-  const long ICC_SERVICE_CLASS_DATA_ASYNC = (1 << 5);
-  const long ICC_SERVICE_CLASS_PACKET = (1 << 6);
-  const long ICC_SERVICE_CLASS_PAD = (1 << 7);
-  const long ICC_SERVICE_CLASS_MAX = (1 << 7);
-
-  /**
-   * Call barring program.
-   *
-   * (0) all outgoing.
-   * (1) outgoing international.
-   * (2) outgoing international except to home country.
-   * (3) all incoming.
-   * (4) incoming when roaming outside the home country.
-   */
-  const long CALL_BARRING_PROGRAM_ALL_OUTGOING                       = 0;
-  const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL             = 1;
-  const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
-  const long CALL_BARRING_PROGRAM_ALL_INCOMING                       = 3;
-  const long CALL_BARRING_PROGRAM_INCOMING_ROAMING                   = 4;
-
-  /**
-   * Calling line identification restriction constants.
-   *
-   * @see 3GPP TS 27.007 7.7 Defined values
-   *
-   * (0) Uses subscription default value.
-   * (1) Restricts CLI presentation.
-   * (2) Allows CLI presentation.
-   */
-  const long CLIR_DEFAULT     = 0;
-  const long CLIR_INVOCATION  = 1;
-  const long CLIR_SUPPRESSION = 2;
-
-  /**
-   * These two fields can be accessed by privileged applications with the
-   * 'mobilenetwork' permission.
-   */
-  readonly attribute DOMString lastKnownNetwork;
-  readonly attribute DOMString lastKnownHomeNetwork;
-
-  /**
-   * Information about the voice connection.
-   */
-  readonly attribute nsIDOMMozMobileConnectionInfo voice;
-
-  /**
-   * Information about the data connection.
-   */
-  readonly attribute nsIDOMMozMobileConnectionInfo data;
-
-  /**
-   * Integrated Circuit Card Identifier of the SIM this
-   * mobile connection corresponds to.
-   */
-  readonly attribute DOMString iccId;
-
-  /**
-   * The selection mode of the voice and data networks.
-   *
-   * Possible values: null (unknown), 'automatic', 'manual'
-   */
-  readonly attribute DOMString networkSelectionMode;
-
-  /**
-   * The current radio state.
-   *
-   * Possible values: null (unknown), 'enabling', 'enabled', 'disabling',
-   * 'disabled'
-   */
-  readonly attribute DOMString radioState;
-
-  /**
-   * Array of network types that are supported by this radio.
-   *
-   * Possible values: 'gsm', 'wcdma', 'cdma', 'evdo', 'lte'
-   */
-  readonly attribute nsIVariant supportedNetworkTypes;
-
-  /**
-   * Search for available networks.
-   *
-   * If successful, the request's onsuccess will be called, and the request's
-   * result will be an array of nsIDOMMozMobileNetworkInfo.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * or 'GenericFailure'.
-   */
-  nsIDOMDOMRequest getNetworks();
-
-  /**
-   * Manually selects the passed in network, overriding the radio's current
-   * selection.
-   *
-   * If successful, the request's onsuccess will be called.
-   * Note: If the network was actually changed by this request,
-   * the 'voicechange' and 'datachange' events will also be fired.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest selectNetwork(in nsIDOMMozMobileNetworkInfo network);
-
-  /**
-   * Tell the radio to automatically select a network.
-   *
-   * If successful, the request's onsuccess will be called.
-   * Note: If the network was actually changed by this request, the
-   * 'voicechange' and 'datachange' events will also be fired.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest selectNetworkAutomatically();
-
-  /**
-   * Set preferred network type
-   *
-   * @param type
-   *        DOMString indicates the desired preferred network type.
-   *        Possible values: 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
-   *                         'cdma/evdo', 'cdma', 'evdo', or
-   *                         'wcdma/gsm/cdma/evdo'.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'InvalidParameter', 'ModeNotSupported' or 'GenericFailure'
-   *
-   * TODO: param "type" should be a WebIDL enum when this interface is converted
-   *       to WebIDL
-   */
-  nsIDOMDOMRequest setPreferredNetworkType(in DOMString type);
-
-  /**
-   * Query current preferred network type
-   *
-   * If successful, the request's onsuccess will be called. And the request's
-   * result will be a string indicating the current preferred network type.
-   * The value will be either 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
-   * 'cdma/evdo', 'cdma', 'evdo', or 'wcdma/gsm/cdma/evdo'.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * or 'GenericFailure'
-   */
-  nsIDOMDOMRequest getPreferredNetworkType();
-
-  /**
-   * Set roaming preference
-   *
-   * @param mode
-   *        DOMString indicates the desired roaming preference.
-   *        Possible values: 'home', 'affiliated', or 'any'.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
-   *
-   * TODO: param "mode" should be a WebIDL enum when this interface is converted
-   *       to WebIDL
-   */
-  nsIDOMDOMRequest setRoamingPreference(in DOMString mode);
-
-  /**
-   * Query current roaming preference
-   *
-   * If successful, the request's onsuccess will be called. And the request's
-   * result will be a string indicating the current roaming preference.
-   * The value will be either 'home', 'affiliated', or 'any'.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest getRoamingPreference();
-
-  /**
-   * Set voice privacy preference.
-   *
-   * @param enabled
-   *        Boolean indicates the preferred voice privacy mode used in voice
-   *        scrambling in CDMA networks. 'True' means the enhanced voice security
-   *        is required.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest setVoicePrivacyMode(in bool enabled);
-
-  /**
-   * Query current voice privacy mode.
-   *
-   * If successful, the request's onsuccess will be called. And the request's
-   * result will be a boolean indicating the current voice privacy mode.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest getVoicePrivacyMode();
-
-  /**
-   * Send a MMI message.
-   *
-   * @param mmi
-   *        DOMString containing an MMI string that can be associated to a
-   *        USSD request or other RIL functionality.
-   *
-   * @return a nsIDOMDOMRequest
-   *         The request's result will be an object containing information
-   *         about the operation.
-   *
-   * In case that the MMI code requires sending an USSD request, the DOMrequest
-   * 'success' event means that the RIL has successfully processed and sent the
-   * USSD request to the network. The network reply will be reported via
-   * 'onussdreceived' event. If the MMI code is not associated to a USSD but to
-   * other RIL request its result, if one is needed, will be notified via the
-   * returned DOMRequest 'success' or 'error' event.
-   */
-  nsIDOMDOMRequest sendMMI(in DOMString mmi);
-
-  /**
-   * Cancel the current MMI request if one exists.
-   */
-  nsIDOMDOMRequest cancelMMI();
-
-  /**
-   * Configures call forward options.
-   *
-   * @param CFInfo
-   *        An object containing the call forward rule to set.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest setCallForwardingOption(in nsIDOMMozMobileCFInfo CFInfo);
-
-  /**
-   * Queries current call forward options.
-   *
-   * @param reason
-   *        Indicates the reason the call is being forwarded. It will be either
-   *        unconditional (0), mobile busy (1), no reply (2), not reachable (3),
-   *        all call forwarding (4), or all conditional call forwarding (5).
-   *
-   * If successful, the request's onsuccess will be called, and the request's
-   * result will be an array of nsIDOMMozMobileCFInfo.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'InvalidParameter', or 'GenericFailure'.
-   */
-  nsIDOMDOMRequest getCallForwardingOption(in unsigned short reason);
-
-  /**
-   * Configures call barring option.
-   *
-   * @param option
-   *        An object containing the call barring rule to set.
-   * @see MozCallBarringOption for the detail of info.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', 'InvalidParameter', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest setCallBarringOption(in jsval option);
-
-  /**
-   * Queries current call barring status.
-   *
-   * @param info
-   *        An object containing the call barring rule to query. No need to
-   *        specify 'enabled' property.
-   * @see MozCallBarringOption for the detail of info.
-   *
-   * If successful, the request's onsuccess will be called, and the request's
-   * result will be an object of MozCallBarringOption with correct 'enabled'
-   * property indicating the status of this rule.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'InvalidParameter', or 'GenericFailure'.
-   */
-  nsIDOMDOMRequest getCallBarringOption(in jsval option);
-
-  /**
-   * Change call barring facility password.
-   *
-   * @param info
-   *        An object containing information about pin and newPin, and,
-   *        this object must have both "pin" and "newPin" attributes
-   *        to change the call barring facility password.
-   *
-   * Example:
-   *
-   *   changeCallBarringPassword({pin: "...",
-   *                              newPin: "..."});
-   */
-  nsIDOMDOMRequest changeCallBarringPassword(in jsval info);
-
-  /**
-   * Configures call waiting options.
-   *
-   * @param enabled
-   *        Value containing the desired call waiting status.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * 'IllegalSIMorME', or 'GenericFailure'
-   */
-  nsIDOMDOMRequest setCallWaitingOption(in bool enabled);
-
-  /**
-   * Queries current call waiting options.
-   *
-   * If successful, the request's onsuccess will be called, and the request's
-   * result will be a boolean indicating the call waiting status.
-   *
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * or 'GenericFailure'.
-   */
-  nsIDOMDOMRequest getCallWaitingOption();
-
-  /**
-   * Enables or disables the presentation of the calling line identity (CLI) to
-   * the called party when originating a call.
-   *
-   * @param clirMode
-   *        Is one of the CLIR_* constants.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   */
-  nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned short clirMode);
-
-  /**
-   * Queries current CLIR status.
-   *
-   * If successful, the request's onsuccess will be called, and the request's
-   * result will be a DOMCLIRStatus dictionary containing CLIR 'n' and 'm'
-   * parameter.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RadioNotAvailable', 'RequestNotSupported',
-   * or 'GenericFailure'.
-   */
-  nsIDOMDOMRequest getCallingLineIdRestriction();
-
-  /**
-   * Exit emergency callback mode.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'RequestNotSupported'  or 'GenericFailure'.
-   */
-  nsIDOMDOMRequest exitEmergencyCbMode();
-
-  /**
-   * Set radio enabled/disabled.
-   *
-   * @param enabled
-   *        True to enable the radio.
-   *
-   * If successful, the request's onsuccess will be called.
-   *
-   * Otherwise, the request's onerror will be called, and the request's error
-   * will be either 'InvalidStateError', 'RadioNotAvailable', or
-   * 'GenericFailure'.
-   *
-   * Note: Request is not available when radioState is null, 'enabling', or
-   *       'disabling'. Calling the function in above conditions will receive
-   *       'InvalidStateError' error.
-   */
-  nsIDOMDOMRequest setRadioEnabled(in boolean enabled);
-
-  /**
-   * The 'voicechange' event is notified whenever the voice connection object
-   * changes.
-   */
-  [implicit_jscontext] attribute jsval onvoicechange;
-
-  /**
-   * The 'datachange' event is notified whenever the data connection object
-   * changes values.
-   */
-  [implicit_jscontext] attribute jsval ondatachange;
-
-  /**
-   * The 'ussdreceived' event is notified whenever a new USSD message is
-   * received.
-   */
-  [implicit_jscontext] attribute jsval onussdreceived;
-
-  /**
-   * The 'dataerror' event is notified whenever the data connection object
-   * receives an error from the RIL
-   */
-  [implicit_jscontext] attribute jsval ondataerror;
-
-  /**
-   * The 'oncfstatechange' event is notified whenever the call forwarding
-   * state changes.
-   */
-  [implicit_jscontext] attribute jsval oncfstatechange;
-
-  /**
-   * The 'emergencycbmodechange' event is notified whenever the emergency
-   * callback mode changes.
-   */
-  [implicit_jscontext] attribute jsval onemergencycbmodechange;
-
-  /**
-   * The 'onotastatuschange' event is notified whenever the ota provision status
-   * changes.
-   */
-  [implicit_jscontext] attribute jsval onotastatuschange;
-
-  /**
-   * The 'oniccchange' event is notified whenever the iccid value
-   * changes.
-   */
-  [implicit_jscontext] attribute jsval oniccchange;
-
-  /**
-   * The 'onradiostatechange' event is notified whenever the radio state
-   * changes.
-   */
-  [implicit_jscontext] attribute jsval onradiostatechange;
-};
-
-[scriptable, uuid(49706beb-a160-40b7-b745-50f62e389a2c)]
-interface nsIDOMMozMobileConnectionInfo : nsISupports
-{
-  /**
-   * State of the connection.
-   *
-   * Possible values: 'notSearching', 'searching', 'denied', 'registered'.
-   * null if the state is unknown.
-   */
-  readonly attribute DOMString state;
-
-  /**
-   * Indicates whether the connection is ready. This may be different
-   */
-  readonly attribute bool connected;
-
-  /**
-   * Indicates whether only emergency calls are possible.
-   *
-   * This flag is only relevant to voice connections and when 'connected' is
-   * false.
-   */
-  readonly attribute bool emergencyCallsOnly;
-
-  /**
-   * Indicates whether the connection is going through a foreign operator
-   * (roaming) or not.
-   */
-  readonly attribute bool roaming;
-
-  /**
-   * Network operator
-   */
-  readonly attribute nsIDOMMozMobileNetworkInfo network;
-
-  /**
-   * Type of connection.
-   *
-   * Possible values: 'gsm', 'cdma', gprs', 'edge', 'umts', 'hsdpa', 'evdo0',
-   * 'evdoa', 'evdob', etc.
-   */
-  readonly attribute DOMString type;
-
-  /**
-   * Signal strength in dBm, or null if no service is available.
-   */
-  readonly attribute jsval signalStrength;
-
-  /**
-   * Signal strength, represented linearly as a number between 0 (weakest
-   * signal) and 100 (full signal).
-   */
-  readonly attribute jsval relSignalStrength;
-
-  /**
-   * Cell location.
-   */
-  readonly attribute nsIDOMMozMobileCellInfo cell;
-
-};
-
-[scriptable, uuid(40018fc7-4c42-47b6-8de6-3591a9c622bc)]
-interface nsIDOMMozMobileNetworkInfo: nsISupports
-{
-  /**
-   * Short name of the network operator
-   */
-  readonly attribute DOMString shortName;
-
-  /**
-   * Long name of the network operator
-   */
-  readonly attribute DOMString longName;
-
-  /**
-   * Mobile Country Code (MCC) of the network operator
-   */
-  readonly attribute DOMString mcc;
-
-  /**
-   * Mobile Network Code (MNC) of the network operator
-   */
-  readonly attribute DOMString mnc;
-
-  /**
-   * State of this network operator.
-   *
-   * Possible values: 'available', 'connected', 'forbidden', or null (unknown)
-   */
-  readonly attribute DOMString state;
-};
-
-[scriptable, uuid(9750b3a7-d913-436e-95d4-7ef2973ec6a1)]
-interface nsIDOMMozMobileCellInfo: nsISupports
-{
-  /**
-   * Mobile Location Area Code (LAC) for GSM/WCDMA networks.
-   *
-   * Possible ranges from 0x0000 to 0xffff.
-   * -1 if the LAC is unknown.
-   */
-  readonly attribute long gsmLocationAreaCode;
-
-  /**
-   * Mobile Cell ID for GSM/WCDMA networks.
-   *
-   * Possible ranges from 0x00000000 to 0xffffffff.
-   * -1 if the cell id is unknown.
-   */
-  readonly attribute long long gsmCellId;
-
-  /**
-   * Base Station ID for CDMA networks.
-   *
-   * Possible ranges from 0 to 65535
-   * -1 if the base station id is unknown.
-   */
-  readonly attribute long cdmaBaseStationId;
-
-  /**
-   * Base Station Latitude for CDMA networks.
-   *
-   * Possible ranges from -1296000 to 1296000.
-   * -2147483648 if the latitude is unknown.
-   *
-   * @see 3GPP2 C.S0005-A v6.0.
-   */
-  readonly attribute long cdmaBaseStationLatitude;
-
-  /**
-   * Base Station Longitude for CDMA networks.
-   *
-   * Possible ranges from -2592000 to 2592000.
-   * -2147483648 if the longitude is unknown.
-   *
-   * @see 3GPP2 C.S0005-A v6.0.
-   */
-  readonly attribute long cdmaBaseStationLongitude;
-
-  /**
-   * System ID for CDMA networks.
-   *
-   * Possible ranges from 0 to 32767.
-   * -1 if the system id is unknown.
-   */
-  readonly attribute long cdmaSystemId;
-
-  /**
-   * Network ID for CDMA networks.
-   *
-   * Possible ranges from 0 to 65535.
-   * -1 if the network id is unknown.
-   */
-  readonly attribute long cdmaNetworkId;
-};
-
-[scriptable, uuid(d1b35ad8-99aa-47cc-ab49-2e72b00e39df)]
-interface nsIDOMMozMobileCFInfo : nsISupports
-{
-  /**
-   * Call forwarding rule status.
-   *
-   * It will be either not active (false), or active (true).
-   *
-   * Note: Unused for setting call forwarding options. It reports
-   *       the status of the rule when getting how the rule is
-   *       configured.
-   *
-   * @see 3GPP TS 27.007 7.11 "status".
-   */
-  readonly attribute bool active;
-
-  const long CALL_FORWARD_ACTION_DISABLE = 0;
-  const long CALL_FORWARD_ACTION_ENABLE = 1;
-  const long CALL_FORWARD_ACTION_QUERY_STATUS = 2;
-  const long CALL_FORWARD_ACTION_REGISTRATION = 3;
-  const long CALL_FORWARD_ACTION_ERASURE = 4;
-
-  /**
-   * Indicates what to do with the rule.
-   *
-   * One of the CALL_FORWARD_ACTION_* constants. It will be either disable (0),
-   * enable (1), query status (2), registration (3), or erasure (4).
-   *
-   * @see 3GPP TS 27.007 7.11 "mode".
-   */
-  readonly attribute unsigned short action;
-
-  const long CALL_FORWARD_REASON_UNCONDITIONAL = 0;
-  const long CALL_FORWARD_REASON_MOBILE_BUSY = 1;
-  const long CALL_FORWARD_REASON_NO_REPLY = 2;
-  const long CALL_FORWARD_REASON_NOT_REACHABLE = 3;
-  const long CALL_FORWARD_REASON_ALL_CALL_FORWARDING = 4;
-  const long CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING = 5;
-
-  /**
-   * Indicates the reason the call is being forwarded.
-   *
-   * One of the CALL_FORWARD_REASON_* constants. It will be either
-   * unconditional (0), mobile busy (1), no reply (2), not reachable (3),
-   * all call forwarding (4), or all conditional call forwarding (5).
-   *
-   * @see 3GPP TS 27.007 7.11 "reason".
-   */
-  readonly attribute unsigned short reason;
-
-  /**
-   * Phone number of forwarding address.
-   */
-  readonly attribute DOMString number;
-
-  /**
-   * When "no reply" is enabled or queried, this gives the time in
-   * seconds to wait before call is forwarded.
-   */
-  readonly attribute unsigned short timeSeconds;
-
-  /**
-   * Service for which the call forward is set up. It should be one of the
-   * nsIDOMMozMobileConnection.ICC_SERVICE_CLASS_* values.
-   */
-  readonly attribute unsigned short serviceClass;
-};
-
-
-dictionary MozCallBarringOption
-{
-  /**
-   * Indicates the program the call is being barred.
-   *
-   * It shall be one of the nsIDOMMozMobileConnection.CALL_BARRING_PROGRAM_*
-   * values.
-   */
-   unsigned short program;
-
-  /**
-   * Enable or disable the call barring program.
-   */
-  boolean enabled;
-
-  /**
-   * Barring password. Use "" if no password specified.
-   */
-  DOMString password;
-
-  /**
-   * Service for which the call barring is set up.
-   *
-   * It shall be one of the nsIDOMMozMobileConnection.ICC_SERVICE_CLASS_*
-   * values.
-   */
-  unsigned short serviceClass;
-};
-
-dictionary DOMMMIResult
-{
-  /**
-   * String key that identifies the service associated with the MMI code
-   * request. The UI is supposed to handle the localization of the strings
-   * associated with this string key.
-   */
-  DOMString serviceCode;
-
-  /**
-   * String key containing the status message of the associated MMI request.
-   * The UI is supposed to handle the localization of the strings associated
-   * with this string key.
-   */
-  DOMString statusMessage;
-
-  /**
-   * Some MMI requests like call forwarding or PIN/PIN2/PUK/PUK2 related
-   * requests provide extra information along with the status message, this
-   * information can be a number, a string key or an array of string keys.
-   */
-  jsval additionalInformation;
-};
-
-dictionary DOMCLIRStatus
-{
-  /**
-   * CLIR parameter 'n': parameter sets the adjustment for outgoing calls.
-   *
-   * 0 Presentation indicator is used according to the subscription of the
-   *   CLIR service (uses subscription default value).
-   * 1 CLIR invocation (restricts CLI presentation).
-   * 2 CLIR suppression (allows CLI presentation).
-   */
-  unsigned short n;
-
-  /**
-   * CLIR parameter 'm': parameter shows the subscriber CLIR service status in
-   *                     the network.
-   * 0 CLIR not provisioned.
-   * 1 CLIR provisioned in permanent mode.
-   * 2 unknown (e.g. no network, etc.).
-   * 3 CLIR temporary mode presentation restricted.
-   *
-   * @see 3GPP TS 27.007 7.7 Defined values
-   */
-  unsigned short m;
-};
deleted file mode 100644
--- a/dom/network/interfaces/nsIMobileConnectionProvider.idl
+++ /dev/null
@@ -1,133 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface nsIDOMDOMRequest;
-interface nsIDOMMozMobileCFInfo;
-interface nsIDOMMozMobileConnectionInfo;
-interface nsIDOMMozMobileNetworkInfo;
-interface nsIDOMWindow;
-interface nsIVariant;
-
-[scriptable, uuid(5013f5cc-24f9-45dc-ba03-f5dc031a3a6b)]
-interface nsIMobileConnectionListener : nsISupports
-{
-  void notifyVoiceChanged();
-  void notifyDataChanged();
-  void notifyUssdReceived(in DOMString message,
-                          in boolean sessionEnded);
-  void notifyDataError(in DOMString message);
-  void notifyCFStateChange(in boolean success,
-                           in unsigned short action,
-                           in unsigned short reason,
-                           in DOMString number,
-                           in unsigned short timeSeconds,
-                           in unsigned short serviceClass);
-  void notifyEmergencyCbModeChanged(in boolean active,
-                                    in unsigned long timeoutMs);
-  void notifyOtaStatusChanged(in DOMString status);
-  void notifyIccChanged();
-  void notifyRadioStateChanged();
-};
-
-/**
- * XPCOM component (in the content process) that provides the mobile
- * network information.
- */
-[scriptable, uuid(987fc93a-e538-4fd3-9e4d-0e0f0934f019)]
-interface nsIMobileConnectionProvider : nsISupports
-{
-  /**
-   * Called when a content process registers receiving unsolicited messages from
-   * RadioInterfaceLayer in the chrome process. Only a content process that has
-   * the 'mobileconnection' permission is allowed to register.
-   */
-  void registerMobileConnectionMsg(in unsigned long clientId,
-                                   in nsIMobileConnectionListener listener);
-  void unregisterMobileConnectionMsg(in unsigned long clientId,
-                                     in nsIMobileConnectionListener listener);
-
-  /**
-   * These two fields require the 'mobilenetwork' permission.
-   */
-  DOMString getLastKnownNetwork(in unsigned long clientId);
-  DOMString getLastKnownHomeNetwork(in unsigned long clientId);
-
-  /**
-   * All fields below require the 'mobileconnection' permission.
-   */
-  nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long clientId);
-  nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long clientId);
-  DOMString getIccId(in unsigned long clientId);
-  DOMString getNetworkSelectionMode(in unsigned long clientId);
-  DOMString getRadioState(in unsigned long clientId);
-  nsIVariant getSupportedNetworkTypes(in unsigned long clientId);
-
-  nsIDOMDOMRequest getNetworks(in unsigned long clientId,
-                               in nsIDOMWindow window);
-  nsIDOMDOMRequest selectNetwork(in unsigned long clientId,
-                                 in nsIDOMWindow window,
-                                 in nsIDOMMozMobileNetworkInfo network);
-  nsIDOMDOMRequest selectNetworkAutomatically(in unsigned long clientId,
-                                              in nsIDOMWindow window);
-
-  nsIDOMDOMRequest setPreferredNetworkType(in unsigned long clientId,
-                                           in nsIDOMWindow window,
-                                           in DOMString type);
-  nsIDOMDOMRequest getPreferredNetworkType(in unsigned long clientId,
-                                           in nsIDOMWindow window);
-
-  nsIDOMDOMRequest setRoamingPreference(in unsigned long clientId,
-                                        in nsIDOMWindow window,
-                                        in DOMString mode);
-  nsIDOMDOMRequest getRoamingPreference(in unsigned long clientId,
-                                        in nsIDOMWindow window);
-
-  nsIDOMDOMRequest setVoicePrivacyMode(in unsigned long clientId,
-                                       in nsIDOMWindow window,
-                                       in bool enabled);
-  nsIDOMDOMRequest getVoicePrivacyMode(in unsigned long clientId,
-                                       in nsIDOMWindow window);
-
-  nsIDOMDOMRequest sendMMI(in unsigned long clientId,
-                           in nsIDOMWindow window,
-                           in DOMString mmi);
-  nsIDOMDOMRequest cancelMMI(in unsigned long clientId,
-                             in nsIDOMWindow window);
-
-  nsIDOMDOMRequest getCallForwardingOption(in unsigned long clientId,
-                                           in nsIDOMWindow window,
-                                           in unsigned short reason);
-  nsIDOMDOMRequest setCallForwardingOption(in unsigned long clientId,
-                                           in nsIDOMWindow window,
-                                           in nsIDOMMozMobileCFInfo CFInfo);
-
-  nsIDOMDOMRequest getCallBarringOption(in unsigned long clientId,
-                                        in nsIDOMWindow window,
-                                        in jsval option);
-  nsIDOMDOMRequest setCallBarringOption(in unsigned long clientId,
-                                        in nsIDOMWindow window,
-                                        in jsval option);
-  nsIDOMDOMRequest changeCallBarringPassword(in unsigned long clientId,
-                                             in nsIDOMWindow window,
-                                             in jsval info);
-
-  nsIDOMDOMRequest setCallWaitingOption(in unsigned long clientId,
-                                        in nsIDOMWindow window,
-                                        in bool enabled);
-  nsIDOMDOMRequest getCallWaitingOption(in unsigned long clientId,
-                                        in nsIDOMWindow window);
-
-  nsIDOMDOMRequest setCallingLineIdRestriction(in unsigned long clientId,
-                                               in nsIDOMWindow window,
-                                               in unsigned short clirMode);
-  nsIDOMDOMRequest getCallingLineIdRestriction(in unsigned long clientId,
-                                               in nsIDOMWindow window);
-
-  nsIDOMDOMRequest exitEmergencyCbMode(in unsigned long clientId,
-                                       in nsIDOMWindow window);
-
-  nsIDOMDOMRequest setRadioEnabled(in unsigned long clientId, in nsIDOMWindow window, in bool enabled);
-};
--- a/dom/network/src/moz.build
+++ b/dom/network/src/moz.build
@@ -21,26 +21,16 @@ UNIFIED_SOURCES += [
     'TCPServerSocketChild.cpp',
     'TCPServerSocketParent.cpp',
     'TCPSocketChild.cpp',
     'TCPSocketParent.cpp',
     'UDPSocketChild.cpp',
     'UDPSocketParent.cpp',
 ]
 
-if CONFIG['MOZ_B2G_RIL']:
-    EXPORTS.mozilla.dom.network += [
-        'MobileConnection.h',
-        'MobileConnectionArray.h',
-    ]
-    UNIFIED_SOURCES += [
-        'MobileConnection.cpp',
-        'MobileConnectionArray.cpp',
-    ]
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     EXTRA_JS_MODULES = [
         'NetworkStatsDB.jsm',
         'NetworkStatsService.jsm',
     ]
 
 EXTRA_COMPONENTS += [
     'TCPServerSocket.js',
@@ -66,12 +56,12 @@ IPDL_SOURCES += [
     'PUDPSocket.ipdl',
 ]
 
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'gklayout'
+
 LOCAL_INCLUDES += [
     '/dom/events',
 ]
-
deleted file mode 100644
--- a/dom/network/tests/marionette/manifest.ini
+++ /dev/null
@@ -1,23 +0,0 @@
-[DEFAULT]
-b2g = true
-browser = false
-qemu = true
-
-[test_mobile_networks.js]
-disabled = Bug 808783
-[test_mobile_voice_state.js]
-[test_mobile_operator_names.js]
-[test_mobile_preferred_network_type.js]
-[test_mobile_preferred_network_type_by_setting.js]
-disabled = Bug 808783
-[test_mobile_data_connection.js]
-[test_mobile_data_location.js]
-[test_mobile_data_state.js]
-[test_mobile_mmi.js]
-[test_mobile_roaming_preference.js]
-[test_call_barring_get_option.js]
-[test_call_barring_set_error.js]
-[test_call_barring_change_password.js]
-[test_mobile_set_radio.js]
-[test_mobile_last_known_network.js]
-[test_mobile_connections_array_uninitialized.js]
deleted file mode 100644
--- a/dom/network/tests/marionette/test_call_barring_change_password.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let connection;
-ifr.onload = function() {
-  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
-
-  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
-     "connection is instanceof " + connection.constructor);
-
-  setTimeout(testChangeCallBarringPasswordWithFailure, 0);
-};
-document.body.appendChild(ifr);
-
-function testChangeCallBarringPasswordWithFailure() {
-  // Incorrect parameters, expect onerror callback.
-  let options = [
-    {pin: null, newPin: '0000'},
-    {pin: '0000', newPin: null},
-    {pin: null, newPin: null},
-    {pin: '000', newPin: '0000'},
-    {pin: '00000', newPin: '1111'},
-    {pin: 'abcd', newPin: 'efgh'},
-  ];
-
-  function do_test() {
-    for (let i = 0; i < options.length; i++) {
-      let request = connection.changeCallBarringPassword(options[i]);
-
-      request.onsuccess = function() {
-        ok(false, 'Unexpected result.');
-        setTimeout(cleanUp , 0);
-      };
-
-      request.onerror = function() {
-        ok(request.error.name === 'InvalidPassword', 'InvalidPassword');
-        if (i >= options.length) {
-          setTimeout(testChangeCallBarringPasswordWithSuccess, 0);
-        }
-      };
-    }
-  }
-
-  do_test();
-}
-
-function testChangeCallBarringPasswordWithSuccess() {
-  // TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on
-  // Emulator.
-  setTimeout(cleanUp , 0);
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
deleted file mode 100644
--- a/dom/network/tests/marionette/test_call_barring_get_option.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let connection;
-ifr.onload = function() {
-  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
-
-  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
-     "connection is instanceof " + connection.constructor);
-
-  testGetCallBarringOption();
-};
-document.body.appendChild(ifr);
-
-function testGetCallBarringOption() {
-  let option = {'program': 0, 'password': '', 'serviceClass': 0};
-  let request = connection.getCallBarringOption(option);
-  request.onsuccess = function() {
-    ok(request.result);
-    ok('enabled' in request.result, 'should have "enabled" field');
-    cleanUp();
-  };
-  request.onerror = function() {
-    // Call barring is not supported by current emulator.
-    cleanUp();
-  };
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
deleted file mode 100644
--- a/dom/network/tests/marionette/test_call_barring_set_error.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let connection;
-ifr.onload = function() {
-  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
-
-  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
-     "connection is instanceof " + connection.constructor);
-
-  nextTest();
-};
-document.body.appendChild(ifr);
-
-let caseId = 0;
-let options = [
-  buildOption(5, true, '0000', 0),  // invalid program.
-
-  // test null.
-  buildOption(null, true, '0000', 0),
-  buildOption(0, null, '0000', 0),
-  buildOption(0, true, null, 0),
-  buildOption(0, true, '0000', null),
-
-  // test undefined.
-  {'enabled': true, 'password': '0000', 'serviceClass': 0},
-  {'program': 0, 'password': '0000', 'serviceClass': 0},
-  {'program': 0, 'enabled': true, 'serviceClass': 0},
-  {'program': 0, 'enabled': true, 'password': '0000'},
-];
-
-function buildOption(program, enabled, password, serviceClass) {
-  return {
-    'program': program,
-    'enabled': enabled,
-    'password': password,
-    'serviceClass': serviceClass
-  };
-}
-
-function testSetCallBarringOptionError(option) {
-  let request = connection.setCallBarringOption(option);
-  request.onsuccess = function() {
-    ok(false,
-       'should not fire onsuccess for invaild call barring option: '
-       + JSON.stringify(option));
-  };
-  request.onerror = function(event) {
-    is(event.target.error.name, 'InvalidParameter', JSON.stringify(option));
-    nextTest();
-  };
-}
-
-function nextTest() {
-  if (caseId >= options.length) {
-    cleanUp();
-  } else {
-    let option = options[caseId++];
-    log('test for ' + JSON.stringify(option));
-    testSetCallBarringOptionError(option);
-  }
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_data_connection.js
+++ /dev/null
@@ -1,351 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-const DATA_KEY = "ril.data.enabled";
-const DATA_ROAMING_KEY = "ril.data.roaming_enabled";
-const APN_KEY = "ril.data.apnSettings";
-
-SpecialPowers.setBoolPref("dom.mozSettings.enabled", true);
-SpecialPowers.addPermission("mobileconnection", true, document);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
-
-let settings = window.navigator.mozSettings;
-let connection = window.navigator.mozMobileConnections[0];
-ok(connection instanceof MozMobileConnection,
-   "connection is instanceof " + connection.constructor);
-
-
-let pendingEmulatorCmdCount = 0;
-function sendCmdToEmulator(cmd, callback) {
-  ++pendingEmulatorCmdCount;
-
-  runEmulatorCmd(cmd, function(result) {
-    --pendingEmulatorCmdCount;
-
-    is(result[0], "OK", "Emulator response");
-
-    if (callback) {
-      callback();
-    }
-  });
-}
-
-let tasks = {
-  // List of test fuctions. Each of them should call |tasks.next()| when
-  // completed or |tasks.finish()| to jump to the last one.
-  _tasks: [],
-  _nextTaskIndex: 0,
-
-  push: function(func) {
-    this._tasks.push(func);
-  },
-
-  next: function() {
-    let index = this._nextTaskIndex++;
-    let task = this._tasks[index];
-    try {
-      task();
-    } catch (ex) {
-      ok(false, "test task[" + index + "] throws: " + ex);
-      // Run last task as clean up if possible.
-      if (index != this._tasks.length - 1) {
-        this.finish();
-      }
-    }
-  },
-
-  finish: function() {
-    this._tasks[this._tasks.length - 1]();
-  },
-
-  run: function() {
-    this.next();
-  }
-};
-
-function setSetting(key, value, callback) {
-  let setLock = settings.createLock();
-  let obj = {};
-  obj[key] = value;
-
-  let setReq = setLock.set(obj);
-  setReq.addEventListener("success", function onSetSuccess() {
-    ok(true, "set '" + key + "' to " + obj[key]);
-    if (callback) {
-      callback();
-    }
-  });
-  setReq.addEventListener("error", function onSetError() {
-    ok(false, "cannot set '" + key + "'");
-    tasks.finish();
-  });
-}
-
-function getSetting(key, callback) {
-  let getLock = settings.createLock();
-
-  let getReq = getLock.get(key);
-  getReq.addEventListener("success", function onGetSuccess() {
-    ok(true, "get " + key + " setting okay");
-    let value = getReq.result[key];
-    callback(value);
-  });
-  getReq.addEventListener("error", function onGetError() {
-    ok(false, "cannot get '" + key + "'");
-    tasks.finish();
-  });
-}
-
-function setEmulatorAPN(callback) {
-  let apn =
-    [
-      [
-        {"carrier":"T-Mobile US",
-         "apn":"epc.tmobile.com",
-         "mmsc":"http://mms.msg.eng.t-mobile.com/mms/wapenc",
-         "types":["default","supl","mms"]}
-      ]
-    ];
-  setSetting(APN_KEY, apn, callback);
-}
-
-function setEmulatorRoaming(roaming, callback) {
-  log("Setting emulator roaming state: " + roaming + ".");
-
-  // Set voice registration state first and then data registration state.
-  let cmd = "gsm voice " + (roaming ? "roaming" : "home");
-  sendCmdToEmulator(cmd, function() {
-
-    connection.addEventListener("voicechange", function onvoicechange() {
-      connection.removeEventListener("voicechange", onvoicechange);
-      log("mobileConnection.voice.roaming is now '"
-        + connection.voice.roaming + "'.");
-      is(connection.voice.roaming, roaming, "voice.roaming");
-
-      let cmd = "gsm data " + (roaming ? "roaming" : "home");
-      sendCmdToEmulator(cmd, function() {
-
-        connection.addEventListener("datachange", function ondatachange() {
-          connection.removeEventListener("datachange", ondatachange);
-          log("mobileConnection.data.roaming is now '"
-            + connection.data.roaming + "'.");
-          is(connection.data.roaming, roaming, "data.roaming");
-          if (callback) {
-            callback();
-          }
-        });
-      });
-    });
-  });
-}
-
-function setEmulatorHome(callback) {
-  let voiceRegistration = false;
-  let dataRegistration = false;
-
-  if (connection.voice.state != "registered") {
-    sendCmdToEmulator("gsm voice home", function() {
-      connection.addEventListener("voicechange", function onvoicechange() {
-        connection.removeEventListener("voicechange", onvoicechange);
-        log("mobileConnection.voice.state is now '"
-          + connection.voice.state + "'.");
-        is(connection.voice.state, "registered", "voice.state");
-        voiceRegistration = true;
-      });
-    });
-  } else {
-    voiceRegistration = true;
-  }
-
-  if (connection.data.state != "registered") {
-    sendCmdToEmulator("gsm data home", function() {
-      connection.addEventListener("datachange", function ondatachange() {
-        connection.removeEventListener("datachange", ondatachange);
-        log("mobileConnection.data.state is now '"
-          + connection.data.state + "'.");
-        is(connection.data.state, "registered", "data.state");
-        dataRegistration = true;
-      });
-    });
-  } else {
-    dataRegistration = true;
-  }
-
-  waitFor(callback, function() {
-    return (voiceRegistration && dataRegistration);
-  });
-}
-
-
-tasks.push(function verifyInitialState() {
-  log("Verifying initial state.");
-
-  // Want to start test with mobileConnection.data.state 'registered',
-  // This is the default state; if it is not currently this value then set it.
-  setEmulatorHome(function() {
-    // Want to start test with data off,
-    // This is the default state; if it is not currently this value then set it.
-    getSetting(DATA_KEY, function(result) {
-      let value = result;
-      log("Starting data enabled: " + value);
-      if (value) {
-        setSetting(DATA_KEY, false);
-
-        connection.addEventListener("datachange", function ondatachange() {
-          connection.removeEventListener("datachange", ondatachange);
-          log("mobileConnection.data.connected is now '"
-            + connection.data.connected + "'.");
-          is(connection.data.connected, false, "data.connected");
-          setEmulatorAPN(function() {
-            tasks.next();
-          });
-        });
-      } else {
-        setEmulatorAPN(function() {
-          tasks.next();
-        });
-      }
-    });
-  });
-});
-
-tasks.push(function testEnableData() {
-  log("Turn data on.");
-
-  connection.addEventListener("datachange", function ondatachange() {
-    connection.removeEventListener("datachange", ondatachange);
-    log("mobileConnection.data.connected is now '"
-      + connection.data.connected + "'.");
-    is(connection.data.connected, true, "data.connected");
-    tasks.next();
-  });
-
-  setSetting(DATA_KEY, true);
-});
-
-tasks.push(function testUnregisterDataWhileDataEnabled() {
-  log("Set data registration unregistered while data enabled.");
-
-  // When data registration is unregistered, all data calls
-  // will be automatically deactivated.
-  sendCmdToEmulator("gsm data unregistered", function() {
-    connection.addEventListener("datachange", function ondatachange() {
-      log("mobileConnection.data.state is now '"
-        + connection.data.state + "'.");
-      if (connection.data.state == "notSearching") {
-        connection.removeEventListener("datachange", ondatachange);
-        log("mobileConnection.data.connected is now '"
-          + connection.data.connected + "'.");
-        is(connection.data.connected, false, "data.connected");
-        tasks.next();
-      }
-    });
-  });
-});
-
-tasks.push(function testRegisterDataWhileDataEnabled() {
-  log("Set data registration home while data enabled.");
-
-  // When data registration is registered, data call will be
-  // (re)activated by gecko if ril.data.enabled is set to true.
-  sendCmdToEmulator("gsm data home", function() {
-    connection.addEventListener("datachange", function ondatachange() {
-      connection.removeEventListener("datachange", ondatachange);
-      log("mobileConnection.data.state is now '"
-        + connection.data.state + "'.");
-      is(connection.data.state, "registered", "data.state");
-
-      connection.addEventListener("datachange", function ondatachange() {
-        connection.removeEventListener("datachange", ondatachange);
-        log("mobileConnection.data.connected is now '"
-          + connection.data.connected + "'.");
-        is(connection.data.connected, true, "data.connected");
-        tasks.next();
-      });
-    });
-  });
-});
-
-tasks.push(function testDisableDataRoamingWhileRoaming() {
-  log("Disable data roaming while roaming.");
-
-  setSetting(DATA_ROAMING_KEY, false);
-
-  // Wait for roaming state to change, then data connection should
-  // be disconnected due to data roaming set to off.
-  setEmulatorRoaming(true, function() {
-    connection.addEventListener("datachange", function ondatachange() {
-      connection.removeEventListener("datachange", ondatachange);
-      log("mobileConnection.data.connected is now '"
-        + connection.data.connected + "'.");
-      is(connection.data.connected, false, "data.connected");
-      tasks.next();
-    });
-  });
-});
-
-tasks.push(function testEnableDataRoamingWhileRoaming() {
-  log("Enable data roaming while roaming.");
-
-  // Data should be re-connected as we enabled data roaming.
-  connection.addEventListener("datachange", function ondatachange() {
-    connection.removeEventListener("datachange", ondatachange);
-    log("mobileConnection.data.connected is now '"
-      + connection.data.connected + "'.");
-    is(connection.data.connected, true, "data.connected");
-    tasks.next();
-  });
-
-  setSetting(DATA_ROAMING_KEY, true);
-});
-
-tasks.push(function testDisableDataRoamingWhileNotRoaming() {
-  log("Disable data roaming while not roaming.");
-
-  // Wait for roaming state to change then set data roaming back
-  // to off.
-  setEmulatorRoaming(false, function() {
-    setSetting(DATA_ROAMING_KEY, false);
-
-    // No change event will be received cause data connection state
-    // remains the same.
-    window.setTimeout(function() {
-      is(connection.data.connected, true, "data.connected");
-      tasks.next();
-    }, 1000);
-  });
-});
-
-tasks.push(function testDisableData() {
-  log("Turn data off.");
-
-  connection.addEventListener("datachange", function ondatachange() {
-    connection.removeEventListener("datachange", ondatachange);
-    log("mobileConnection.data.connected is now '"
-      + connection.data.connected + "'.");
-    is(connection.data.connected, false, "data.connected");
-    tasks.next();
-  });
-
-  setSetting(DATA_KEY, false);
-});
-
-// WARNING: All tasks should be pushed before this!!!
-tasks.push(function cleanUp() {
-  if (pendingEmulatorCmdCount) {
-    window.setTimeout(cleanUp, 100);
-    return;
-  }
-
-  SpecialPowers.removePermission("mobileconnection", document);
-  SpecialPowers.removePermission("settings-write", document);
-  SpecialPowers.removePermission("settings-read", document);
-  SpecialPowers.clearUserPref("dom.mozSettings.enabled");
-  finish();
-});
-
-tasks.run();
-
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_data_location.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 20000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let mobileConnection;
-ifr.onload = function() {
-  mobileConnection = ifr.contentWindow.navigator.mozMobileConnections[0];
-
-  // Start the test
-  verifyInitialState();
-};
-document.body.appendChild(ifr);
-
-let emulatorStartLac = 0;
-let emulatorStartCid = 0;
-
-function verifyInitialState() {
-  log("Verifying initial state.");
-  ok(mobileConnection instanceof MozMobileConnection,
-      "mobileConnection is instanceof " + mobileConnection.constructor);
-  testStartingCellLocation();
-}
-
-function testStartingCellLocation() {
-  // Get the current emulator data cell location
-  log("Getting the starting GSM location from the emulator.");
-
-  runEmulatorCmd("gsm location", function(result) {
-    log("Emulator callback.");
-    is(result[0].substring(0,3), "lac", "lac output");
-    is(result[1].substring(0,2), "ci", "ci output");
-    is(result[2], "OK", "emulator ok");
-
-    emulatorStartLac = result[0].substring(5);
-    log("Emulator GSM location LAC is '" + emulatorStartLac + "'.");
-    emulatorStartCid = result[1].substring(4);
-    log("Emulator GSM location CID is '" + emulatorStartCid + "'.");
-
-    log("mobileConnection.data.cell.gsmLocationAreaCode is '"
-        + mobileConnection.data.cell.gsmLocationAreaCode + "'.");
-    log("mobileConnection.data.cell.gsmCellId is '"
-        + mobileConnection.data.cell.gsmCellId + "'.");
-
-    // Verify the mobileConnection.data.cell location matches emulator values
-    if (emulatorStartLac == -1) {
-      // Emulator initializes LAC to -1, corresponds to these values
-      is(mobileConnection.data.cell.gsmLocationAreaCode,
-          65535, "starting LAC");
-    } else {
-      // A previous test changed the LAC, so verify API matches emulator
-      is(mobileConnection.data.cell.gsmLocationAreaCode,
-          emulatorStartLac, "starting LAC");
-    }
-    if (emulatorStartCid == -1) {
-      // Emulator initializes CID to -1, corresponds to these values
-      is(mobileConnection.data.cell.gsmCellId, 268435455, "starting CID");
-    } else {
-      // A previous test changed the CID, so verify API matches emulator
-      is(mobileConnection.data.cell.gsmCellId,
-          emulatorStartCid, "starting CID");
-    }
-
-    // Now test changing the GSM location
-    testChangeCellLocation(emulatorStartLac, emulatorStartCid);
-  });
-}
-
-function testChangeCellLocation() {
-  // Change emulator GSM location and verify mobileConnection.data.cell values
-  let newLac = 1000;
-  let newCid = 2000;
-  let gotCallback = false;
-
-  // Ensure values will actually be changed
-  if (newLac == emulatorStartLac) { newLac++; };
-  if (newCid == emulatorStartCid) { newCid++; };
-
-  // Setup 'ondatachange' event listener
-  mobileConnection.addEventListener("datachange", function ondatachange() {
-    mobileConnection.removeEventListener("datachange", ondatachange);
-    log("Received 'ondatachange' event.");
-    log("mobileConnection.data.cell.gsmLocationAreaCode is now '"
-        + mobileConnection.data.cell.gsmLocationAreaCode + "'.");
-    log("mobileConnection.data.cell.gsmCellId is now '"
-        + mobileConnection.data.cell.gsmCellId + "'.");
-    is(mobileConnection.data.cell.gsmLocationAreaCode, newLac,
-        "data.cell.gsmLocationAreaCode");
-    is(mobileConnection.data.cell.gsmCellId, newCid, "data.cell.gsmCellId");
-    waitFor(restoreLocation, function() {
-      return(gotCallback);
-    });
-  });
-
-  // Use emulator command to change GSM location
-  log("Changing emulator GSM location to '" + newLac + ", " + newCid
-      + "' and waiting for 'ondatachange' event.");
-  gotCallback = false;
-  runEmulatorCmd("gsm location " + newLac + " " + newCid, function(result) {
-    is(result[0], "OK");
-    log("Emulator callback on location change.");
-    gotCallback = true;
-  });
-}
-
-function restoreLocation() {
-  // Restore the emulator GSM location back to what it was originally
-  log("Restoring emulator GSM location back to '" + emulatorStartLac + ", "
-      + emulatorStartCid + "'.");
-  runEmulatorCmd("gsm location " + emulatorStartLac + " " + emulatorStartCid,
-      function(result) {
-    log("Emulator callback on restore.");
-    is(result[0], "OK");
-    cleanUp();
-  });
-}
-
-function cleanUp() {
-  mobileConnection.ondatachange = null;
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_data_state.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let mobileConnection;
-ifr.onload = function() {
-  mobileConnection = ifr.contentWindow.navigator.mozMobileConnections[0];
-
-  // Start the test
-  verifyInitialState();
-};
-document.body.appendChild(ifr);
-
-function verifyInitialState() {
-  log("Verifying initial state.");
-  ok(mobileConnection instanceof MozMobileConnection,
-      "mobileConnection is instanceof " + mobileConnection.constructor);
-  // Want to start test with mobileConnection.data.state 'registered'
-  // This is the default state; if it is not currently this value then set it
-  log("Starting mobileConnection.data.state is: '"
-      + mobileConnection.data.state + "'.");
-  if (mobileConnection.data.state != "registered") {
-    changeDataStateAndVerify("home", "registered", testUnregistered);
-  } else {
-    testUnregistered();
-  }
-}
-
-function changeDataStateAndVerify(dataState, expected, nextFunction) {
-  let gotCallback = false;
-
-  // Change the mobileConnection.data.state via 'gsm data' command
-  log("Changing emulator data state to '" + dataState
-      + "' and waiting for 'ondatachange' event.");
-
-  // Setup 'ondatachange' event handler
-  mobileConnection.addEventListener("datachange", function ondatachange() {
-    mobileConnection.removeEventListener("datachange", ondatachange);
-    log("Received 'ondatachange' event.");
-    log("mobileConnection.data.state is now '"
-        + mobileConnection.data.state + "'.");
-    is(mobileConnection.data.state, expected, "data.state");
-    waitFor(nextFunction, function() {
-      return(gotCallback);
-    });
-  });
-
-  // Change the emulator data state
-  gotCallback = false;
-  runEmulatorCmd("gsm data " + dataState, function(result) {
-    is(result[0], "OK");
-    log("Emulator callback complete.");
-    gotCallback = true;
-  });
-}
-
-function testUnregistered() {
-  log("Test 1: Unregistered.");
-  // Set emulator data state to 'unregistered' and verify
-  // Expect mobileConnection.data.state to be 'notsearching'
-  changeDataStateAndVerify("unregistered", "notSearching", testRoaming);
-}
-
-function testRoaming() {
-  log("Test 2: Roaming.");
-  // Set emulator data state to 'roaming' and verify
-  // Expect mobileConnection.data.state to be 'registered'
-  changeDataStateAndVerify("roaming", "registered", testOff);
-}
-
-function testOff() {
-  log("Test 3: Off.");
-  // Set emulator data state to 'off' and verify
-  // Expect mobileConnection.data.state to be 'notsearching'
-  changeDataStateAndVerify("off", "notSearching", testSearching);
-}
-
-function testSearching() {
-  log("Test 4: Searching.");
-  // Set emulator data state to 'searching' and verify
-  // Expect mobileConnection.data.state to be 'searching'
-  changeDataStateAndVerify("searching", "searching", testDenied);
-}
-
-function testDenied() {
-  log("Test 5: Denied.");
-  // Set emulator data state to 'denied' and verify
-  // Expect mobileConnection.data.state to be 'denied'
-  changeDataStateAndVerify("denied", "denied", testOn);
-}
-
-function testOn() {
-  log("Test 6: On.");
-  // Set emulator data state to 'on' and verify
-  // Expect mobileConnection.data.state to be 'registered'
-  changeDataStateAndVerify("on", "registered", testOffAgain);
-}
-
-function testOffAgain() {
-  log("Test 7: Off again.");
-  // Set emulator data state to 'off' and verify
-  // Expect mobileConnection.data.state to be 'notsearching'
-  changeDataStateAndVerify("off", "notSearching", testHome);
-}
-
-function testHome() {
-  log("Test 8: Home.");
-  // Set emulator data state to 'home' and verify
-  // Expect mobileConnection.data.state to be 'registered'
-  changeDataStateAndVerify("home", "registered", cleanUp);
-}
-
-function cleanUp() {
-  mobileConnection.ondatachange = null;
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_mmi.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 20000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let mobileConnection;
-ifr.onload = function() {
-  mobileConnection = ifr.contentWindow.navigator.mozMobileConnections[0];
-
-  tasks.run();
-};
-document.body.appendChild(ifr);
-
-let tasks = {
-  // List of test functions. Each of them should call |tasks.next()| when
-  // completed or |tasks.abort()| to jump to the last one.
-  _tasks: [],
-  _nextTaskIndex: 0,
-
-  push: function(func) {
-    this._tasks.push(func);
-  },
-
-  next: function() {
-    let index = this._nextTaskIndex++;
-    let task = this._tasks[index];
-    try {
-      task();
-    } catch (ex) {
-      ok(false, "test task[" + index + "] throws: " + ex);
-      // Run last task as clean up if possible.
-      if (index != this._tasks.length - 1) {
-        this.abort();
-      }
-    }
-  },
-
-  abort: function() {
-    this._tasks[this._tasks.length - 1]();
-  },
-
-  run: function() {
-    this.next();
-  }
-};
-
-tasks.push(function verifyInitialState() {
-  log("Verifying initial state.");
-
-  ok(mobileConnection instanceof ifr.contentWindow.MozMobileConnection,
-      "mobileConnection is instanceof " + mobileConnection.constructor);
-
-  tasks.next();
-});
-
-tasks.push(function testGettingIMEI() {
-  log("Test *#06# ...");
-
-  let request = mobileConnection.sendMMI("*#06#");
-  ok(request instanceof DOMRequest,
-     "request is instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess(event) {
-    ok(true, "request success");
-    is(typeof event.target.result, "object", "typeof result object");
-    ok(event.target.result instanceof Object, "result instanceof Object");
-    is(event.target.result.statusMessage, "000000000000000", "Emulator IMEI");
-    is(event.target.result.serviceCode, "scImei", "Service code IMEI");
-    is(event.target.result.additionalInformation, undefined,
-       "No additional information");
-    tasks.next();
-  }
-  request.onerror = function onerror() {
-    ok(false, "request should not error");
-    tasks.abort();
-  };
-});
-
-tasks.push(function testInvalidMMICode(){
-  log("Test invalid MMI code ...");
-
-  let request = mobileConnection.sendMMI("InvalidMMICode");
-  ok(request instanceof DOMRequest,
-     "request is instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess(event) {
-    ok(false, "request should not success");
-    tasks.abort();
-  };
-
-  request.onerror = function onerror() {
-    ok(true, "request error");
-    is(request.error.name, "emMmiError", "MMI error name");
-    tasks.next();
-  };
-});
-
-// WARNING: All tasks should be pushed before this!!!
-tasks.push(function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-});
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_networks.js
+++ /dev/null
@@ -1,238 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// getNetworks() can take some time..
-MARIONETTE_TIMEOUT = 60000;
- 
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-let connection = navigator.mozMobileConnections[0];
-ok(connection instanceof MozMobileConnection,
-   "connection is instanceof " + connection.constructor);
-
-is(connection.networkSelectionMode, "automatic");
-
-let androidNetwork = null;
-let telkilaNetwork = null;
-
-function isAndroidNetwork(network) {
-  is(network.longName, "Android");
-  is(network.shortName, "Android");
-  is(network.mcc, "310");
-  is(network.mnc, "260");
-}
-
-function isTelkilaNetwork(network) {
-  is(network.longName, "TelKila");
-  is(network.shortName, "TelKila");
-  is(network.mcc, "310");
-  is(network.mnc, "295");
-}
-
-function testConnectionInfo() {
-  let voice = connection.voice;
-  is(voice.connected, true);
-  is(voice.state, "registered");
-  is(voice.emergencyCallsOnly, false);
-  is(voice.roaming, false);
-  isAndroidNetwork(voice.network);
-
-  let data = connection.data;
-  // data.connected = true means there's an active data call which we
-  // can't predict here.
-  is(data.state, "registered");
-  is(data.emergencyCallsOnly, false);
-  is(data.roaming, false);
-  isAndroidNetwork(data.network);
-
-  testGetNetworks();
-}
-
-function testGetNetworks() {
-  let request = connection.getNetworks();
-  ok(request instanceof DOMRequest,
-     "request is instanceof " + request.constructor);
-
-  request.onerror = function() {
-    ok(false, request.error);
-    setTimeout(testSelectNetwork, 0);
-  };
-
-  request.onsuccess = function() {
-    ok('result' in request, "Request did not contain a result");
-    let networks = request.result;
-
-    // The emulator RIL server should always return 2 networks:
-    // {"longName":"Android","shortName":"Android","mcc":310,"mnc":260,"state":"available"}
-    // {"longName":"TelKila","shortName":"TelKila","mcc":310,"mnc":295,"state":"available"}
-    is(networks.length, 2);
-
-    let network1 = androidNetwork = networks[0];
-    isAndroidNetwork(network1);
-    is(network1.state, "available");
-
-    let network2 = telkilaNetwork = networks[1];
-    isTelkilaNetwork(network2);
-    is(network2.state, "available");
-
-    setTimeout(testSelectNetwork, 0);
-  };
-}
-
-function testSelectNetwork() {
-  let request = connection.selectNetwork(telkilaNetwork);
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  connection.addEventListener("voicechange", function voiceChange() {
-    connection.removeEventListener("voicechange", voiceChange);
-
-    isTelkilaNetwork(connection.voice.network);
-    setTimeout(testSelectNetworkAutomatically, 0);
-  });
-
-  request.onsuccess = function() {
-    is(connection.networkSelectionMode, "manual",
-       "selectNetwork sets mode to: " + connection.networkSelectionMode);
-  };
-
-  request.onerror = function() {
-    ok(false, request.error);
-    setTimeout(testSelectNetworkAutomatically, 0);
-  };
-}
-
-function testSelectNetworkAutomatically() {
-  let request = connection.selectNetworkAutomatically();
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  connection.addEventListener("voicechange", function voiceChange() {
-    connection.removeEventListener("voicechange", voiceChange);
-
-    isAndroidNetwork(connection.voice.network);
-    setTimeout(testSelectNetworkErrors, 0);
-  });
-
-  request.onsuccess = function() {
-    is(connection.networkSelectionMode, "automatic",
-       "selectNetworkAutomatically sets mode to: " +
-       connection.networkSelectionMode);
-  };
-
-  request.onerror = function() {
-    ok(false, request.error);
-    setTimeout(testSelectNetworkErrors, 0);
-  };
-}
-
-function throwsException(fn) {
-  try {
-    fn();
-    ok(false, "function did not throw an exception: " + fn);
-  } catch (e) {
-    ok(true, "function successfully caught exception: " + e);
-  }
-}
-
-function testSelectNetworkErrors() {
-  throwsException(function() {
-    connection.selectNetwork(null);
-  });
-
-  throwsException(function() {
-    connection.selectNetwork({});
-  });
-
-  connection.addEventListener("voicechange", function voiceChange() {
-    connection.removeEventListener("voicechange", voiceChange);
-    setTimeout(testSelectExistingNetworkManual, 0);
-  });
-
-  let request1 = connection.selectNetwork(telkilaNetwork);
-  request1.onerror = function() {
-    ok(false, request.error);
-    setTimeout(testSelectExistingNetworkManual, 0);
-  };
-
-  // attempt to selectNetwork while one request has already been sent
-  throwsException(function() {
-    connection.selectNetwork(androidNetwork);
-  });
-}
-
-function testSelectExistingNetworkManual() {
-  // When the current network is selected again, the DOMRequest's onsuccess
-  // should be called, but the network shouldn't actually change
-
-  // Telkila should be the currently selected network
-  log("Selecting TelKila (should already be selected");
-  let request = connection.selectNetwork(telkilaNetwork);
-
-  let voiceChanged = false;
-  connection.addEventListener("voicechange", function voiceChange() {
-    connection.removeEventListener("voicechange", voiceChange);
-    voiceChanged = true;
-  });
-
-  function nextTest() {
-    // Switch back to automatic selection to setup the next test
-    let autoRequest = connection.selectNetworkAutomatically();
-    autoRequest.onsuccess = function() {
-      setTimeout(testSelectExistingNetworkAuto, 0);
-    };
-    autoRequest.onerror = function() {
-      ok(false, autoRequest.error);
-      cleanUp();
-    };
-  }
-
-  request.onsuccess = function() {
-    // Give the voicechange event another opportunity to fire
-    setTimeout(function() {
-      is(voiceChanged, false,
-         "voiceNetwork changed while manually selecting Telkila network? " +
-         voiceChanged);
-      nextTest();
-    }, 0);
-  };
-
-  request.onerror = function() {
-    ok(false, request.error);
-    nextTest();
-  };
-}
-
-function testSelectExistingNetworkAuto() {
-  // Now try the same thing but using automatic selection
-  log("Selecting automatically (should already be auto)");
-  let request = connection.selectNetworkAutomatically();
-
-  let voiceChanged = false;
-  connection.addEventListener("voicechange", function voiceChange() {
-    connection.removeEventListener("voicechange", voiceChange);
-    voiceChanged = true;
-  });
-
-  request.onsuccess = function() {
-    // Give the voicechange event another opportunity to fire
-    setTimeout(function() {
-      is(voiceChanged, false,
-         "voiceNetwork changed while automatically selecting network? " +
-         voiceChanged);
-      cleanUp();
-    }, 0);
-  };
-
-  request.onerror = function() {
-    ok(false, request.error);
-    cleanUp();
-  };
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
-
-testConnectionInfo();
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_operator_names.js
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-const OPERATOR_HOME = 0;
-const OPERATOR_ROAMING = 1;
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let connection;
-let voice;
-let network;
-ifr.onload = function() {
-  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
-  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
-     "connection is instanceof " + connection.constructor);
-
-  voice = connection.voice;
-  ok(voice, "voice connection valid");
-
-  network = voice.network;
-  ok(network, "voice network info valid");
-
-  waitFor(testMobileOperatorNames, function() {
-    return voice.connected;
-  });
-};
-document.body.appendChild(ifr);
-
-let emulatorCmdPendingCount = 0;
-function sendEmulatorCommand(cmd, callback) {
-  emulatorCmdPendingCount++;
-  runEmulatorCmd(cmd, function(result) {
-    emulatorCmdPendingCount--;
-
-    is(result[result.length - 1], "OK");
-
-    callback(result);
-  });
-}
-
-function setEmulatorOperatorNamesAndMccMnc(which, longName, shortName,
-                                           mcc, mnc, callback) {
-  let cmd = "operator set " + which + " " + longName + "," +
-            shortName + "," + mcc + mnc;
-  sendEmulatorCommand(cmd, function(result) {
-    let re = new RegExp("^" + longName + "," +
-                        shortName + "," + mcc + mnc);
-    ok(result[which].match(re), "Long/short name and mcc/mnc should be changed.");
-
-    if (callback) {
-      window.setTimeout(callback, 0);
-    }
-  });
-}
-
-function setEmulatorOperatorNames(which, longName, shortName, callback) {
-  let cmd = "operator set " + which + " " + longName + "," + shortName;
-  sendEmulatorCommand(cmd, function(result) {
-    let re = new RegExp("^" + longName + "," + shortName + ",");
-    ok(result[which].match(re), "Long/short name should be changed.");
-
-    if (callback) {
-      window.setTimeout(callback, 0);
-    }
-  });
-}
-
-function setEmulatorRoaming(roaming, callback) {
-  let cmd = "gsm voice " + (roaming ? "roaming" : "home");
-  sendEmulatorCommand(cmd, function(result) {
-    is(result[0], "OK");
-
-    if (callback) {
-      window.setTimeout(callback, 0);
-    }
-  });
-}
-
-function checkValidMccMnc() {
-  is(network.mcc, "310", "network.mcc");
-  is(network.mnc, "260", "network.mnc");
-}
-
-function waitForVoiceChange(callback) {
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-    callback();
-  });
-}
-
-function doTestMobileOperatorNames(longName, shortName, callback) {
-  log("Testing '" + longName + "', '" + shortName + "':");
-
-  checkValidMccMnc();
-
-  waitForVoiceChange(function() {
-    is(network.longName, longName, "network.longName");
-    is(network.shortName, shortName, "network.shortName");
-
-    checkValidMccMnc();
-
-    window.setTimeout(callback, 0);
-  });
-
-  setEmulatorOperatorNames(OPERATOR_HOME, longName, shortName);
-}
-
-function testMobileOperatorNames() {
-  doTestMobileOperatorNames("Mozilla", "B2G", function() {
-    doTestMobileOperatorNames("Mozilla", "", function() {
-      doTestMobileOperatorNames("", "B2G", function() {
-        doTestMobileOperatorNames("", "", function() {
-          doTestMobileOperatorNames("Android", "Android", testOperatorPLMNList);
-        });
-      });
-    });
-  });
-}
-
-function doTestOperatorPLMNList(mcc, mnc, expectedLongName,
-                                expectedShortName, callback) {
-  log("Testing mcc = " + mcc + ", mnc = " + mnc + ":");
-
-  waitForVoiceChange(function() {
-    is(network.longName, expectedLongName, "network.longName");
-    is(network.shortName, expectedShortName, "network.shortName");
-    is(network.mcc, mcc, "network.mcc");
-    is(network.mnc, mnc, "network.mnc");
-    window.setTimeout(callback, 0);
-  });
-
-  setEmulatorOperatorNamesAndMccMnc(OPERATOR_HOME, "Android", "Android", mcc, mnc);
-}
-
-function testOperatorPLMNList() {
-  doTestOperatorPLMNList("123", "456", "Android", "Android", function() {
-    doTestOperatorPLMNList("310", "070", "AT&T", "", function() {
-      doTestOperatorPLMNList("310", "260", "Android", "Android", testRoamingCheck);
-    });
-  });
-}
-
-// See bug 797972 - B2G RIL: False roaming situation
-//
-// Steps to test:
-// 1. set roaming operator names
-// 2. set emulator roaming
-// 3. wait for onvoicechange event and test passing conditions
-// 4. set emulator roaming back to false
-// 5. wait for onvoicechange event again and callback
-function doTestRoamingCheck(longName, shortName, callback) {
-  log("Testing roaming check '" + longName + "', '" + shortName + "':");
-
-  setEmulatorOperatorNames(OPERATOR_ROAMING, longName, shortName,
-                           window.setTimeout.bind(window, function() {
-      let done = false;
-      function resetRoaming() {
-        if (!done) {
-          window.setTimeout(resetRoaming, 100);
-          return;
-        }
-
-        waitForVoiceChange(callback);
-        setEmulatorRoaming(false);
-      }
-
-      waitForVoiceChange(function() {
-        is(network.longName, longName, "network.longName");
-        is(network.shortName, shortName, "network.shortName");
-        is(voice.roaming, false, "voice.roaming");
-
-        resetRoaming();
-      });
-
-      setEmulatorRoaming(true, function() {
-        done = true;
-      });
-    }, 3000) // window.setTimeout.bind
-  ); // setEmulatorOperatorNames
-}
-
-function testRoamingCheck() {
-  // If Either long name or short name of current registered operator matches
-  // SPN("Android"), then the `roaming` attribute should be set to false.
-  doTestRoamingCheck("Android", "Android", function() {
-    doTestRoamingCheck("Android", "android", function() {
-      doTestRoamingCheck("Android", "Xxx", function() {
-        doTestRoamingCheck("android", "Android", function() {
-          doTestRoamingCheck("android", "android", function() {
-            doTestRoamingCheck("android", "Xxx", function() {
-              doTestRoamingCheck("Xxx", "Android", function() {
-                doTestRoamingCheck("Xxx", "android", function() {
-                  setEmulatorOperatorNames(OPERATOR_ROAMING, "TelKila", "TelKila",
-                                           window.setTimeout.bind(window, cleanUp, 3000));
-                });
-              });
-            });
-          });
-        });
-      });
-    });
-  });
-}
-
-function cleanUp() {
-  if (emulatorCmdPendingCount > 0) {
-    setTimeout(cleanUp, 100);
-    return;
-  }
-
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_preferred_network_type.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-let connection = navigator.mozMobileConnections[0];
-ok(connection instanceof MozMobileConnection,
-   "connection is instanceof " + connection.constructor);
-
-function testSupportedNetworkTypes() {
-  let supportedNetworkTypes = connection.supportedNetworkTypes;
-
-  ok(Array.isArray(supportedNetworkTypes), "supportedNetworkTypes should be an array");
-  ok(supportedNetworkTypes.indexOf("gsm") >= 0, "Should support 'gsm'");
-  ok(supportedNetworkTypes.indexOf("wcdma") >= 0, "Should support 'wcdma'");
-  ok(supportedNetworkTypes.indexOf("cdma") >= 0, "Should support 'cdma'");
-  ok(supportedNetworkTypes.indexOf("evdo") >= 0, "Should support 'evdo'");
-
-  runNextTest();
-}
-
-function setPreferredNetworkType(type, callback) {
-  log("setPreferredNetworkType: " + type);
-
-  let request = connection.setPreferredNetworkType(type);
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess() {
-    ok(true, "request success");
-    callback();
-  }
-  request.onerror = function onerror() {
-    ok(false, request.error);
-    callback();
-  }
-}
-
-function getPreferredNetworkType(callback) {
-  log("getPreferredNetworkType");
-
-  let request = connection.getPreferredNetworkType();
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess() {
-    ok(true, "request success");
-    log("getPreferredNetworkType: " + request.result);
-    callback(request.result);
-  }
-  request.onerror = function onerror() {
-    ok(false, request.error);
-    callback();
-  }
-}
-
-function failToSetPreferredNetworkType(type, expectedError, callback) {
-  log("failToSetPreferredNetworkType: " + type + ", expected error: "
-    + expectedError);
-
-  let request = connection.setPreferredNetworkType(type);
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess() {
-    ok(false, "request should not succeed");
-    callback();
-  }
-  request.onerror = function onerror() {
-    ok(true, "request error");
-    is(request.error.name, expectedError);
-    callback();
-  }
-}
-
-function setAndVerifyNetworkType(type) {
-  setPreferredNetworkType(type, function() {
-    getPreferredNetworkType(function(result) {
-      is(result, type);
-      testPreferredNetworkTypes();
-    });
-  });
-}
-
-function testPreferredNetworkTypes() {
-  let networkType = supportedTypes.shift();
-  if (!networkType) {
-    runNextTest();
-    return;
-  }
-  setAndVerifyNetworkType(networkType);
-}
-
-function failToSetAndVerifyNetworkType(type, expectedError, previousType) {
-  failToSetPreferredNetworkType(type, expectedError, function() {
-    getPreferredNetworkType(function(result) {
-      // should return the previous selected type.
-      is(result, previousType);
-      testInvalidNetworkTypes();
-    });
-  });
-}
-
-function testInvalidNetworkTypes() {
-  let networkType = invalidTypes.shift();
-  if (!networkType) {
-    runNextTest();
-    return;
-  }
-  failToSetAndVerifyNetworkType(networkType, "InvalidParameter",
-                                "wcdma/gsm");
-}
-
-let supportedTypes = [
-  'gsm',
-  'wcdma',
-  'wcdma/gsm-auto',
-  'cdma/evdo',
-  'evdo',
-  'cdma',
-  'wcdma/gsm/cdma/evdo',
-  'wcdma/gsm' // restore to default
-];
-
-let invalidTypes = [
-  ' ',
-  'AnInvalidType'
-];
-
-let tests = [
-  testSupportedNetworkTypes,
-  testPreferredNetworkTypes,
-  testInvalidNetworkTypes
-];
-
-function runNextTest() {
-  let test = tests.shift();
-  if (!test) {
-    cleanUp();
-    return;
-  }
-
-  test();
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
-
-runNextTest();
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_preferred_network_type_by_setting.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-const KEY = "ril.radio.preferredNetworkType";
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
-
-let settings = window.navigator.mozSettings;
-
-function test_revert_previous_setting_on_invalid_value() {
-  log("Testing reverting to previous setting on invalid value received");
-
-  let getLock = settings.createLock();
-  let getReq = getLock.get(KEY);
-  getReq.addEventListener("success", function onGetSuccess() {
-    let originalValue = getReq.result[KEY] || "wcdma/gsm";
-
-    let setDone = false;
-    settings.addObserver(KEY, function observer(setting) {
-      // Mark if the invalid value has been set in db and wait.
-      if (setting.settingValue == obj[KEY]) {
-        setDone = true;
-        return;
-      }
-
-      // Skip any change before marking but keep it as original value.
-      if (!setDone) {
-        originalValue = setting.settingValue;
-        return;
-      }
-
-      settings.removeObserver(KEY, observer);
-      is(setting.settingValue, originalValue, "Settings reverted");
-      window.setTimeout(cleanUp, 0);
-    });
-
-    let obj = {};
-    obj[KEY] = "AnInvalidValue";
-    let setLock = settings.createLock();
-    setLock.set(obj);
-    setLock.addEventListener("error", function onSetError() {
-      ok(false, "cannot set '" + KEY + "'");
-    });
-  });
-  getReq.addEventListener("error", function onGetError() {
-    ok(false, "cannot get default value of '" + KEY + "'");
-  });
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  SpecialPowers.removePermission("settings-write", document);
-  SpecialPowers.removePermission("settings-read", document);
-
-  finish();
-}
-
-waitFor(test_revert_previous_setting_on_invalid_value, function() {
-  return navigator.mozMobileConnections[0].voice.connected;
-});
-
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_roaming_preference.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-let connection = navigator.mozMobileConnections[0];
-ok(connection instanceof MozMobileConnection,
-   "connection is instanceof " + connection.constructor);
-
-function failedToSetRoamingPreference(mode, expectedErrorMessage, callback) {
-  let request = connection.setRoamingPreference(mode);
-
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess() {
-    ok(false, "Should not be here !!");
-
-    callback();
-  }
-
-  request.onerror = function onerror() {
-    is(request.error.name, expectedErrorMessage);
-
-    callback();
-  }
-}
-
-function testSetRoamingPreferenceWithNullValue() {
-  log("test setRoamingPreference(null)");
-
-  failedToSetRoamingPreference(null, "InvalidParameter", runNextTest);
-}
-
-function testSetRoamingPreferenceWithInvalidValue() {
-  log("test setRoamingPreference(\"InvalidValue\")");
-
-  failedToSetRoamingPreference("InvalidValue", "InvalidParameter", runNextTest);
-}
-
-function testSetRoamingPreferenceToHome() {
-  log("test setRoamingPreference(\"home\")");
-
-  // TODO: Bug 896394.
-  // Currently emulator run as GSM mode by default. So we expect to get a
-  // 'RequestNotSupported' error here.
-  failedToSetRoamingPreference("home", "RequestNotSupported", runNextTest);
-}
-
-function testGetRoamingPreference() {
-  log("test getRoamingPreference()");
-
-  // TODO: Bug 896394.
-  // Currently emulator run as GSM mode by default. So we expect to get a
-  // 'RequestNotSupported' error here.
-  let request = connection.getRoamingPreference();
-
-  ok(request instanceof DOMRequest,
-     "request instanceof " + request.constructor);
-
-  request.onsuccess = function onsuccess() {
-    ok(false, "Should not be here !!");
-
-    runNextTest();
-  }
-
-  request.onerror = function onerror() {
-    is(request.error.name, "RequestNotSupported");
-
-    runNextTest();
-  }
-}
-
-let tests = [
-  testSetRoamingPreferenceWithNullValue,
-  testSetRoamingPreferenceWithInvalidValue,
-  testSetRoamingPreferenceToHome,
-  testGetRoamingPreference
-];
-
-function runNextTest() {
-  let test = tests.shift();
-  if (!test) {
-    cleanUp();
-    return;
-  }
-
-  test();
-}
-
-function cleanUp() {
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
-
-runNextTest();
\ No newline at end of file
deleted file mode 100644
--- a/dom/network/tests/marionette/test_mobile_voice_state.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-
-// Permission changes can't change existing Navigator.prototype
-// objects, so grab our objects from a new Navigator
-let ifr = document.createElement("iframe");
-let connection;
-ifr.onload = function() {
-  connection = ifr.contentWindow.navigator.mozMobileConnections[0];
-  ok(connection instanceof ifr.contentWindow.MozMobileConnection,
-     "connection is instanceof " + connection.constructor);
-  testConnectionInfo();
-};
-document.body.appendChild(ifr);
-
-let emulatorCmdPendingCount = 0;
-function setEmulatorVoiceState(state) {
-  emulatorCmdPendingCount++;
-  runEmulatorCmd("gsm voice " + state, function(result) {
-    emulatorCmdPendingCount--;
-    is(result[0], "OK");
-  });
-}
-
-function setEmulatorGsmLocation(lac, cid) {
-  emulatorCmdPendingCount++;
-  runEmulatorCmd("gsm location " + lac + " " + cid, function(result) {
-    emulatorCmdPendingCount--;
-    is(result[0], "OK");
-  });
-}
-
-function testConnectionInfo() {
-  let voice = connection.voice;
-  is(voice.connected, true);
-  is(voice.state, "registered");
-  is(voice.emergencyCallsOnly, false);
-  is(voice.roaming, false);
-
-  testCellLocation();
-}
-
-function testCellLocation() {
-  let cell = connection.voice.cell;
-
-  // Emulator always reports valid lac/cid value because its AT command parser
-  // insists valid value for every complete response. See source file
-  // hardare/ril/reference-ril/at_tok.c, function at_tok_nexthexint().
-  ok(cell, "location available");
-
-  // Initial LAC/CID. Android emulator initializes both value to 0xffff/0xffffffff.
-  is(cell.gsmLocationAreaCode, 65535);
-  is(cell.gsmCellId, 268435455);
-  is(cell.cdmaBaseStationId, -1);
-  is(cell.cdmaBaseStationLatitude, -2147483648);
-  is(cell.cdmaBaseStationLongitude, -2147483648);
-  is(cell.cdmaSystemId, -1);
-  is(cell.cdmaNetworkId, -1);
-
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-
-    is(cell.gsmLocationAreaCode, 100);
-    is(cell.gsmCellId, 100);
-    is(cell.cdmaBaseStationId, -1);
-    is(cell.cdmaBaseStationLatitude, -2147483648);
-    is(cell.cdmaBaseStationLongitude, -2147483648);
-    is(cell.cdmaSystemId, -1);
-    is(cell.cdmaNetworkId, -1);
-
-    testSignalStrength();
-  });
-
-  setEmulatorGsmLocation(100, 100);
-}
-
-function testSignalStrength() {
-  // Android emulator initializes the signal strength to -99 dBm
-  is(connection.voice.signalStrength, -99);
-  is(connection.voice.relSignalStrength, 44);
-
-  testUnregistered();
-}
-
-function testUnregistered() {
-  setEmulatorVoiceState("unregistered");
-
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-
-    is(connection.voice.connected, false);
-    is(connection.voice.state, "notSearching");
-    is(connection.voice.emergencyCallsOnly, true);
-    is(connection.voice.roaming, false);
-    is(connection.voice.cell, null);
-    is(connection.voice.signalStrength, null);
-    is(connection.voice.relSignalStrength, null);
-
-    testSearching();
-  });
-}
-
-function testSearching() {
-  setEmulatorVoiceState("searching");
-
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-
-    is(connection.voice.connected, false);
-    is(connection.voice.state, "searching");
-    is(connection.voice.emergencyCallsOnly, true);
-    is(connection.voice.roaming, false);
-    is(connection.voice.cell, null);
-    is(connection.voice.signalStrength, null);
-    is(connection.voice.relSignalStrength, null);
-
-    testDenied();
-  });
-}
-
-function testDenied() {
-  setEmulatorVoiceState("denied");
-
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-
-    is(connection.voice.connected, false);
-    is(connection.voice.state, "denied");
-    is(connection.voice.emergencyCallsOnly, true);
-    is(connection.voice.roaming, false);
-    is(connection.voice.cell, null);
-    is(connection.voice.signalStrength, null);
-    is(connection.voice.relSignalStrength, null);
-
-    testRoaming();
-  });
-}
-
-function testRoaming() {
-  setEmulatorVoiceState("roaming");
-
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-
-    is(connection.voice.connected, true);
-    is(connection.voice.state, "registered");
-    is(connection.voice.emergencyCallsOnly, false);
-    is(connection.voice.roaming, true);
-
-    // Android emulator initializes the signal strength to -99 dBm
-    is(connection.voice.signalStrength, -99);
-    is(connection.voice.relSignalStrength, 44);
-
-    testHome();
-  });
-}
-
-function testHome() {
-  setEmulatorVoiceState("home");
-
-  connection.addEventListener("voicechange", function onvoicechange() {
-    connection.removeEventListener("voicechange", onvoicechange);
-
-    is(connection.voice.connected, true);
-    is(connection.voice.state, "registered");
-    is(connection.voice.emergencyCallsOnly, false);
-    is(connection.voice.roaming, false);
-
-    // Android emulator initializes the signal strength to -99 dBm
-    is(connection.voice.signalStrength, -99);
-    is(connection.voice.relSignalStrength, 44);
-
-    cleanUp();
-  });
-}
-
-function cleanUp() {
-  if (emulatorCmdPendingCount > 0) {
-    setTimeout(cleanUp, 100);
-    return;
-  }
-
-  SpecialPowers.removePermission("mobileconnection", document);
-  finish();
-}
--- a/testing/marionette/client/marionette/tests/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit-tests.ini
@@ -15,12 +15,12 @@ skip = false
 [include:unit/unit-tests.ini]
 
 ; webapi tests
 [include:../../../../../dom/bluetooth/tests/marionette/manifest.ini]
 [include:../../../../../dom/telephony/test/marionette/manifest.ini]
 [include:../../../../../dom/voicemail/test/marionette/manifest.ini]
 [include:../../../../../dom/battery/test/marionette/manifest.ini]
 [include:../../../../../dom/mobilemessage/tests/marionette/manifest.ini]
-[include:../../../../../dom/network/tests/marionette/manifest.ini]
+[include:../../../../../dom/mobileconnection/tests/marionette/manifest.ini]
 [include:../../../../../dom/system/gonk/tests/marionette/manifest.ini]
 [include:../../../../../dom/icc/tests/marionette/manifest.ini]
 [include:../../../../../dom/system/tests/marionette/manifest.ini]
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -63,16 +63,17 @@ using namespace mozilla::widget;
 
 nsIntRect gScreenBounds;
 static uint32_t sScreenRotation;
 static uint32_t sPhysicalScreenRotation;
 static nsIntRect sVirtualBounds;
 
 static nsRefPtr<GLContext> sGLContext;
 static nsTArray<nsWindow *> sTopWindows;
+static nsWindow *gWindowToRedraw = nullptr;
 static nsWindow *gFocusedWindow = nullptr;
 static bool sFramebufferOpen;
 static bool sUsingOMTC;
 static bool sUsingHwc;
 static bool sScreenInitialized;
 static nsRefPtr<gfxASurface> sOMTCSurface;
 
 namespace {
@@ -179,34 +180,30 @@ nsWindow::~nsWindow()
 void
 nsWindow::DoDraw(void)
 {
     if (!hal::GetScreenEnabled()) {
         gDrawRequest = true;
         return;
     }
 
-    if (sTopWindows.IsEmpty()) {
+    if (!gWindowToRedraw) {
         LOG("  no window to draw, bailing");
         return;
     }
 
-    nsWindow *targetWindow = (nsWindow *)sTopWindows[0];
-    while (targetWindow->GetLastChild())
-        targetWindow = (nsWindow *)targetWindow->GetLastChild();
+    nsIntRegion region = gWindowToRedraw->mDirtyRegion;
+    gWindowToRedraw->mDirtyRegion.SetEmpty();
 
-    nsIntRegion region = sTopWindows[0]->mDirtyRegion;
-    sTopWindows[0]->mDirtyRegion.SetEmpty();
-
-    nsIWidgetListener* listener = targetWindow->GetWidgetListener();
+    nsIWidgetListener* listener = gWindowToRedraw->GetWidgetListener();
     if (listener) {
-        listener->WillPaintWindow(targetWindow);
+        listener->WillPaintWindow(gWindowToRedraw);
     }
 
-    LayerManager* lm = targetWindow->GetLayerManager();
+    LayerManager* lm = gWindowToRedraw->GetLayerManager();
     if (mozilla::layers::LAYERS_CLIENT == lm->GetBackendType()) {
       // No need to do anything, the compositor will handle drawing
     } else if (mozilla::layers::LAYERS_BASIC == lm->GetBackendType()) {
         MOZ_ASSERT(sFramebufferOpen || sUsingOMTC);
         nsRefPtr<gfxASurface> targetSurface;
 
         if(sUsingOMTC)
             targetSurface = sOMTCSurface;
@@ -215,34 +212,34 @@ nsWindow::DoDraw(void)
 
         {
             nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
             gfxUtils::PathFromRegion(ctx, region);
             ctx->Clip();
 
             // No double-buffering needed.
             AutoLayerManagerSetup setupLayerManager(
-                targetWindow, ctx, mozilla::layers::BUFFER_NONE,
+                gWindowToRedraw, ctx, mozilla::layers::BUFFER_NONE,
                 ScreenRotation(EffectiveScreenRotation()));
 
-            listener = targetWindow->GetWidgetListener();
+            listener = gWindowToRedraw->GetWidgetListener();
             if (listener) {
-                listener->PaintWindow(targetWindow, region);
+                listener->PaintWindow(gWindowToRedraw, region);
             }
         }
 
         if (!sUsingOMTC) {
             targetSurface->Flush();
             Framebuffer::Present(region);
         }
     } else {
         NS_RUNTIMEABORT("Unexpected layer manager type");
     }
 
-    listener = targetWindow->GetWidgetListener();
+    listener = gWindowToRedraw->GetWidgetListener();
     if (listener) {
         listener->DidPaintWindow();
     }
 }
 
 nsEventStatus
 nsWindow::DispatchInputEvent(WidgetGUIEvent& aEvent, bool* aWasCaptured)
 {
@@ -279,20 +276,21 @@ nsWindow::Create(nsIWidget *aParent,
                  nsDeviceContext *aContext,
                  nsWidgetInitData *aInitData)
 {
     BaseCreate(aParent, IS_TOPLEVEL() ? sVirtualBounds : aRect,
                aContext, aInitData);
 
     mBounds = aRect;
 
-    mParent = (nsWindow *)aParent;
+    nsWindow *parent = (nsWindow *)aNativeParent;
+    mParent = parent;
     mVisible = false;
 
-    if (!aParent) {
+    if (!aNativeParent) {
         mBounds = sVirtualBounds;
     }
 
     if (!IS_TOPLEVEL())
         return NS_OK;
 
     sTopWindows.AppendElement(this);
 
@@ -300,16 +298,18 @@ nsWindow::Create(nsIWidget *aParent,
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Destroy(void)
 {
     mOnDestroyCalled = true;
     sTopWindows.RemoveElement(this);
+    if (this == gWindowToRedraw)
+        gWindowToRedraw = nullptr;
     if (this == gFocusedWindow)
         gFocusedWindow = nullptr;
     nsBaseWidget::OnDestroy();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Show(bool aState)
@@ -376,18 +376,18 @@ nsWindow::Resize(double aX,
                  double aHeight,
                  bool   aRepaint)
 {
     mBounds = nsIntRect(NSToIntRound(aX), NSToIntRound(aY),
                         NSToIntRound(aWidth), NSToIntRound(aHeight));
     if (mWidgetListener)
         mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
 
-    if (aRepaint)
-        Invalidate(sVirtualBounds);
+    if (aRepaint && gWindowToRedraw)
+        gWindowToRedraw->Invalidate(sVirtualBounds);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Enable(bool aState)
 {
     return NS_OK;
@@ -413,23 +413,24 @@ NS_IMETHODIMP
 nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>&)
 {
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Invalidate(const nsIntRect &aRect)
 {
-    nsWindow *top = mParent;
-    while (top && top->mParent)
-        top = top->mParent;
-    if (top != sTopWindows[0] && this != sTopWindows[0])
+    nsWindow *parent = mParent;
+    while (parent && parent != sTopWindows[0])
+        parent = parent->mParent;
+    if (parent != sTopWindows[0])
         return NS_OK;
 
     mDirtyRegion.Or(mDirtyRegion, aRect);
+    gWindowToRedraw = this;
     gDrawRequest = true;
     mozilla::NotifyEvent();
     return NS_OK;
 }
 
 nsIntPoint
 nsWindow::WidgetToScreenOffset()
 {
@@ -447,16 +448,18 @@ nsWindow::WidgetToScreenOffset()
 }
 
 void*
 nsWindow::GetNativeData(uint32_t aDataType)
 {
     switch (aDataType) {
     case NS_NATIVE_WINDOW:
         return GetGonkDisplay()->GetNativeWindow();
+    case NS_NATIVE_WIDGET:
+        return this;
     }
     return nullptr;
 }
 
 NS_IMETHODIMP
 nsWindow::DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus)
 {
     if (mWidgetListener)
@@ -758,22 +761,22 @@ nsScreenGonk::SetRotation(uint32_t aRota
     if (rotation == nsIScreen::ROTATION_90_DEG ||
         rotation == nsIScreen::ROTATION_270_DEG) {
         sVirtualBounds = nsIntRect(0, 0, gScreenBounds.height,
                                    gScreenBounds.width);
     } else {
         sVirtualBounds = gScreenBounds;
     }
 
-    nsAppShell::NotifyScreenRotation();
-
     for (unsigned int i = 0; i < sTopWindows.Length(); i++)
         sTopWindows[i]->Resize(sVirtualBounds.width,
                                sVirtualBounds.height,
-                               true);
+                               !i);
+
+    nsAppShell::NotifyScreenRotation();
 
     return NS_OK;
 }
 
 // NB: This isn't gonk-specific, but gonk is the only widget backend
 // that does this calculation itself, currently.
 static ScreenOrientation
 ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)