merge b2g-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 03 Jul 2014 12:41:25 +0200
changeset 192008 b7b20af4a4fbff074ace327783497189956911f5
parent 191981 0dd44135ac327f464dfa4b5953dcda38a9ec5a9b (current diff)
parent 192007 3073df95a85980b21f2a9f2c643f9315f4b6eca2 (diff)
child 192080 0ddb94bb72c802ff2df3ea80d74abe1cd4c76580
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmerge
milestone33.0a1
merge b2g-inbound to mozilla-central a=merge
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="2a165bebfa19b11b697837409f9550dd2917c46c">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="3326b51017252e09ccdd715dec6c5e12a7d1ecfe"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="cc67f31dc638c0b7edba3cf7e3d87cadf0ed52bf">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was git://codeaurora.org/-->
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="276ce45e78b09c4a4ee643646f691d22804754c1">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="2a165bebfa19b11b697837409f9550dd2917c46c">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="3326b51017252e09ccdd715dec6c5e12a7d1ecfe"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="cc67f31dc638c0b7edba3cf7e3d87cadf0ed52bf">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="e95b4ce22c825da44d14299e1190ea39a5260bde"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="471afab478649078ad7c75ec6b252481a59e19b8"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
         "git_revision": "", 
         "remote": "", 
         "branch": ""
     }, 
-    "revision": "4e3596b10de8df9202d9c0a7f64b7913bdfaaead", 
+    "revision": "c560e79619f1e741655d2e1447cb92469a0419c0", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="2a165bebfa19b11b697837409f9550dd2917c46c">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <!-- 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
@@ -10,17 +10,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="2a165bebfa19b11b697837409f9550dd2917c46c">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="cc67f31dc638c0b7edba3cf7e3d87cadf0ed52bf">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="2a165bebfa19b11b697837409f9550dd2917c46c">
     <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="6848631d1fe8baf973e3d1257f7b50427295477b"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -225,26 +225,27 @@ nsGonkCameraControl::SetConfigurationInt
         break;
 
       default:
         MOZ_ASSERT_UNREACHABLE("Unanticipated camera mode in SetConfigurationInternal()");
         rv = NS_ERROR_FAILURE;
         break;
     }
 
-    nsresult rv = Set(CAMERA_PARAM_RECORDINGHINT,
-                      aConfig.mMode == kVideoMode);
+    DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    rv = Set(CAMERA_PARAM_RECORDINGHINT, aConfig.mMode == kVideoMode);
     if (NS_FAILED(rv)) {
       DOM_CAMERA_LOGE("Failed to set recording hint (0x%x)\n", rv);
     }
   }
 
-  DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   mCurrentConfiguration.mMode = aConfig.mMode;
   mCurrentConfiguration.mRecorderProfile = aConfig.mRecorderProfile;
   if (aConfig.mMode == kVideoMode) {
     mCurrentConfiguration.mPreviewSize = mLastRecorderSize;
   }
 
   OnConfigurationChange();
   return NS_OK;
