Merge b2g-inbound to m-c.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 28 Jan 2014 16:12:29 -0500
changeset 165584 245b92f1de4f189b3e55a80451af0fca8c7ba40b
parent 165547 0eb2ba65a7023bbe0f5312ad8b626c7826c26534 (current diff)
parent 165583 0b882bc87916ab04d623f8aeb07127a8dec13a4a (diff)
child 165585 128c86a925d7f9ee71c61f90facef32e8ed63c1f
push id4623
push userryanvm@gmail.com
push dateTue, 28 Jan 2014 21:48:39 +0000
treeherderfx-team@7e79536aca0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone29.0a1
Merge b2g-inbound to m-c.
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="317f25e0a4cb3e8e86e2b76c37a14081372f0307">
     <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="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "34769c5ab47b95fe97fa0fe65e7e3a34f47b3f90", 
+    "revision": "2f947703e8fdb71a105462394ed2a4e0e3db391e", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -5,17 +5,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="317f25e0a4cb3e8e86e2b76c37a14081372f0307">
     <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="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e314d089d988f0eb1bef2404858c60b734dc4130"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="59e477229162926981cc00cf5d6c53f9614f17dd"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="a887bfabaed83c4588b40c845535c0388c8da0f3"/>
   <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/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1911,27 +1911,37 @@ TabParent::InjectTouchEvent(const nsAStr
 {
   uint32_t msg;
   nsContentUtils::GetEventIdAndAtom(aType, NS_TOUCH_EVENT, &msg);
   if (msg != NS_TOUCH_START && msg != NS_TOUCH_MOVE &&
       msg != NS_TOUCH_END && msg != NS_TOUCH_CANCEL) {
     return NS_ERROR_FAILURE;
   }
 
-  WidgetTouchEvent event(true, msg, nullptr);
+  nsCOMPtr<nsIWidget> widget = GetWidget();
+  if (!widget) {
+    return NS_ERROR_FAILURE;
+  }
+
+  WidgetTouchEvent event(true, msg, widget);
   event.modifiers = aModifiers;
   event.time = PR_IntervalNow();
 
   event.touches.SetCapacity(aCount);
   for (uint32_t i = 0; i < aCount; ++i) {
     nsRefPtr<Touch> t = new Touch(aIdentifiers[i],
                                   nsIntPoint(aXs[i], aYs[i]),
                                   nsIntPoint(aRxs[i], aRys[i]),
                                   aRotationAngles[i],
                                   aForces[i]);
+
+    // Consider all injected touch events as changedTouches. For more details
+    // about the meaning of changedTouches for each event, see
+    // https://developer.mozilla.org/docs/Web/API/TouchEvent.changedTouches
+    t->mChanged = true;
     event.touches.AppendElement(t);
   }
 
   SendRealTouchEvent(event);
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/mobilemessage/src/gonk/MmsService.js
+++ b/dom/mobilemessage/src/gonk/MmsService.js
@@ -54,18 +54,19 @@ const _HTTP_STATUS_USER_CANCELLED       
 const _HTTP_STATUS_RADIO_DISABLED              = -2;
 const _HTTP_STATUS_NO_SIM_CARD                 = -3;
 const _HTTP_STATUS_ACQUIRE_TIMEOUT             = -4;
 
 // Non-standard MMS status for internal use.
 const _MMS_ERROR_MESSAGE_DELETED               = -1;
 const _MMS_ERROR_RADIO_DISABLED                = -2;
 const _MMS_ERROR_NO_SIM_CARD                   = -3;
-const _MMS_ERROR_SHUTDOWN                      = -4;
-const _MMS_ERROR_USER_CANCELLED_NO_REASON      = -5;
+const _MMS_ERROR_SIM_CARD_CHANGED              = -4;
+const _MMS_ERROR_SHUTDOWN                      = -5;
+const _MMS_ERROR_USER_CANCELLED_NO_REASON      = -6;
 
 const CONFIG_SEND_REPORT_NEVER       = 0;
 const CONFIG_SEND_REPORT_DEFAULT_NO  = 1;
 const CONFIG_SEND_REPORT_DEFAULT_YES = 2;
 const CONFIG_SEND_REPORT_ALWAYS      = 3;
 
 const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
 
@@ -833,21 +834,25 @@ NotifyResponseTransaction.prototype = {
                                       null,
                                       this.istream,
                                       requestCallback);
   }
 };
 
 /**
  * CancellableTransaction - base class inherited by [Send|Retrieve]Transaction.
+ * We can call |cancelRunning(reason)| to cancel the on-going transaction.
  * @param cancellableId
  *        An ID used to keep track of if an message is deleted from DB.
+ * @param serviceId
+ *        An ID used to keep track of if the primary SIM service is changed.
  */