--- a/dom/camera/GonkCameraParameters.cpp
+++ b/dom/camera/GonkCameraParameters.cpp
@@ -144,54 +144,58 @@ GonkCameraParameters::GonkCameraParamete
   if (!mLock) {
     MOZ_CRASH("Out of memory getting new PRRWLock");
   }
 }
 
 GonkCameraParameters::~GonkCameraParameters()
 {
   MOZ_COUNT_DTOR(GonkCameraParameters);
+  mIsoModeMap.Clear();
   MOZ_ASSERT(mLock, "mLock missing in ~GonkCameraParameters()");
   if (mLock) {
     PR_DestroyRWLock(mLock);
     mLock = nullptr;
   }
 }
 
 nsresult
 GonkCameraParameters::MapIsoToGonk(const nsAString& aIso, nsACString& aIsoOut)
 {
-  if (aIso.EqualsASCII("hjr")) {
-    aIsoOut = "ISO_HJR";
-  } else if (aIso.EqualsASCII("auto")) {
-    aIsoOut = "auto";
-  } else {
-    nsAutoCString v = NS_LossyConvertUTF16toASCII(aIso);
-    unsigned int iso;
-    if (sscanf(v.get(), "%u", &iso) != 1) {
-      return NS_ERROR_INVALID_ARG;
+  nsCString* s;
+  if (mIsoModeMap.Get(aIso, &s)) {
+    if (!s) {
+      DOM_CAMERA_LOGE("ISO mode '%s' maps to null Gonk ISO value\n",
+        NS_LossyConvertUTF16toASCII(aIso).get());
+      return NS_ERROR_FAILURE;
     }
-    aIsoOut = nsPrintfCString("ISO%u", iso);
+
+    aIsoOut = *s;
+    return NS_OK;
   }
 
-  return NS_OK;
+  return NS_ERROR_INVALID_ARG;
 }
 
 nsresult
 GonkCameraParameters::MapIsoFromGonk(const char* aIso, nsAString& aIsoOut)
 {
   if (strcmp(aIso, "ISO_HJR") == 0) {
     aIsoOut.AssignASCII("hjr");
   } else if (strcmp(aIso, "auto") == 0) {
     aIsoOut.AssignASCII("auto");
   } else {
     unsigned int iso;
-    if (sscanf(aIso, "ISO%u", &iso) != 1) {
+    char ignored;
+    // Some camera libraries return ISO modes as "ISO100", others as "100".
+    if (sscanf(aIso, "ISO%u%c", &iso, &ignored) != 1 &&
+        sscanf(aIso, "%u%c", &iso, &ignored) != 1) {
       return NS_ERROR_INVALID_ARG;
     }
+    aIsoOut.Truncate(0);
     aIsoOut.AppendInt(iso);
   }
 
   return NS_OK;
 }
 
 // Any members that need to be initialized on the first parameter pull
 // need to get handled in here.
@@ -234,24 +238,27 @@ GonkCameraParameters::Initialize()
   if (mZoomRatios.Length() == 0) {
     // Always report that we support at least 1.0x zoom.
     *mZoomRatios.AppendElement() = 100;
   }
 
   // The return code from GetListAsArray() doesn't matter. If it fails,
   // the isoModes array will be empty, and the subsequent loop won't
   // execute.
+  nsString s;
   nsTArray<nsCString> isoModes;
   GetListAsArray(CAMERA_PARAM_SUPPORTED_ISOMODES, isoModes);
   for (uint32_t i = 0; i < isoModes.Length(); ++i) {
-    nsString v;
-    rv = MapIsoFromGonk(isoModes[i].get(), v);
-    if (NS_SUCCEEDED(rv)) {
-      *mIsoModes.AppendElement() = v;
+    rv = MapIsoFromGonk(isoModes[i].get(), s);
+    if (NS_FAILED(rv)) {
+      DOM_CAMERA_LOGW("Unrecognized ISO mode value '%s'\n", isoModes[i].get());
+      continue;
     }
+    *mIsoModes.AppendElement() = s;
+    mIsoModeMap.Put(s, new nsCString(isoModes[i]));
   }
 
   mInitialized = true;
   return NS_OK;
 }
 
 // Handle nsAStrings
 nsresult
--- a/dom/camera/GonkCameraParameters.h
+++ b/dom/camera/GonkCameraParameters.h
@@ -18,16 +18,17 @@
 #define DOM_CAMERA_GONKCAMERAPARAMETERS_H
 
 #include <math.h>
 #include "camera/CameraParameters.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "AutoRwLock.h"
 #include "nsPrintfCString.h"
+#include "nsClassHashtable.h"
 #include "ICameraControl.h"
 
 namespace mozilla {
 
 class GonkCameraParameters
 {
 public:
   GonkCameraParameters();
@@ -95,16 +96,17 @@ protected:
   bool mInitialized;
 
   // Required internal properties
   double mExposureCompensationStep;
   int32_t mExposureCompensationMinIndex;
   int32_t mExposureCompensationMaxIndex;
   nsTArray<int> mZoomRatios;
   nsTArray<nsString> mIsoModes;
+  nsClassHashtable<nsStringHashKey, nsCString> mIsoModeMap;
 
   // This subclass of android::CameraParameters just gives
   // all of the AOSP getters and setters the same signature.
   class Parameters : public android::CameraParameters
   {
   public:
     using android::CameraParameters::set;
     using android::CameraParameters::get;
--- a/dom/camera/test/test_camera_fake_parameters.html
+++ b/dom/camera/test/test_camera_fake_parameters.html
@@ -115,29 +115,46 @@ var tests = [
     }
   },
   {
     key: "fake-iso",
     prep: function setupFakeIso(test) {
       // we should recognize 'auto', 'hjr', and numeric modes; anything else
       // from the driver is ignored, which this test also verifies.
       test.setFakeParameters(
-        "iso=auto;iso-values=auto,ISO_HJR,ISO100,foo,ISObar,ISO200,ISO400,ISO800,ISO1600",
+        "iso=auto;iso-values=auto,ISO_HJR,ISO100,foo,ISObar,ISO150moz,ISO200,400,ISO800,1600",
         function () {
         run();
       });
     },
     test: function testFakeIso(cam, cap) {
-      // values 'foo' and 'ISObar' should not be included in isoModes
       ok(cap.isoModes.length == 7, "ISO modes length = " + cap.isoModes.length);
+
+      // make sure we're not leaking any unexpected values formats
+      ok(cap.isoModes.indexOf("ISO_HJR") == -1, "ISO mode 'ISO_HJR' does not appear");
+      ok(cap.isoModes.indexOf("_HJR") == -1, "ISO mode '_HJR' does not appear");
+      ok(cap.isoModes.indexOf("HJR") == -1, "ISO mode 'HJR' does not appear");
+      ok(cap.isoModes.indexOf("ISO100") == -1, "ISO mode 'ISO100' does not appear");
+      ok(cap.isoModes.indexOf("ISO200") == -1, "ISO mode 'ISO200' does not appear");
+      ok(cap.isoModes.indexOf("ISO800") == -1, "ISO mode 'ISO800' does not appear");
+
+      // make sure any weird values are dropped entirely
       ok(cap.isoModes.indexOf("foo") == -1, "Unknown ISO mode 'foo' is ignored");
       ok(cap.isoModes.indexOf("ISObar") == -1, "Unknown ISO mode 'ISObar' is ignored");
       ok(cap.isoModes.indexOf("bar") == -1, "Unknown ISO mode 'bar' is ignored");
+      ok(cap.isoModes.indexOf("ISO150moz") == -1, "Unknown ISO mode 'ISO150moz' is ignored");
+      ok(cap.isoModes.indexOf("150moz") == -1, "Unknown ISO mode '150moz' is ignored");
+      ok(cap.isoModes.indexOf("150") == -1, "Unknown ISO mode '150' is ignored");
 
-      // test individual ISO modes
+      // make sure expected values are present
+      [ "auto", "hjr", "100", "200", "400", "800", "1600" ].forEach(function(iso) {
+        ok(cap.isoModes.indexOf(iso) != -1, "ISO mode '" + iso + "' is present");
+      });
+
+      // test setters/getters for individual ISO modes
       cap.isoModes.forEach(function(iso, index) {
         cam.iso = iso;
         ok(cam.iso === iso,
           "ISO[" + index + "] = " + iso + ", cam.iso = " + cam.iso);
       });
 
       next();
     }
@@ -246,17 +263,16 @@ var tests = [
       ok(cam.exposureCompensation == 1.5,
          "exposureCompensation(1.25) = " + cam.exposureCompensation);
       cam.exposureCompensation = -1.24;
       ok(cam.exposureCompensation == -1.0,
          "exposureCompensation(-1.24) = " + cam.exposureCompensation);
       cam.exposureCompensation = -1.25;
       ok(cam.exposureCompensation == -1.5,
          "exposureCompensation(-1.25) = " + cam.exposureCompensation);
-
       // Check out-of-bounds values
       cam.exposureCompensation = cap.minExposureCompensation - 1.0;
       ok(cam.exposureCompensation == cap.minExposureCompensation,
          "exposureCompensation(min - 1.0) = " + cam.exposureCompensation);
       cam.exposureCompensation = cap.maxExposureCompensation + 1.0;
       ok(cam.exposureCompensation == cap.maxExposureCompensation,
          "exposureCompensation(max + 1.0) = " + cam.exposureCompensation);
 
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -1636,19 +1636,17 @@ WorkerMessenger.prototype = {
         extraUint2ndCall:
           libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true",
         haveQueryIccLockRetryCount:
           libcutils.property_get("ro.moz.ril.query_icc_count", "false") == "true",
         sendStkProfileDownload:
           libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true",
         dataRegistrationOnDemand: RILQUIRKS_DATA_REGISTRATION_ON_DEMAND,
         subscriptionControl: RILQUIRKS_SUBSCRIPTION_CONTROL
-      },
-      rilEmergencyNumbers: libcutils.property_get("ril.ecclist") ||
-                           libcutils.property_get("ro.ril.ecclist")
+      }
     };
 
     this.send(null, "setInitialOptions", options);
   },
 
   setDebugFlag: function(aDebug) {
     let options = { debug: aDebug };
     this.send(null, "setDebugFlag", options);
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -47,19 +47,16 @@ let GLOBAL = this;
 
 if (!this.debug) {
   // Debugging stub that goes nowhere.
   this.debug = function debug(message) {
     dump("RIL Worker: " + message + "\n");
   };
 }
 
-let RIL_EMERGENCY_NUMBERS;
-const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
-
 // Timeout value for emergency callback mode.
 const EMERGENCY_CB_MODE_TIMEOUT_MS = 300000;  // 5 mins = 300000 ms.
 
 const ICC_MAX_LINEAR_FIXED_RECORDS = 0xfe;
 
 // MMI match groups
 const MMI_MATCH_GROUP_FULL_MMI = 1;
 const MMI_MATCH_GROUP_MMI_PROCEDURE = 2;
@@ -1550,53 +1547,32 @@ RilObject.prototype = {
    * Cache the request for making an emergency call when radio is off. The
    * request shall include two types of callback functions. 'callback' is
    * called when radio is ready, and 'onerror' is called when turning radio
    * on fails.
    */
   cachedDialRequest : null,
 
   /**
-   * Dial the phone.
+   * Dial a non-emergency number.
    *
    * @param number
    *        String containing the number to dial.
    * @param clirMode
    *        Integer for showing/hidding the caller Id to the called party.
    * @param uusInfo
    *        Integer doing something XXX TODO
    */
-  dial: function(options) {
+  dialNonEmergencyNumber: function(options) {
     let onerror = (function onerror(options, errorMsg) {
       options.success = false;
       options.errorMsg = errorMsg;
       this.sendChromeMessage(options);
     }).bind(this, options);
 
-    if (this._isEmergencyNumber(options.number)) {
-      this.dialEmergencyNumber(options, onerror);
-    } else {
-      if (!this._isCdma) {
-        // TODO: Both dial() and sendMMI() functions should be unified at some
-        // point in the future. In the mean time we handle temporary CLIR MMI
-        // commands through the dial() function. Please see bug 889737.
-        let mmi = this._parseMMI(options.number);
-        if (mmi && this._isTemporaryModeCLIR(mmi)) {
-          options.number = mmi.dialNumber;
-          // In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI
-          // presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B.
-          options.clirMode = mmi.procedure == MMI_PROCEDURE_ACTIVATION ?
-                             CLIR_SUPPRESSION : CLIR_INVOCATION;
-        }
-      }
-      this.dialNonEmergencyNumber(options, onerror);
-    }
-  },
-
-  dialNonEmergencyNumber: function(options, onerror) {
     if (this.radioState == GECKO_RADIOSTATE_OFF) {
       // Notify error in establishing the call without radio.
       onerror(GECKO_ERROR_RADIO_NOT_AVAILABLE);
       return;
     }
 
     if (this.voiceRegistrationState.emergencyCallsOnly ||
         options.isDialEmergency) {
@@ -1604,55 +1580,79 @@ RilObject.prototype = {
       return;
     }
 
     // Exit emergency callback mode when user dial a non-emergency call.
     if (this._isInEmergencyCbMode) {
       this.exitEmergencyCbMode();
     }
 
-    if (this._isCdma && Object.keys(this.currentCalls).length == 1) {
-      // Make a Cdma 3way call.
-      options.featureStr = options.number;
-      this.sendCdmaFlashCommand(options);
-    } else {
-      options.request = REQUEST_DIAL;
-      this.sendDialRequest(options);
-    }
-  },
-
-  dialEmergencyNumber: function(options, onerror) {
+    if (!this._isCdma) {
+      // TODO: Both dial() and sendMMI() functions should be unified at some
+      // point in the future. In the mean time we handle temporary CLIR MMI
+      // commands through the dial() function. Please see bug 889737.
+      let mmi = this._parseMMI(options.number);
+      if (mmi && this._isTemporaryModeCLIR(mmi)) {
+        options.number = mmi.dialNumber;
+        // In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI
+        // presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B.
+        options.clirMode = mmi.procedure == MMI_PROCEDURE_ACTIVATION ?
+          CLIR_SUPPRESSION : CLIR_INVOCATION;
+      }
+    }
+
+    options.request = REQUEST_DIAL;
+    this.sendDialRequest(options);
+  },
+
+  /**
+   * Dial an emergency number.
+   *
+   * @param number
+   *        String containing the number to dial.
+   * @param clirMode
+   *        Integer for showing/hidding the caller Id to the called party.
+   * @param uusInfo
+   *        Integer doing something XXX TODO
+   */
+  dialEmergencyNumber: function(options) {
+    let onerror = (function onerror(options, errorMsg) {
+      options.success = false;
+      options.errorMsg = errorMsg;
+      this.sendChromeMessage(options);
+    }).bind(this, options);
+
     options.request = RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL ?
                       REQUEST_DIAL_EMERGENCY_CALL : REQUEST_DIAL;
     if (this.radioState == GECKO_RADIOSTATE_OFF) {
       if (DEBUG) {
         this.context.debug("Automatically enable radio for an emergency call.");
       }
 
       if (!this.cachedDialRequest) {
         this.cachedDialRequest = {};
       }
       this.cachedDialRequest.onerror = onerror;
       this.cachedDialRequest.callback = this.sendDialRequest.bind(this, options);
       this.setRadioEnabled({enabled: true});
       return;
     }
 
+    this.sendDialRequest(options);
+  },
+
+  sendDialRequest: function(options) {
     if (this._isCdma && Object.keys(this.currentCalls).length == 1) {
       // Make a Cdma 3way call.
       options.featureStr = options.number;
       this.sendCdmaFlashCommand(options);
     } else {
-      this.sendDialRequest(options);
-    }
-  },
-
-  sendDialRequest: function(options) {
-    this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial,
-                                    options);
+      this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial,
+                                      options);
+    }
   },
 
   sendRilRequestDial: function(options) {
     let Buf = this.context.Buf;
     Buf.newParcel(options.request, options);
     Buf.writeString(options.number);
     Buf.writeInt32(options.clirMode || 0);
     Buf.writeInt32(options.uusInfo || 0);
@@ -2412,19 +2412,18 @@ RilObject.prototype = {
   /**
    * Helper to parse short string. TS.22.030 Figure 3.5.3.2.
    */
   _isMMIShortString: function(mmiString) {
     if (mmiString.length > 2) {
       return false;
     }
 
-    if (this._isEmergencyNumber(mmiString)) {
-      return false;
-    }
+    // TODO: Should take care of checking if the string is an emergency number
+    // in Bug 889737. See Bug 1023141 for more background.
 
     // In a call case.
     if (Object.getOwnPropertyNames(this.currentCalls).length > 0) {
       return true;
     }
 
     if ((mmiString.length != 2) || (mmiString.charAt(0) !== '1')) {
       return true;
@@ -3304,48 +3303,28 @@ RilObject.prototype = {
     // Calculate and write Parcel size to 1st mark
     Buf.stopCalOutgoingSize();
 
     Buf.writeInt32(0);
     Buf.sendParcel();
   },
 
   /**
-   * Check a given number against the list of emergency numbers provided by the RIL.
-   *
-   * @param number
-   *        The number to look up.
-   */
-   _isEmergencyNumber: function(number) {
-     // Check ril provided numbers first.
-     let numbers = RIL_EMERGENCY_NUMBERS;
-
-     if (numbers) {
-       numbers = numbers.split(",");
-     } else {
-       // No ecclist system property, so use our own list.
-       numbers = DEFAULT_EMERGENCY_NUMBERS;
-     }
-
-     return numbers.indexOf(number) != -1;
-   },
-
-   /**
-    * Checks whether to temporarily suppress caller id for the call.
-    *
-    * @param mmi
-    *        MMI full object.
-    */
-   _isTemporaryModeCLIR: function(mmi) {
-     return (mmi &&
-             mmi.serviceCode == MMI_SC_CLIR &&
-             mmi.dialNumber &&
-             (mmi.procedure == MMI_PROCEDURE_ACTIVATION ||
-              mmi.procedure == MMI_PROCEDURE_DEACTIVATION));
-   },
+   * Checks whether to temporarily suppress caller id for the call.
+   *
+   * @param mmi
+   *        MMI full object.
+   */
+  _isTemporaryModeCLIR: function(mmi) {
+    return (mmi &&
+            mmi.serviceCode == MMI_SC_CLIR &&
+            mmi.dialNumber &&
+            (mmi.procedure == MMI_PROCEDURE_ACTIVATION ||
+             mmi.procedure == MMI_PROCEDURE_DEACTIVATION));
+  },
 
   /**
    * Report STK Service is running.
    */
   reportStkServiceIsRunning: function() {
     this.context.Buf.simpleRequest(REQUEST_REPORT_STK_SERVICE_IS_RUNNING);
   },
 
@@ -4050,16 +4029,17 @@ RilObject.prototype = {
       let options = this.pendingMO.options;
       this.pendingMO = null;
 
       // Find the callIndex of the new outgoing call.
       let callIndex = -1;
       for (let i in newCalls) {
         if (newCalls[i].state !== CALL_STATE_INCOMING) {
           callIndex = newCalls[i].callIndex;
+          newCalls[i].isEmergency = options.isEmergency;
           break;
         }
       }
 
       if (callIndex === -1) {
         // The call doesn't exist.
         options.success = false;
         options.errorMsg = GECKO_CALL_ERROR_UNSPECIFIED;
@@ -4100,19 +4080,19 @@ RilObject.prototype = {
     }
 
     if (newCall.state == CALL_STATE_INCOMING) {
       newCall.isOutgoing = false;
     } else if (newCall.state == CALL_STATE_DIALING) {
       newCall.isOutgoing = true;
     }
 
-    // Set flag for outgoing emergency call.
-    newCall.isEmergency = newCall.isOutgoing &&
-      this._isEmergencyNumber(newCall.number);
+    if (newCall.isEmergency === undefined) {
+      newCall.isEmergency = false;
+    }
 
     // Set flag for conference.
     newCall.isConference = newCall.isMpty ? true : false;
 
     // Add to our map.
     if (newCall.isMpty) {
       this.currentConference.participants[newCall.callIndex] = newCall;
     }
@@ -14963,17 +14943,16 @@ let ContextPool = {
       }
       return;
     }
     method.call(this, aMessage);
   },
 
   setInitialOptions: function(aOptions) {
     DEBUG = DEBUG_WORKER || aOptions.debug;
-    RIL_EMERGENCY_NUMBERS = aOptions.rilEmergencyNumbers;
 
     let quirks = aOptions.quirks;
     RILQUIRKS_CALLSTATE_EXTRA_UINT32 = quirks.callstateExtraUint32;
     RILQUIRKS_V5_LEGACY = quirks.v5Legacy;
     RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL = quirks.requestUseDialEmergencyCall;
     RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = quirks.simAppStateExtraFields;
     RILQUIRKS_EXTRA_UINT32_2ND_CALL = quirks.extraUint2ndCall;
     RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = quirks.haveQueryIccLockRetryCount;
--- a/dom/system/gonk/tests/test_ril_worker_ecm.js
+++ b/dom/system/gonk/tests/test_ril_worker_ecm.js
@@ -117,18 +117,19 @@ add_test(function test_request_exit_emer
   do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
 
   let parcelTypes = [];
   context.Buf.newParcel = function(type, options) {
     parcelTypes.push(type);
   };
 
   // Dial non-emergency call.
-  context.RIL.dial({number: "0912345678",
-                  isDialEmergency: false});
+  context.RIL.dialNonEmergencyNumber({number: "0912345678",
+                                      isEmergency: false,
+                                      isDialEmergency: false});
 
   // Should clear timeout event.
   do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
 
   // Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
   do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
 
   run_next_test();
--- a/dom/telephony/gonk/TelephonyService.js
+++ b/dom/telephony/gonk/TelephonyService.js
@@ -5,16 +5,17 @@
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/systemlibs.js");
 
 XPCOMUtils.defineLazyGetter(this, "RIL", function () {
   let obj = {};
   Cu.import("resource://gre/modules/ril_consts.js", obj);
   return obj;
 });
 
 const GONK_TELEPHONYSERVICE_CONTRACTID =
@@ -45,16 +46,18 @@ const AUDIO_STATE_NO_CALL  = 0;
 const AUDIO_STATE_INCOMING = 1;
 const AUDIO_STATE_IN_CALL  = 2;
 const AUDIO_STATE_NAME = [
   "PHONE_STATE_NORMAL",
   "PHONE_STATE_RINGTONE",
   "PHONE_STATE_IN_CALL"
 ];
 
+const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
+
 let DEBUG;
 function debug(s) {
   dump("TelephonyService: " + s + "\n");
 }
 
 XPCOMUtils.defineLazyGetter(this, "gAudioManager", function getAudioManager() {
   try {
     return Cc["@mozilla.org/telephony/audiomanager;1"]
@@ -326,16 +329,36 @@ TelephonyService.prototype = {
         this._currentCalls[aClientId][call.callIndex] = call;
       }
 
       return false;
     }).bind(this));
   },
 
   /**
+   * Check a given number against the list of emergency numbers provided by the
+   * RIL.
+   *
+   * @param aNumber
+   *        The number to look up.
+   */
+  _isEmergencyNumber: function(aNumber) {
+    // Check ril provided numbers first.
+    let numbers = libcutils.property_get("ril.ecclist") ||
+                  libcutils.property_get("ro.ril.ecclist");
+    if (numbers) {
+      numbers = numbers.split(",");
+    } else {
+      // No ecclist system property, so use our own list.
+      numbers = DEFAULT_EMERGENCY_NUMBERS;
+    }
+    return numbers.indexOf(aNumber) != -1;
+  },
+
+  /**
    * nsITelephonyService interface.
    */
 
   defaultServiceId: 0,
 
   registerListener: function(aListener) {
     if (this._listeners.indexOf(aListener) >= 0) {
       throw Cr.NS_ERROR_UNEXPECTED;
@@ -483,19 +506,24 @@ TelephonyService.prototype = {
       let parentCall = this._currentCalls[aClientId][childCall.parentId];
       parentCall.childId = CDMA_SECOND_CALL_INDEX;
       parentCall.state = RIL.CALL_STATE_HOLDING;
       parentCall.isSwitchable = false;
       parentCall.isMergeable = true;
       this.notifyCallStateChanged(aClientId, parentCall);
     };
 
+    let isEmergencyNumber = this._isEmergencyNumber(aNumber);
+    let msg = isEmergencyNumber ?
+              "dialEmergencyNumber" :
+              "dialNonEmergencyNumber";
     this.isDialing = true;
-    this._getClient(aClientId).sendWorkerMessage("dial", {
+    this._getClient(aClientId).sendWorkerMessage(msg, {
       number: aNumber,
+      isEmergency: isEmergencyNumber,
       isDialEmergency: aIsEmergency
     }, (function(response) {
       this.isDialing = false;
       if (!response.success) {
         aTelephonyCallback.notifyDialError(response.errorMsg);
         return false;
       }
 
--- a/dom/telephony/test/marionette/head.js
+++ b/dom/telephony/test/marionette/head.js
@@ -9,64 +9,88 @@ const kPrefRilDebuggingEnabled = "ril.de
 
 /**
  * Emulator helper.
  */
 let emulator = (function() {
   let pendingCmdCount = 0;
   let originalRunEmulatorCmd = runEmulatorCmd;
 
+  let pendingShellCount = 0;
+  let originalRunEmulatorShell = runEmulatorShell;
+
   // Overwritten it so people could not call this function directly.
   runEmulatorCmd = function() {
-    throw "Use emulator.runWithCallback(cmd, callback) instead of runEmulatorCmd";
+    throw "Use emulator.runCmdWithCallback(cmd, callback) instead of runEmulatorCmd";
   };
 
-  function run(cmd) {
+  // Overwritten it so people could not call this function directly.
+  runEmulatorShell = function() {
+    throw "Use emulator.runShellCmd(cmd, callback) instead of runEmulatorShell";
+  };
+
+  function runCmd(cmd) {
     let deferred = Promise.defer();
 
     pendingCmdCount++;
     originalRunEmulatorCmd(cmd, function(result) {
       pendingCmdCount--;
       if (result[result.length - 1] === "OK") {
         deferred.resolve(result);
       } else {
         is(result[result.length - 1], "OK", "emulator command result.");
         deferred.reject();
       }
     });
 
     return deferred.promise;
   }
 
-  function runWithCallback(cmd, callback) {
-    run(cmd).then(result => {
+  function runCmdWithCallback(cmd, callback) {
+    runCmd(cmd).then(result => {
       if (callback && typeof callback === "function") {
         callback(result);
       }
     });
   }
 
   /**
    * @return Promise
    */
+  function runShellCmd(aCommands) {
+    let deferred = Promise.defer();
+
+    ++pendingShellCount;
+    originalRunEmulatorShell(aCommands, function(aResult) {
+      --pendingShellCount;
+      deferred.resolve(aResult);
+    });
+
+    return deferred.promise;
+  }
+
+  /**
+   * @return Promise
+   */
   function waitFinish() {
     let deferred = Promise.defer();
 
     waitFor(function() {
       deferred.resolve();
     }, function() {
-      return pendingCmdCount === 0;
+      return pendingCmdCount === 0 && pendingShellCount === 0;
     });
 
     return deferred.promise;
   }
 
   return {
-    run: run,
-    runWithCallback: runWithCallback,
+    runCmd: runCmd,
+    runCmdWithCallback: runCmdWithCallback,
+    runShellCmd: runShellCmd,
     waitFinish: waitFinish
   };
 }());
 
 /**
  * Telephony related helper functions.
  */
 (function() {
@@ -118,17 +142,17 @@ let emulator = (function() {
 
     for (let call of conference.calls) {
       log(".. hangUp " + call.id.number);
       hangUpPromises.push(hangUp(call));
     }
 
     return Promise.all(hangUpPromises)
       .then(() => {
-        return emulator.run("gsm clear");
+        return emulator.runCmd("gsm clear").then(waitForNoCall);
       })
       .then(waitForNoCall);
   }
 
   /**
    * Provide a string with format of the emulator call list result.
    *
    * @param prefix
@@ -356,17 +380,17 @@ let emulator = (function() {
   /**
    * Convenient helper to check the call list existing in the emulator.
    *
    * @param expectedCallList
    *        An array of call info with the format of "callStrPool()[state]".
    * @return A deferred promise.
    */
   function checkEmulatorCallList(expectedCallList) {
-    return emulator.run("gsm list").then(result => {
+    return emulator.runCmd("gsm list").then(result => {
       log("Call list is now: " + result);
       for (let i = 0; i < expectedCallList.length; ++i) {
         is(result[i], expectedCallList[i], "emulator calllist");
       }
     });
   }
 
   /**
@@ -606,17 +630,17 @@ let emulator = (function() {
       checkCallId(number, numberPresentation, name, namePresentation,
                   call.id.number, call.id.name);
       deferred.resolve(call);
     };
 
     numberPresentation = numberPresentation || "";
     name = name || "";
     namePresentation = namePresentation || "";
-    emulator.run("gsm call " + number + "," + numberPresentation + "," + name +
+    emulator.runCmd("gsm call " + number + "," + numberPresentation + "," + name +
                  "," + namePresentation);
     return deferred.promise;
   }
 
   /**
    * Remote party answers the call.
    *
    * @param call
@@ -629,17 +653,17 @@ let emulator = (function() {
     let deferred = Promise.defer();
 
     call.onconnected = function onconnected(event) {
       log("Received 'connected' call event.");
       call.onconnected = null;
       checkEventCallState(event, call, "connected");
       deferred.resolve(call);
     };
-    emulator.run("gsm accept " + call.id.number);
+    emulator.runCmd("gsm accept " + call.id.number);
 
     return deferred.promise;
   }
 
   /**
    * Remote party hangs up the call.
    *
    * @param call
@@ -652,17 +676,17 @@ let emulator = (function() {
     let deferred = Promise.defer();
 
     call.ondisconnected = function ondisconnected(event) {
       log("Received 'disconnected' call event.");
       call.ondisconnected = null;
       checkEventCallState(event, call, "disconnected");
       deferred.resolve(call);
     };
-    emulator.run("gsm cancel " + call.id.number);
+    emulator.runCmd("gsm cancel " + call.id.number);
 
     return deferred.promise;
   }
 
   /**
    * Remote party hangs up all the calls.
    *
    * @param calls
--- a/dom/telephony/test/marionette/test_crash_emulator.js
+++ b/dom/telephony/test/marionette/test_crash_emulator.js
@@ -26,17 +26,17 @@ function answer() {
     // just some code to keep call active for awhile
     callStartTime = Date.now();
     waitFor(cleanUp,function() {
       callDuration = Date.now() - callStartTime;
       log("Waiting while call is active, call duration (ms): " + callDuration);
       return(callDuration >= 2000);
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 function cleanUp(){
   outgoingCall.hangUp();
   ok("passed");
   finish();
 }
 
--- a/dom/telephony/test/marionette/test_dsds_connection_conflict.js
+++ b/dom/telephony/test/marionette/test_dsds_connection_conflict.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = 'head.js';
 
 function muxModem(id) {
   let deferred = Promise.defer();
 
-  emulator.runWithCallback("mux modem " + id, function() {
+  emulator.runCmdWithCallback("mux modem " + id, function() {
     deferred.resolve();
   });
 
   return deferred.promise;
 }
 
 function testNewCallWhenOtherConnectionInUse(firstServiceId, secondServiceId) {
   log("= testNewCallWhenOtherConnectionInUse =");
--- a/dom/telephony/test/marionette/test_dsds_normal_call.js
+++ b/dom/telephony/test/marionette/test_dsds_normal_call.js
@@ -2,17 +2,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = 'head.js';
 
 function muxModem(id) {
   let deferred = Promise.defer();
 
-  emulator.runWithCallback("mux modem " + id, function() {
+  emulator.runCmdWithCallback("mux modem " + id, function() {
     deferred.resolve();
   });
 
   return deferred.promise;
 }
 
 function testOutgoingCallForServiceId(number, serviceId) {
   let outCall;
--- a/dom/telephony/test/marionette/test_emergency.js
+++ b/dom/telephony/test/marionette/test_emergency.js
@@ -23,17 +23,17 @@ function dial() {
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoing, event.call);
       is(outgoing.state, "alerting");
       is(outgoing.emergency, true);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + "        : ringing");
         answer();
       });
     };
   });
 }
 
@@ -44,44 +44,44 @@ function answer() {
 
   outgoing.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "connected");
 
     is(outgoing, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + "        : active");
       hangUp();
     });
   };
-  emulator.runWithCallback("gsm accept " + number);
+  emulator.runCmdWithCallback("gsm accept " + number);
 }
 
 function hangUp() {
   log("Hanging up the emergency call.");
 
   // We get no "disconnecting" event when the remote party terminates the call.
 
   outgoing.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + number);
+  emulator.runCmdWithCallback("gsm cancel " + number);
 }
 
 function cleanUp() {
   finish();
 }
 
 startTest(function() {
   dial();
--- a/dom/telephony/test/marionette/test_emergency_badNumber.js
+++ b/dom/telephony/test/marionette/test_emergency_badNumber.js
@@ -11,17 +11,17 @@ function dial() {
 
   telephony.dialEmergency(number).then(null, cause => {
     log("Received promise 'reject'");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
     is(cause, "BadNumberError");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Initial call list: " + result);
       cleanUp();
     });
   });
 }
 
 function cleanUp() {
   finish();
--- a/dom/telephony/test/marionette/test_emergency_label.js
+++ b/dom/telephony/test/marionette/test_emergency_label.js
@@ -1,15 +1,51 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 MARIONETTE_TIMEOUT = 60000;
 MARIONETTE_HEAD_JS = 'head.js';
 
-function testEmergencyLabel(number, emergency) {
+const DEFAULT_ECC_LIST = "112,911";
+
+function setEccListProperty(list) {
+  log("Set property ril.ecclist: " + list);
+
+  let deferred = Promise.defer();
+  try {
+    emulator.runShellCmd(["setprop","ril.ecclist", list]).then(function() {
+      deferred.resolve(list);
+    });
+  } catch (e) {
+    deferred.reject(e);
+  }
+  return deferred.promise;
+}
+
+function getEccListProperty() {
+  log("Get property ril.ecclist.");
+
+  let deferred = Promise.defer();
+  try {
+    emulator.runShellCmd(["getprop","ril.ecclist"]).then(function(aResult) {
+      let list = !aResult.length ? "" : aResult[0];
+      deferred.resolve(list);
+    });
+  } catch (e) {
+    deferred.reject(e);
+  }
+  return deferred.promise;
+}
+
+function testEmergencyLabel(number, list) {
+  if (!list) {
+    list = DEFAULT_ECC_LIST;
+  }
+  let index = list.split(",").indexOf(number);
+  let emergency = index != -1;
   log("= testEmergencyLabel = " + number + " should be " +
       (emergency ? "emergency" : "normal") + " call");
 
   let outCall;
 
   return gDial(number)
     .then(call => { outCall = call; })
     .then(() => {
@@ -18,17 +54,32 @@ function testEmergencyLabel(number, emer
     .then(() => gRemoteAnswer(outCall))
     .then(() => {
       is(outCall.emergency, emergency, "emergency result should be correct");
     })
     .then(() => gRemoteHangUp(outCall));
 }
 
 startTest(function() {
-  testEmergencyLabel("112", true)
-    .then(() => testEmergencyLabel("911", true))
-    .then(() => testEmergencyLabel("0912345678", false))
-    .then(() => testEmergencyLabel("777", false))
-    .then(null, () => {
-      ok(false, 'promise rejects during test.');
+  let origEccList;
+  let eccList;
+
+  getEccListProperty()
+    .then(list => {
+      origEccList = eccList = list;
+    })
+    .then(() => testEmergencyLabel("112", eccList))
+    .then(() => testEmergencyLabel("911", eccList))
+    .then(() => testEmergencyLabel("0912345678", eccList))
+    .then(() => testEmergencyLabel("777", eccList))
+    .then(() => {
+      eccList = "777,119";
+      return setEccListProperty(eccList);
+    })
+    .then(() => testEmergencyLabel("777", eccList))
+    .then(() => testEmergencyLabel("119", eccList))
+    .then(() => testEmergencyLabel("112", eccList))
+    .then(() => setEccListProperty(origEccList))
+    .then(null, error => {
+      ok(false, 'promise rejects during test: ' + error);
     })
     .then(finish);
 });
--- a/dom/telephony/test/marionette/test_incoming_already_connected.js
+++ b/dom/telephony/test/marionette/test_incoming_already_connected.js
@@ -22,17 +22,17 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -42,31 +42,31 @@ function answer() {
   // We get no "connecting" event when the remote party answers the call.
   outgoingCall.onconnected = function onconnectedOut(event) {
     log("Received 'connected' call event for the original outgoing call.");
 
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
 
       if(!gotOriginalConnected){
         gotOriginalConnected = true;
         simulateIncoming();
       } else {
         // Received connected event for original call multiple times (fail)
         ok(false,
            "Received 'connected' event for original call multiple times");
       }
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 // With one connected call already, simulate an incoming call
 function simulateIncoming() {
   log("Simulating an incoming call (with one call already connected).");
 
   telephony.onincoming = function onincoming(event) {
     log("Received 'incoming' call event.");
@@ -75,24 +75,24 @@ function simulateIncoming() {
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     // Should be two calls now
     is(telephony.calls.length, 2);
     is(telephony.calls[0], outgoingCall);
     is(telephony.calls[1], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
       is(result[1], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 // Answer incoming call; original outgoing call should be held
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
@@ -106,17 +106,17 @@ function answerIncoming() {
     log("Received 'connected' call event for incoming/2nd call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
     is(outgoingCall.state, "held");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       is(result[1], "inbound from " + inNumber + " : active");
       hangUpOutgoing();
     });
   };
   incomingCall.answer();
 }
@@ -138,17 +138,17 @@ function hangUpOutgoing() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Back to one call now
     is(telephony.calls.length, 1);
     is(incomingCall.state, "connected");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       hangUpIncoming();
     });
   };
   outgoingCall.hangUp();
 }
 
@@ -169,17 +169,17 @@ function hangUpIncoming() {
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Zero calls left
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incomingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_already_held.js
+++ b/dom/telephony/test/marionette/test_incoming_already_held.js
@@ -22,17 +22,17 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -42,31 +42,31 @@ function answer() {
   // We get no "connecting" event when the remote party answers the call.
   outgoingCall.onconnected = function onconnectedOut(event) {
     log("Received 'connected' call event for the original outgoing call.");
 
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
 
       if(!gotOriginalConnected){
         gotOriginalConnected = true;
         holdCall();
       } else {
         // Received connected event for original call multiple times (fail)
         ok(false,
            "Received 'connected' event for original call multiple times");
       }
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 function holdCall() {
   log("Putting the original (outgoing) call on hold.");
 
   let gotHolding = false;
   outgoingCall.onholding = function onholding(event) {
     log("Received 'holding' call event");
@@ -80,17 +80,17 @@ function holdCall() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       simulateIncoming();
     });
   };
   outgoingCall.hold();
 }
 
@@ -105,24 +105,24 @@ function simulateIncoming() {
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     // Should be two calls now
     is(telephony.calls.length, 2);
     is(telephony.calls[0], outgoingCall);
     is(telephony.calls[1], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       is(result[1], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 // Answer incoming call; original outgoing call should be held
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
@@ -136,17 +136,17 @@ function answerIncoming() {
     log("Received 'connected' call event for incoming/2nd call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
     is(outgoingCall.state, "held");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       is(result[1], "inbound from " + inNumber + " : active");
       hangUpOutgoing();
     });
   };
   incomingCall.answer();
 }
@@ -168,17 +168,17 @@ function hangUpOutgoing() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Back to one call now
     is(telephony.calls.length, 1);
     is(incomingCall.state, "connected");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       hangUpIncoming();
     });
   };
   outgoingCall.hangUp();
 }
 
@@ -199,17 +199,17 @@ function hangUpIncoming() {
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Zero calls left
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incomingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_answer_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_answer_hangup.js
@@ -17,23 +17,23 @@ function simulateIncoming() {
     ok(incoming);
     is(incoming.id.number, number);
     is(incoming.state, "incoming");
 
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incoming);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : incoming");
       answer();
     });
   };
-  emulator.runWithCallback("gsm call " + number);
+  emulator.runCmdWithCallback("gsm call " + number);
 }
 
 function answer() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incoming.onconnecting = function onconnecting(event) {
     log("Received 'connecting' call event.");
@@ -45,17 +45,17 @@ function answer() {
   incoming.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(incoming, event.call);
     is(incoming.state, "connected");
     ok(gotConnecting);
 
     is(incoming, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : active");
       hangUp();
     });
   };
   incoming.answer();
 }
 
@@ -74,17 +74,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(incoming, event.call);
     is(incoming.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incoming.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js
+++ b/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js
@@ -23,24 +23,24 @@ function simulateIncoming() {
     incoming = event.call;
     ok(incoming);
     is(incoming.id.number, number);
     is(incoming.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incoming);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : incoming");
       answer();
     });
   };
 
-  emulator.runWithCallback("gsm call " + number);
+  emulator.runCmdWithCallback("gsm call " + number);
 }
 
 function answer() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incoming.onconnecting = function onconnecting(event) {
     log("Received 'connecting' call event.");
@@ -55,17 +55,17 @@ function answer() {
   incoming.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(incoming, event.call);
     is(incoming.state, "connected");
     ok(gotConnecting);
 
     is(incoming, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : active");
       hangUp();
     });
   };
   incoming.answer();
 }
 
@@ -104,17 +104,17 @@ function hangUp() {
     is(incoming, event.call);
     is(incoming.state, "disconnected");
     ok(gotDisconnecting);
     ok(gotCallschanged);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
 
   incoming.hangUp();
 }
 
--- a/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
     log("Received 'connecting' call event for incoming call.");
@@ -43,17 +43,17 @@ function answerIncoming() {
   incomingCall.onconnected = function onconnectedIn(event) {
     log("Received 'connected' call event for incoming call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       remoteHangUp();
     });
   };
   incomingCall.answer();
 }
 
@@ -65,22 +65,22 @@ function remoteHangUp() {
   incomingCall.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + inNumber);
+  emulator.runCmdWithCallback("gsm cancel " + inNumber);
 }
 
 function cleanUp() {
   telephony.onincoming = null;
   finish();
 }
 
 startTest(function() {
--- a/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_connecting_hangup.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   incomingCall.onconnecting = function onconnecting(event) {
     log("Received 'connecting' call event.");
     is(incomingCall, event.call);
@@ -72,17 +72,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incomingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
+++ b/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   incomingCall.onconnecting = function onconnecting(event) {
     log("Received 'connecting' call event.");
     is(incomingCall, event.call);
@@ -54,22 +54,22 @@ function remoteHangUp() {
   incomingCall.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + inNumber);
+  emulator.runCmdWithCallback("gsm cancel " + inNumber);
 }
 
 function cleanUp() {
   telephony.onincoming = null;
   finish();
 }
 
 startTest(function() {
--- a/dom/telephony/test/marionette/test_incoming_hangup_held.js
+++ b/dom/telephony/test/marionette/test_incoming_hangup_held.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
     log("Received 'connecting' call event for incoming call.");
@@ -43,17 +43,17 @@ function answerIncoming() {
   incomingCall.onconnected = function onconnectedIn(event) {
     log("Received 'connected' call event for incoming call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       hold();
     });
   };
   incomingCall.answer();
 }
 
@@ -73,17 +73,17 @@ function hold() {
     is(incomingCall, event.call);
     is(incomingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       hangUp();
     });
   };
   incomingCall.hold();
 }
 
@@ -102,17 +102,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incomingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_hold_resume.js
+++ b/dom/telephony/test/marionette/test_incoming_hold_resume.js
@@ -16,23 +16,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, number);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : incoming");
       answer();
     });
   };
-  emulator.runWithCallback("gsm call " + number);
+  emulator.runCmdWithCallback("gsm call " + number);
 }
 
 function answer() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnecting(event) {
     log("Received 'connecting' call event.");
@@ -44,17 +44,17 @@ function answer() {
   incomingCall.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : active");
       hold();
     });
   };
   incomingCall.answer();
 }
 
@@ -74,17 +74,17 @@ function hold() {
     is(incomingCall, event.call);
     is(incomingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : held");
       // Wait on hold for a couple of seconds
       log("Pausing 2 seconds while on hold");
       setTimeout(resume, 2000);
     });
   };
   incomingCall.hold();
@@ -106,17 +106,17 @@ function resume() {
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotResuming);
 
     is(incomingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : active");
       hangUp();
     });
   };
   incomingCall.resume();
 }
 
@@ -135,17 +135,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incomingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_onstatechange.js
+++ b/dom/telephony/test/marionette/test_incoming_onstatechange.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   gotConnecting = false;
   incomingCall.onstatechange = function statechangeconnect(event) {
     log("Received 'onstatechange' call event.");
@@ -40,17 +40,17 @@ function answerIncoming() {
       is(incomingCall.state, "connecting");
       gotConnecting = true;
     } else {
       is(incomingCall.state, "connected");
       is(telephony.active, incomingCall);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], incomingCall);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "inbound from " + inNumber + " : active");
         hold();
       });
     }
   };
   incomingCall.answer();
 }
@@ -66,17 +66,17 @@ function hold() {
       is(incomingCall.state, "holding");
       gotHolding = true;
     } else {
       is(incomingCall.state, "held");
       is(telephony.active, null);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], incomingCall);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "inbound from " + inNumber + " : held");
         resume();
       });
     }
   };
   incomingCall.hold();
 }
@@ -92,17 +92,17 @@ function resume() {
       is(incomingCall.state, "resuming");
       gotResuming = true;
     } else {
       is(incomingCall.state, "connected");
       is(telephony.active, incomingCall);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], incomingCall);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "inbound from " + inNumber + " : active");
         hangUp();
       });
     }
   };
   incomingCall.resume();
 }
@@ -117,17 +117,17 @@ function hangUp() {
     if(!gotDisconnecting){
       is(incomingCall.state, "disconnecting");
       gotDisconnecting = true;
     } else {
       is(incomingCall.state, "disconnected");
       is(telephony.active, null);
       is(telephony.calls.length, 0);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         cleanUp();
       });
     }
   };
   incomingCall.hangUp();
 }
 
--- a/dom/telephony/test/marionette/test_incoming_reject.js
+++ b/dom/telephony/test/marionette/test_incoming_reject.js
@@ -17,23 +17,23 @@ function simulateIncoming() {
     ok(incoming);
     is(incoming.id.number, number);
     is(incoming.state, "incoming");
 
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incoming);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + number + " : incoming");
       reject();
     });
   };
-  emulator.runWithCallback("gsm call " + number);
+  emulator.runCmdWithCallback("gsm call " + number);
 }
 
 function reject() {
   log("Reject the incoming call.");
 
   let gotDisconnecting = false;
   incoming.ondisconnecting = function ondisconnecting(event) {
     log("Received 'disconnecting' call event.");
@@ -46,17 +46,17 @@ function reject() {
     log("Received 'disconnected' call event.");
     is(incoming, event.call);
     is(incoming.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incoming.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_incoming_remote_cancel.js
+++ b/dom/telephony/test/marionette/test_incoming_remote_cancel.js
@@ -15,44 +15,44 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       cancelIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function cancelIncoming(){
   log("Remote party cancelling call before it is answered.");
 
   // We get no 'disconnecting' event when remote party cancels/hangs-up call
 
   incomingCall.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + inNumber);
+  emulator.runCmdWithCallback("gsm cancel " + inNumber);
 }
 
 function cleanUp() {
   telephony.onincoming = null;
   finish();
 }
 
 startTest(function() {
--- a/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
+++ b/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
     log("Received 'connecting' call event for incoming call.");
@@ -43,17 +43,17 @@ function answerIncoming() {
   incomingCall.onconnected = function onconnectedIn(event) {
     log("Received 'connected' call event for incoming call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       hold();
     });
   };
   incomingCall.answer();
 }
 
@@ -73,17 +73,17 @@ function hold() {
     is(incomingCall, event.call);
     is(incomingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       hangUp();
     });
   };
   incomingCall.hold();
 }
 
@@ -95,22 +95,22 @@ function hangUp() {
   incomingCall.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + inNumber);
+  emulator.runCmdWithCallback("gsm cancel " + inNumber);
 }
 
 function cleanUp() {
   telephony.onincoming = null;
   finish();
 }
 
 startTest(function() {
--- a/dom/telephony/test/marionette/test_multiple_hold.js
+++ b/dom/telephony/test/marionette/test_multiple_hold.js
@@ -17,23 +17,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
     log("Received 'connecting' call event for original (incoming) call.");
@@ -44,17 +44,17 @@ function answerIncoming() {
 
   incomingCall.onconnected = function onconnectedIn(event) {
     log("Received 'connected' call event for original (incoming) call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       holdCall();
     });
   };
   incomingCall.answer();
 }
 
@@ -75,17 +75,17 @@ function holdCall() {
     is(incomingCall, event.call);
     is(incomingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       dial();
     });
   };
   incomingCall.hold();
 }
 
@@ -103,17 +103,17 @@ function dial() {
     is(telephony.calls[0], incomingCall);
     is(telephony.calls[1], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "inbound from " + inNumber + " : held");
         is(result[1], "outbound to  " + outNumber + " : ringing");
         answerOutgoing();
       });
     };
   });
 }
@@ -124,24 +124,24 @@ function answerOutgoing() {
 
   // We get no "connecting" event when the remote party answers the call.
   outgoingCall.onconnected = function onconnectedOut(event) {
     log("Received 'connected' call event for outgoing/2nd call.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       is(result[1], "outbound to  " + outNumber + " : active");
       holdSecondCall();
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 // With one held call and one active, hold the active one; expect the first
 // (held) call to automatically become active, and the 2nd call to go on hold
 function holdSecondCall() {
   let firstCallReconnected = false;
   let secondCallHeld = false;
 
@@ -182,17 +182,17 @@ function holdSecondCall() {
 }
 
 function verifyCalls() {
   is(telephony.active, incomingCall);
   is(telephony.calls.length, 2);
   is(telephony.calls[0], incomingCall);
   is(telephony.calls[1], outgoingCall);
 
-  emulator.runWithCallback("gsm list", function(result) {
+  emulator.runCmdWithCallback("gsm list", function(result) {
     log("Call list is now: " + result);
     is(result[0], "inbound from " + inNumber + " : active");
     is(result[1], "outbound to  " + outNumber + " : held");
     hangUpIncoming();
   });
 }
 
 // Hang-up the original incoming call, which is now active
@@ -213,17 +213,17 @@ function hangUpIncoming() {
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Now back to one call
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       hangUpOutgoing();
     });
   };
   incomingCall.hangUp();
 }
 
@@ -244,17 +244,17 @@ function hangUpOutgoing() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Now no calls
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   outgoingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_outgoing_already_held.js
+++ b/dom/telephony/test/marionette/test_outgoing_already_held.js
@@ -24,23 +24,23 @@ function simulateIncoming() {
 
     // Wait for emulator to catch up before continuing
     waitFor(verifyCallList,function() {
       return(rcvdEmulatorCallback);
     });
   };
 
   let rcvdEmulatorCallback = false;
-  emulator.runWithCallback("gsm call " + inNumber, function(result) {
+  emulator.runCmdWithCallback("gsm call " + inNumber, function(result) {
     rcvdEmulatorCallback = true;
   });
 }
 
 function verifyCallList(){
-  emulator.runWithCallback("gsm list", function(result) {
+  emulator.runCmdWithCallback("gsm list", function(result) {
     log("Call list is now: " + result);
     is(result[0], "inbound from " + inNumber + " : incoming");
     answerIncoming();
   });
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
@@ -56,17 +56,17 @@ function answerIncoming() {
   incomingCall.onconnected = function onconnectedIn(event) {
     log("Received 'connected' call event for original (incoming) call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       holdCall();
     });
   };
   incomingCall.answer();
 }
 
@@ -87,17 +87,17 @@ function holdCall(){
     is(incomingCall, event.call);
     is(incomingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       dial();
     });
   };
   incomingCall.hold();
 }
 
@@ -116,17 +116,17 @@ function dial() {
     is(telephony.calls[0], incomingCall);
     is(telephony.calls[1], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "inbound from " + inNumber + " : held");
         is(result[1], "outbound to  " + outNumber + " : ringing");
         answerOutgoing();
       });
     };
   });
 }
@@ -145,23 +145,23 @@ function answerOutgoing() {
 
     // Wait for emulator to catch up before continuing
     waitFor(checkCallList,function() {
       return(rcvdEmulatorCallback);
     });
   };
 
   let rcvdEmulatorCallback = false;
-  emulator.runWithCallback("gsm accept " + outNumber, function(result) {
+  emulator.runCmdWithCallback("gsm accept " + outNumber, function(result) {
     rcvdEmulatorCallback = true;
   });
 }
 
 function checkCallList(){
-  emulator.runWithCallback("gsm list", function(result) {
+  emulator.runCmdWithCallback("gsm list", function(result) {
     log("Call list is now: " + result);
     is(result[0], "inbound from " + inNumber + " : held");
     is(result[1], "outbound to  " + outNumber + " : active");
     hangUpIncoming();
   });
 }
 
 // Hang-up the original incoming call, which is now held
@@ -182,17 +182,17 @@ function hangUpIncoming() {
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Now back to one call
     is(telephony.active, outgoingCall);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
       hangUpOutgoing();
     });
   };
   incomingCall.hangUp();
 }
 
@@ -213,17 +213,17 @@ function hangUpOutgoing() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Now no calls
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   outgoingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_outgoing_answer_hangup.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup.js
@@ -22,17 +22,17 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoing, event.call);
       is(outgoing.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -43,44 +43,44 @@ function answer() {
 
   outgoing.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "connected");
 
     is(outgoing, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + " : active");
       hangUp();
     });
   };
-  emulator.runWithCallback("gsm accept " + number);
+  emulator.runCmdWithCallback("gsm accept " + number);
 }
 
 function hangUp() {
   log("Hanging up the outgoing call.");
 
   // We get no "disconnecting" event when the remote party terminates the call.
 
   outgoing.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + number);
+  emulator.runCmdWithCallback("gsm cancel " + number);
 }
 
 function cleanUp() {
   finish();
 }
 
 startTest(function() {
   dial();
--- a/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js
@@ -41,17 +41,17 @@ function dial() {
       cleanUp();
     }
   };
 
   telephony.dial(number);
 }
 
 function checkCallList() {
-  emulator.runWithCallback("gsm list", function(result) {
+  emulator.runCmdWithCallback("gsm list", function(result) {
     log("Call list is now: " + result);
     if (((result[0] == "outbound to  " + number + " : unknown") ||
          (result[0] == "outbound to  " + number + " : dialing"))) {
       answer();
     } else {
       window.setTimeout(checkCallList, 100);
     }
   });
@@ -64,29 +64,29 @@ function answer() {
 
   outgoing.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "connected");
 
     is(outgoing, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list (after 'connected' event) is now: " + result);
       is(result[0], "outbound to  " + number + " : active");
       hangUp();
     });
   };
-  emulator.runWithCallback("gsm accept " + number);
+  emulator.runCmdWithCallback("gsm accept " + number);
 }
 
 function hangUp() {
   log("Hanging up the outgoing call.");
 
-  emulator.runWithCallback("gsm cancel " + number);
+  emulator.runCmdWithCallback("gsm cancel " + number);
 }
 
 function cleanUp() {
   telephony.oncallschanged = null;
   finish();
 }
 
 startTest(function() {
--- a/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js
@@ -21,17 +21,17 @@ function dial() {
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'alerting' call event.");
 
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -42,23 +42,23 @@ function answer() {
 
   outgoingCall.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
 
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
       hangUp();
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 function hangUp() {
   log("Hanging up the outgoing call (local hang-up).");
 
   let gotDisconnecting = false;
   outgoingCall.ondisconnecting = function ondisconnectingOut(event) {
     log("Received 'disconnecting' call event.");
@@ -71,17 +71,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   outgoingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js
+++ b/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js
@@ -54,17 +54,17 @@ function remoteAnswer(call) {
 
   call.onconnected = function(event) {
     log("Received 'connected' call event.");
     call.onconnected = null;
     is(call, event.call);
     is(call.state, "connected");
     deferred.resolve(call);
   };
-  emulator.runWithCallback("gsm accept " + call.id.number);
+  emulator.runCmdWithCallback("gsm accept " + call.id.number);
 
   return deferred.promise;
 }
 
 function disableRadioAndWaitForCallEvent(call) {
   log("Disable radio and wait for call event.");
 
   let deferred = Promise.defer();
--- a/dom/telephony/test/marionette/test_outgoing_badNumber.js
+++ b/dom/telephony/test/marionette/test_outgoing_badNumber.js
@@ -25,17 +25,17 @@ function dial() {
     is(telephony.calls[0], outgoing);
 
     outgoing.onerror = function onerror(event) {
       log("Received 'error' event.");
       is(event.call, outgoing);
       ok(event.call.error);
       is(event.call.error.name, "BadNumberError");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Initial call list: " + result);
         cleanUp();
       });
     };
   });
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_outgoing_busy.js
+++ b/dom/telephony/test/marionette/test_outgoing_busy.js
@@ -20,40 +20,40 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoing, event.call);
       is(outgoing.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + " : ringing");
         busy();
       });
     };
   });
 }
 
 function busy() {
   log("The receiver is busy.");
 
   outgoing.onerror = function onerror(event) {
     log("Received 'error' call event.");
     is(outgoing, event.call);
     is(event.call.error.name, "BusyError");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
 
-  emulator.runWithCallback("gsm busy " + number);
+  emulator.runCmdWithCallback("gsm busy " + number);
 }
 
 function cleanUp() {
   finish();
 }
 
 startTest(function() {
   dial();
--- a/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js
+++ b/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js
@@ -19,17 +19,17 @@ function dial() {
 
     is(outgoing, telephony.active);
     //ok(telephony.calls === calls); // bug 717414
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'alerting' call event.");
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + " : ringing");
         hangUp();
       });
     };
   });
 }
 
@@ -49,17 +49,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
 
   outgoing.hangUp();
 }
 
--- a/dom/telephony/test/marionette/test_outgoing_hangup_held.js
+++ b/dom/telephony/test/marionette/test_outgoing_hangup_held.js
@@ -21,17 +21,17 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoing, event.call);
       is(outgoing.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -42,23 +42,23 @@ function answer() {
 
   outgoing.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "connected");
 
     is(outgoing, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + " : active");
       hold();
     });
   };
-  emulator.runWithCallback("gsm accept " + number);
+  emulator.runCmdWithCallback("gsm accept " + number);
 }
 
 function hold() {
   log("Holding the outgoing call.");
 
   outgoing.onholding = function onholding(event) {
     log("Received 'holding' call event.");
     is(outgoing, event.call);
@@ -70,17 +70,17 @@ function hold() {
   outgoing.onheld = function onheld(event) {
     log("Received 'held' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "held");
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + " : held");
       hangUp();
     });
   };
   outgoing.hold();
 }
 
@@ -99,17 +99,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(outgoing, event.call);
     is(outgoing.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
 
   outgoing.hangUp();
 }
 
--- a/dom/telephony/test/marionette/test_outgoing_hold_resume.js
+++ b/dom/telephony/test/marionette/test_outgoing_hold_resume.js
@@ -21,17 +21,17 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -42,23 +42,23 @@ function answer() {
 
   outgoingCall.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
 
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + " : active");
       hold();
     });
   };
-  emulator.runWithCallback("gsm accept " + number);
+  emulator.runCmdWithCallback("gsm accept " + number);
 }
 
 function hold() {
   log("Putting the call on hold.");
 
   let gotHolding = false;
   outgoingCall.onholding = function onholding(event) {
     log("Received 'holding' call event");
@@ -72,17 +72,17 @@ function hold() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + " : held");
       // Bug 781604: emulator assertion if outgoing call kept on hold
       // Wait on hold for a couple of seconds
       //log("Pausing 2 seconds while on hold");
       //setTimeout(resume, 2000);
       resume();
     });
@@ -106,17 +106,17 @@ function resume() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
     ok(gotResuming);
 
     is(outgoingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + number + " : active");
       hangUp();
     });
   };
   outgoingCall.resume();
 }
 
@@ -135,17 +135,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   outgoingCall.hangUp();
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_outgoing_onstatechange.js
+++ b/dom/telephony/test/marionette/test_outgoing_onstatechange.js
@@ -23,17 +23,17 @@ function dial() {
     outgoingCall.onstatechange = function statechangering(event) {
       log("Received 'onstatechange' call event.");
 
       is(outgoingCall, event.call);
       let expectedStates = ["dialing", "alerting"];
       ok(expectedStates.indexOf(event.call.state) != -1);
 
       if (event.call.state == "alerting") {
-        emulator.runWithCallback("gsm list", function(result) {
+        emulator.runCmdWithCallback("gsm list", function(result) {
           log("Call list is now: " + result);
           is(result[0], "outbound to  " + outNumber + " : ringing");
           answer();
         });
       }
     };
   });
 }
@@ -44,23 +44,23 @@ function answer() {
   // We get no "connecting" event when the remote party answers the call.
 
   outgoingCall.onstatechange = function onstatechangeanswer(event) {
     log("Received 'onstatechange' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
       hold();
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 function hold() {
   log("Putting the call on hold.");
 
   let gotHolding = false;
   outgoingCall.onstatechange = function onstatechangehold(event) {
     log("Received 'onstatechange' call event.");
@@ -69,17 +69,17 @@ function hold() {
       is(outgoingCall.state, "holding");
       gotHolding = true;
     } else {
       is(outgoingCall.state, "held");
       is(telephony.active, null);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], outgoingCall);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : held");
         resume();
       });
     }
   };
   outgoingCall.hold();
 }
@@ -95,17 +95,17 @@ function resume() {
       is(outgoingCall.state, "resuming");
       gotResuming = true;
     } else {
       is(outgoingCall.state, "connected");
       is(telephony.active, outgoingCall);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], outgoingCall);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : active");
         hangUp();
       });
     }
   };
   outgoingCall.resume();
 }
@@ -120,17 +120,17 @@ function hangUp() {
     if(!gotDisconnecting){
       is(outgoingCall.state, "disconnecting");
       gotDisconnecting = true;
     } else {
       is(outgoingCall.state, "disconnected");
       is(telephony.active, null);
       is(telephony.calls.length, 0);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         cleanUp();
       });
     }
   };
   outgoingCall.hangUp();
 }
 
--- a/dom/telephony/test/marionette/test_outgoing_radio_off.js
+++ b/dom/telephony/test/marionette/test_outgoing_radio_off.js
@@ -42,17 +42,17 @@ function dial(number) {
 
   telephony.dial(number).then(null, cause => {
     log("Received promise 'reject'");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
     is(cause, "RadioNotAvailable");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Initial call list: " + result);
 
       setRadioEnabled(true, cleanUp);
     });
   });
 }
 
 function cleanUp() {
--- a/dom/telephony/test/marionette/test_outgoing_reject.js
+++ b/dom/telephony/test/marionette/test_outgoing_reject.js
@@ -20,17 +20,17 @@ function dial() {
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoing);
 
     outgoing.onalerting = function onalerting(event) {
       log("Received 'onalerting' call event.");
       is(outgoing, event.call);
       is(outgoing.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + number + " : ringing");
         reject();
       });
     };
   });
 }
 
@@ -48,23 +48,23 @@ function reject() {
 
     // Wait for emulator to catch up before continuing
     waitFor(verifyCallList,function() {
       return(rcvdEmulatorCallback);
     });
   };
 
   let rcvdEmulatorCallback = false;
-  emulator.runWithCallback("gsm cancel " + number, function(result) {
+  emulator.runCmdWithCallback("gsm cancel " + number, function(result) {
     rcvdEmulatorCallback = true;
   });
 }
 
 function verifyCallList(){
-  emulator.runWithCallback("gsm list", function(result) {
+  emulator.runCmdWithCallback("gsm list", function(result) {
     log("Call list is now: " + result);
     cleanUp();
   });
 }
 
 function cleanUp() {
   finish();
 }
--- a/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js
+++ b/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js
@@ -20,17 +20,17 @@ function dial() {
     is(telephony.calls[0], outgoingCall);
 
     outgoingCall.onalerting = function onalerting(event) {
       log("Received 'alerting' call event.");
 
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -41,23 +41,23 @@ function answer() {
 
   outgoingCall.onconnected = function onconnected(event) {
     log("Received 'connected' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
 
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
       hold();
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 function hold() {
   log("Holding the outgoing call.");
 
   outgoingCall.onholding = function onholding(event) {
     log("Received 'holding' call event.");
     is(outgoingCall, event.call);
@@ -70,17 +70,17 @@ function hold() {
     log("Received 'held' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "held");
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       hangUp();
     });
   };
   outgoingCall.hold();
 }
 
@@ -92,22 +92,22 @@ function hangUp() {
   outgoingCall.ondisconnected = function ondisconnected(event) {
     log("Received 'disconnected' call event.");
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
-  emulator.runWithCallback("gsm cancel " + outNumber);
+  emulator.runCmdWithCallback("gsm cancel " + outNumber);
 }
 
 function cleanUp() {
   finish();
 }
 
 startTest(function() {
   dial();
--- a/dom/telephony/test/marionette/test_redundant_operations.js
+++ b/dom/telephony/test/marionette/test_redundant_operations.js
@@ -15,23 +15,23 @@ function simulateIncoming() {
     incomingCall = event.call;
     ok(incomingCall);
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
     log("Received 'connecting' call event for incoming call.");
@@ -43,17 +43,17 @@ function answerIncoming() {
   incomingCall.onconnected = function onconnectedIn(event) {
     log("Received 'connected' call event for incoming call.");
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       answerAlreadyConnected();
     });
   };
   incomingCall.answer();
 }
 
@@ -95,17 +95,17 @@ function hold() {
     is(incomingCall, event.call);
     is(incomingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       holdAlreadyHeld();
     });
   };
   incomingCall.hold();
 }
 
@@ -171,17 +171,17 @@ function resume() {
     is(incomingCall, event.call);
     is(incomingCall.state, "connected");
     ok(gotResuming);
 
     is(incomingCall, telephony.active);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : active");
       resumeNonHeld();
     });
   };
   incomingCall.resume();
 }
 
@@ -222,17 +222,17 @@ function hangUp() {
     log("Received 'disconnected' call event.");
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       answerDisconnected();
     });
   };
   incomingCall.hangUp();
 }
 
 function answerDisconnected() {
--- a/dom/telephony/test/marionette/test_swap_held_and_active.js
+++ b/dom/telephony/test/marionette/test_swap_held_and_active.js
@@ -24,17 +24,17 @@ function dial() {
       log("Received 'alerting' call event.");
 
       is(outgoingCall, event.call);
       is(outgoingCall.state, "alerting");
       is(outgoingCall, telephony.active);
       is(telephony.calls.length, 1);
       is(telephony.calls[0], outgoingCall);
 
-      emulator.runWithCallback("gsm list", function(result) {
+      emulator.runCmdWithCallback("gsm list", function(result) {
         log("Call list is now: " + result);
         is(result[0], "outbound to  " + outNumber + " : ringing");
         answer();
       });
     };
   });
 }
 
@@ -44,31 +44,31 @@ function answer() {
   // We get no "connecting" event when the remote party answers the call.
   outgoingCall.onconnected = function onconnectedOut(event) {
     log("Received 'connected' call event for the original outgoing call.");
 
     is(outgoingCall, event.call);
     is(outgoingCall.state, "connected");
     is(outgoingCall, telephony.active);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : active");
 
       if(!gotOriginalConnected){
         gotOriginalConnected = true;
         holdCall();
       } else {
         // Received connected event for original call multiple times (fail)
         ok(false,
            "Received 'connected' event for original call multiple times.");
       }
     });
   };
-  emulator.runWithCallback("gsm accept " + outNumber);
+  emulator.runCmdWithCallback("gsm accept " + outNumber);
 }
 
 function holdCall() {
   log("Putting the original (outgoing) call on hold.");
 
   let gotHolding = false;
   outgoingCall.onholding = function onholding(event) {
     log("Received 'holding' call event");
@@ -82,17 +82,17 @@ function holdCall() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "held");
     ok(gotHolding);
 
     is(telephony.active, null);
     is(telephony.calls.length, 1);
     is(telephony.calls[0], outgoingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       simulateIncoming();
     });
   };
   outgoingCall.hold();
 }
 
@@ -107,24 +107,24 @@ function simulateIncoming() {
     is(incomingCall.id.number, inNumber);
     is(incomingCall.state, "incoming");
 
     // Should be two calls now
     is(telephony.calls.length, 2);
     is(telephony.calls[0], outgoingCall);
     is(telephony.calls[1], incomingCall);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       is(result[1], "inbound from " + inNumber + " : incoming");
       answerIncoming();
     });
   };
-  emulator.runWithCallback("gsm call " + inNumber);
+  emulator.runCmdWithCallback("gsm call " + inNumber);
 }
 
 // Answer incoming call; original outgoing call should be held
 function answerIncoming() {
   log("Answering the incoming call.");
 
   let gotConnecting = false;
   incomingCall.onconnecting = function onconnectingIn(event) {
@@ -140,17 +140,17 @@ function answerIncoming() {
     ok(gotConnecting);
 
     is(incomingCall, telephony.active);
 
     // Original outbound call now held, incoming call active
     is(outgoingCall.state, "held");
     is(incomingCall.state, "connected");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "outbound to  " + outNumber + " : held");
       is(result[1], "inbound from " + inNumber + " : active");
       swapCalls();
     });
   };
   incomingCall.answer();
 }
@@ -193,17 +193,17 @@ function swapCalls() {
   outgoingCall.resume();
 }
 
 function verifySwap() {
   // Call status reflects swap
   is(outgoingCall.state, "connected");
   is(incomingCall.state, "held");
 
-  emulator.runWithCallback("gsm list", function(result) {
+  emulator.runCmdWithCallback("gsm list", function(result) {
     log("Call list is now: " + result);
     is(result[0], "outbound to  " + outNumber + " : active");
     is(result[1], "inbound from " + inNumber + " : held");
 
     // Begin hang-up
     hangUpOutgoing();
   });
 }
@@ -225,17 +225,17 @@ function hangUpOutgoing() {
     is(outgoingCall, event.call);
     is(outgoingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Back to one call now
     is(telephony.calls.length, 1);
     is(incomingCall.state, "held");
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       is(result[0], "inbound from " + inNumber + " : held");
       hangUpIncoming();
     });
   };
   outgoingCall.hangUp();
 }
 
@@ -256,17 +256,17 @@ function hangUpIncoming() {
     is(incomingCall, event.call);
     is(incomingCall.state, "disconnected");
     ok(gotDisconnecting);
 
     // Zero calls left
     is(telephony.active, null);
     is(telephony.calls.length, 0);
 
-    emulator.runWithCallback("gsm list", function(result) {
+    emulator.runCmdWithCallback("gsm list", function(result) {
       log("Call list is now: " + result);
       cleanUp();
     });
   };
   incomingCall.hangUp();
 }
 
 function cleanUp() {