-function CancellableTransaction(cancellableId) {
+function CancellableTransaction(cancellableId, serviceId) {
   this.cancellableId = cancellableId;
+  this.serviceId = serviceId;
   this.isCancelled = false;
 }
 CancellableTransaction.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
   // The timer for retrying sending or retrieving process.
   timer: null,
 
@@ -859,28 +864,30 @@ CancellableTransaction.prototype = {
 
   cancelledReason: _MMS_ERROR_USER_CANCELLED_NO_REASON,
 
   registerRunCallback: function(callback) {
     if (!this.isObserversAdded) {
       Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
       Services.obs.addObserver(this, kMobileMessageDeletedObserverTopic, false);
       Services.prefs.addObserver(kPrefRilRadioDisabled, this, false);
+      Services.prefs.addObserver(kPrefDefaultServiceId, this, false);
       this.isObserversAdded = true;
     }
 
     this.runCallback = callback;
     this.isCancelled = false;
   },
 
   removeObservers: function() {
     if (this.isObserversAdded) {
       Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
       Services.obs.removeObserver(this, kMobileMessageDeletedObserverTopic);
       Services.prefs.removeObserver(kPrefRilRadioDisabled, this);
+      Services.prefs.removeObserver(kPrefDefaultServiceId, this);
       this.isObserversAdded = false;
     }
   },
 
   runCallbackIfValid: function(mmsStatus, msg) {
     this.removeObservers();
 
     if (this.runCallback) {
@@ -936,16 +943,19 @@ CancellableTransaction.prototype = {
           try {
             let radioDisabled = Services.prefs.getBoolPref(kPrefRilRadioDisabled);
             if (radioDisabled) {
               this.cancelRunning(_MMS_ERROR_RADIO_DISABLED);
             }
           } catch (e) {
             if (DEBUG) debug("Failed to get preference of 'ril.radio.disabled'.");
           }
+        } else if (data === kPrefDefaultServiceId &&
+                   this.serviceId != getDefaultServiceId()) {
+          this.cancelRunning(_MMS_ERROR_SIM_CARD_CHANGED);
         }
         break;
       }
     }
   }
 };
 
 /**
@@ -953,17 +963,17 @@ CancellableTransaction.prototype = {
  *
  * @param contentLocation
  *        X-Mms-Content-Location of the message.
  */
 function RetrieveTransaction(mmsConnection, cancellableId, contentLocation) {
   this.mmsConnection = mmsConnection;
 
   // Call |CancellableTransaction| constructor.
-  CancellableTransaction.call(this, cancellableId);
+  CancellableTransaction.call(this, cancellableId, mmsConnection.serviceId);
 
   this.contentLocation = contentLocation;
 }
 RetrieveTransaction.prototype = Object.create(CancellableTransaction.prototype, {
   /**
    * @param callback [optional]
    *        A callback function that takes two arguments: one for X-Mms-Status,
    *        the other for the parsed M-Retrieve.conf message.
@@ -1055,17 +1065,17 @@ RetrieveTransaction.prototype = Object.c
  * SendTransaction.
  *   Class for sending M-Send.req to MMSC, which inherits CancellableTransaction.
  *   @throws Error("Check max values parameters fail.")
  */
 function SendTransaction(mmsConnection, cancellableId, msg, requestDeliveryReport) {
   this.mmsConnection = mmsConnection;
 
   // Call |CancellableTransaction| constructor.
-  CancellableTransaction.call(this, cancellableId);
+  CancellableTransaction.call(this, cancellableId, mmsConnection.serviceId);
 
   msg.headers["x-mms-message-type"] = MMS.MMS_PDU_TYPE_SEND_REQ;
   if (!msg.headers["x-mms-transaction-id"]) {
     // Create an unique transaction id
     let tid = gUUIDGenerator.generateUUID().toString();
     msg.headers["x-mms-transaction-id"] = tid;
   }
   msg.headers["x-mms-mms-version"] = MMS.MMS_VERSION;
@@ -1634,17 +1644,18 @@ MmsService.prototype = {
     let reportAllowed = this.getReportAllowed(this.confSendDeliveryReport,
                                               wish);
     // If the mmsStatus isn't MMS_PDU_STATUS_RETRIEVED after retrieving,
     // something must be wrong with MMSC, so stop updating the DB record.
     // We could send a message to content to notify the user the MMS
     // retrieving failed. The end user has to retrieve the MMS again.
     if (MMS.MMS_PDU_STATUS_RETRIEVED !== mmsStatus) {
       if (mmsStatus != _MMS_ERROR_RADIO_DISABLED &&
-          mmsStatus != _MMS_ERROR_NO_SIM_CARD) {
+          mmsStatus != _MMS_ERROR_NO_SIM_CARD &&
+          mmsStatus != _MMS_ERROR_SIM_CARD_CHANGED) {
         let transaction = new NotifyResponseTransaction(mmsConnection,
                                                         transactionId,
                                                         mmsStatus,
                                                         reportAllowed);
         transaction.run();
       }
       // Retrieved fail after retry, so we update the delivery status in DB and
       // notify this domMessage that error happen.
@@ -2185,16 +2196,18 @@ MmsService.prototype = {
         if (DEBUG) debug("The sending status of sendTransaction.run(): " + aMmsStatus);
         let errorCode;
         if (aMmsStatus == _MMS_ERROR_MESSAGE_DELETED) {
           errorCode = Ci.nsIMobileMessageCallback.NOT_FOUND_ERROR;
         } else if (aMmsStatus == _MMS_ERROR_RADIO_DISABLED) {
           errorCode = Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR;
         } else if (aMmsStatus == _MMS_ERROR_NO_SIM_CARD) {
           errorCode = Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR;
+        } else if (aMmsStatus == _MMS_ERROR_SIM_CARD_CHANGED) {
+          errorCode = Ci.nsIMobileMessageCallback.NON_ACTIVE_SIM_CARD_ERROR;
         } else if (aMmsStatus != MMS.MMS_PDU_ERROR_OK) {
           errorCode = Ci.nsIMobileMessageCallback.INTERNAL_ERROR;
         } else {
           errorCode = Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR;
         }
         let envelopeId =
           aMsg && aMsg.headers && aMsg.headers["message-id"] || null;
         sendTransactionCb(aDomMessage, errorCode, envelopeId);
@@ -2299,16 +2312,18 @@ MmsService.prototype = {
         // status to 'error'.
         if (MMS.MMS_PDU_STATUS_RETRIEVED !== mmsStatus) {
           if (DEBUG) debug("RetrieveMessage fail after retry.");
           let errorCode = Ci.nsIMobileMessageCallback.INTERNAL_ERROR;
           if (mmsStatus == _MMS_ERROR_RADIO_DISABLED) {
             errorCode = Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR;
           } else if (mmsStatus == _MMS_ERROR_NO_SIM_CARD) {
             errorCode = Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR;
+          } else if (mmsStatus == _MMS_ERROR_SIM_CARD_CHANGED) {
+            errorCode = Ci.nsIMobileMessageCallback.NON_ACTIVE_SIM_CARD_ERROR;
           }
           gMobileMessageDatabaseService
             .setMessageDeliveryByMessageId(aMessageId,
                                            null,
                                            null,
                                            DELIVERY_STATUS_ERROR,
                                            null,
                                            function() {
--- a/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
+++ b/dom/mobilemessage/src/gonk/MobileMessageDB.jsm
@@ -2600,17 +2600,17 @@ MobileMessageDB.prototype = {
         if (DEBUG) debug(error);
         collector.collect(null, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
         return;
       }
       txn.onerror = function onerror(event) {
         if (DEBUG) debug("Caught error on transaction ", event.target.errorCode);
         collector.collect(null, COLLECT_ID_ERROR, COLLECT_TIMESTAMP_UNUSED);
       };
-      let request = threadStore.index("lastTimestamp").openKeyCursor();
+      let request = threadStore.index("lastTimestamp").openKeyCursor(null, PREV);
       request.onsuccess = function(event) {
         let cursor = event.target.result;
         if (cursor) {
           if (collector.collect(txn, cursor.primaryKey, cursor.key)) {
             cursor.continue();
           }
         } else {
           collector.collect(txn, COLLECT_ID_END, COLLECT_TIMESTAMP_UNUSED);
--- a/dom/mobilemessage/tests/marionette/test_getthreads.js
+++ b/dom/mobilemessage/tests/marionette/test_getthreads.js
@@ -371,16 +371,19 @@ tasks.push(sendMessage.bind(null, "55521
 tasks.push(sendMessage.bind(null, "+5511555211018", "thread 18-2"));
 checkFuncs.push(checkThread.bind(null, ["thread 18-1", "thread 18-2"],
                                  "thread 18-2", 0, ["555211018"]));
 
 // Check threads.
 tasks.push(getAllThreads.bind(null, function(threads) {
   is(threads.length, checkFuncs.length, "number of threads got");
 
+  // Reverse threads as we iterate over them in reverse order
+  threads.reverse();
+
   (function callback() {
     if (!threads.length) {
       tasks.next();
       return;
     }
 
     checkFuncs.shift()(threads.shift(), callback);
   })();
--- a/dom/network/tests/unit_stats/test_networkstats_service_proxy.js
+++ b/dom/network/tests/unit_stats/test_networkstats_service_proxy.js
@@ -122,20 +122,20 @@ add_test(function test_saveServiceStats(
       do_check_eq(cachedStats[key2].appId, 0);
       do_check_eq(cachedStats[key1].serviceType, serviceType);
       do_check_eq(cachedStats[key2].networkId, mobile.id);
       do_check_eq(cachedStats[key2].networkType, mobile.type);
       do_check_eq(new Date(cachedStats[key2].date).getTime() / 1000,
                   Math.floor(timestamp / 1000));
       do_check_eq(cachedStats[key2].rxBytes, 50);
       do_check_eq(cachedStats[key2].txBytes, 100);
+
+      run_next_test();
     }
   );
-
-  run_next_test();
 });
 
 add_test(function test_saveStatsWithDifferentDates() {
   var today = NetworkStatsService.cachedStatsDate;
   var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
 
   var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
   var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
--- a/netwerk/protocol/http/UserAgentOverrides.jsm
+++ b/netwerk/protocol/http/UserAgentOverrides.jsm
@@ -27,16 +27,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
 var gPrefBranch;
 var gOverrides = new Map;
 var gUpdatedOverrides;
 var gOverrideForHostCache = new Map;
 var gInitialized = false;
 var gOverrideFunctions = [
   function (aHttpChannel) UserAgentOverrides.getOverrideForURI(aHttpChannel.URI)
 ];
+var gBuiltUAs = new Map;
 
 this.UserAgentOverrides = {
   init: function uao_init() {
     if (gInitialized)
       return;
 
     gPrefBranch = Services.prefs.getBranch("general.useragent.override.");
     gPrefBranch.addObserver("", buildOverrides, false);
@@ -48,16 +49,19 @@ this.UserAgentOverrides = {
       Services.obs.addObserver(HTTP_on_modify_request, "http-on-modify-request", false);
     } catch (x) {
       // The http-on-modify-request notification is disallowed in content processes.
     }
 
     UserAgentUpdates.init(function(overrides) {
       gOverrideForHostCache.clear();
       if (overrides) {
+        for (let domain in overrides) {
+          overrides[domain] = getUserAgentFromOverride(overrides[domain]);
+        }
         overrides.get = function(key) this[key];
       }
       gUpdatedOverrides = overrides;
     });
 
     buildOverrides();
     gInitialized = true;
   },
@@ -124,39 +128,45 @@ this.UserAgentOverrides = {
         let uri = aMessage.data.uri;
         return this.getOverrideForURI(uri);
       default:
         throw("Wrong Message in UserAgentOverride: " + name);
     }
   }
 };
 
+function getUserAgentFromOverride(override)
+{
+  let userAgent = gBuiltUAs.get(override);
+  if (userAgent !== undefined) {
+    return userAgent;
+  }
+  let [search, replace] = override.split("#", 2);
+  if (search && replace) {
+    userAgent = DEFAULT_UA.replace(new RegExp(search, "g"), replace);
+  } else {
+    userAgent = override;
+  }
+  gBuiltUAs.set(override, userAgent);
+  return userAgent;
+}
+
 function buildOverrides() {
   gOverrides.clear();
   gOverrideForHostCache.clear();
 
   if (!Services.prefs.getBoolPref(PREF_OVERRIDES_ENABLED))
     return;
 
   let builtUAs = new Map;
   let domains = gPrefBranch.getChildList("");
 
   for (let domain of domains) {
     let override = gPrefBranch.getCharPref(domain);
-    let userAgent = builtUAs.get(override);
-
-    if (userAgent === undefined) {
-      let [search, replace] = override.split("#", 2);
-      if (search && replace) {
-        userAgent = DEFAULT_UA.replace(new RegExp(search, "g"), replace);
-      } else {
-        userAgent = override;
-      }
-      builtUAs.set(override, userAgent);
-    }
+    let userAgent = getUserAgentFromOverride(override);
 
     if (userAgent != DEFAULT_UA) {
       gOverrides.set(domain, userAgent);
     }
   }
 }
 
 function HTTP_on_modify_request(aSubject, aTopic, aData) {
--- a/netwerk/test/mochitests/test_user_agent_updates.html
+++ b/netwerk/test/mochitests/test_user_agent_updates.html
@@ -25,16 +25,22 @@ const PREF_UPDATES_TIMEOUT = PREF_UPDATE
 const KEY_PREFDIR = "PrefD";
 const KEY_APPDIR = "XCurProcD";
 const FILE_UPDATES = "ua-update.json";
 
 const DEFAULT_UA = navigator.userAgent;
 const UA_OVERRIDE = "DummyUserAgent";
 const UA_ALT_OVERRIDE = "AltUserAgent";
 
+const UA_PARTIAL_FROM = "\\wozilla"; // /\wozilla
+const UA_PARTIAL_SEP = "#";
+const UA_PARTIAL_TO = UA_OVERRIDE;
+const UA_PARTIAL_OVERRIDE = UA_PARTIAL_FROM + UA_PARTIAL_SEP + UA_PARTIAL_TO;
+const UA_PARTIAL_EXPECTED = DEFAULT_UA.replace(new RegExp(UA_PARTIAL_FROM, 'g'), UA_PARTIAL_TO);
+
 function getUA(host) {
   var url = location.pathname;
   url = host + url.slice(0, url.lastIndexOf('/')) + '/user_agent.sjs';
 
   var xhr = new XMLHttpRequest();
   xhr.open('GET', url, false); // sync request
   xhr.send();
   is(xhr.status, 200, 'request failed');
@@ -73,16 +79,22 @@ const OVERRIDES = [
     host: 'http://sub2.test1.example.org'
   },
   {
     domain: 'sub1.test2.example.org',
     override: '%OS%',
     expected: SpecialPowers.Services.appinfo.OS,
     host: 'http://sub1.test2.example.org'
   },
+  {
+    domain: 'sub2.test2.example.org',
+    override: UA_PARTIAL_OVERRIDE,
+    expected: UA_PARTIAL_EXPECTED,
+    host: 'http://sub2.test2.example.org'
+  },
 ];
 
 function getServerURL() {
   var url = location.pathname;
   return location.origin + url.slice(0, url.lastIndexOf('/')) + '/user_agent_update.sjs?';
 }
 
 function getUpdateURL() {
--- a/security/sandbox/linux/seccomp_filter.h
+++ b/security/sandbox/linux/seccomp_filter.h
@@ -250,18 +250,21 @@
   /* open() is for some legacy APIs such as font loading. */ \
   /* See bug 906996 for removing unlink(). */ \
   SECCOMP_WHITELIST_ARCH_TOREMOVE \
   ALLOW_SYSCALL(open), \
   ALLOW_SYSCALL(prctl), \
   ALLOW_SYSCALL(access), \
   ALLOW_SYSCALL(unlink), \
   ALLOW_SYSCALL(fsync), \
+  ALLOW_SYSCALL(msync), \
   /* Should remove all of the following in the future, if possible */ \
   ALLOW_SYSCALL(getpriority), \
+  ALLOW_SYSCALL(sched_get_priority_min), \
+  ALLOW_SYSCALL(sched_get_priority_max), \
   ALLOW_SYSCALL(setpriority), \
   SECCOMP_WHITELIST_PROFILING \
   SECCOMP_WHITELIST_B2G_LOW \
   /* Always last and always OK calls */ \
   SECCOMP_WHITELIST_ARCH_LAST \
   /* restart_syscall is called internally, generally when debugging */ \
   ALLOW_SYSCALL(restart_syscall), \
   /* linux desktop is not as performance critical as B2G */ \