Merge mozilla-central and b2g-inbound
authorEd Morley <emorley@mozilla.com>
Tue, 26 Nov 2013 16:54:25 +0000
changeset 157619 01af7b415f3f31730462dc9e2cfaa9153266c8e3
parent 157524 34f43186303704b64cdfd2707089d0d226effe78 (current diff)
parent 157618 1942702e8f969323222aabe2d71369cf39d6b8b0 (diff)
child 157620 49f62fb6007b8be244c1cfe7157e1c1e5274de9a
push id25717
push userkwierso@gmail.com
push dateWed, 27 Nov 2013 01:34:26 +0000
treeherdermozilla-central@a6a046acc881 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central and b2g-inbound
widget/windows/winrt/APZController.cpp
--- a/b2g/components/PaymentGlue.js
+++ b/b2g/components/PaymentGlue.js
@@ -61,30 +61,32 @@ PaymentUI.prototype = {
       id: id,
       requestId: aRequestId,
       paymentRequests: aRequests
     };
 
     // Once the user confirm the payment request and makes his choice, we get
     // back to the DOM part to get the appropriate payment flow information
     // based on the selected payment provider.
-    content.addEventListener("mozContentEvent", function handleSelection(evt) {
+    this._handleSelection = (function _handleSelection(evt) {
       let msg = evt.detail;
       if (msg.id != id) {
         return;
       }
 
       if (msg.userSelection && aSuccessCb) {
         aSuccessCb.onresult(aRequestId, msg.userSelection);
       } else if (msg.errorMsg) {
         _error(msg.errorMsg);
       }
 
-      content.removeEventListener("mozContentEvent", handleSelection);
-    });
+      content.removeEventListener("mozContentEvent", this._handleSelection);
+      this._handleSelection = null;
+    }).bind(this);
+    content.addEventListener("mozContentEvent", this._handleSelection);
 
     browser.shell.sendChromeEvent(detail);
   },
 
   showPaymentFlow: function showPaymentFlow(aRequestId,
                                             aPaymentFlowInfo,
                                             aErrorCb) {
     let _error = function _error(errorMsg) {
@@ -109,72 +111,104 @@ PaymentUI.prototype = {
       uri: aPaymentFlowInfo.uri,
       method: aPaymentFlowInfo.requestMethod,
       jwt: aPaymentFlowInfo.jwt
     };
 
     // At some point the UI would send the created iframe back so the
     // callbacks for firing DOMRequest events can be loaded on its
     // content.
-    content.addEventListener("mozContentEvent", (function loadPaymentShim(evt) {
-      if (evt.detail.id != id) {
-        content.removeEventListener("mozContentEvent", loadPaymentShim);
+    this._loadPaymentShim = (function _loadPaymentShim(evt) {
+      let msg = evt.detail;
+      if (msg.id != id) {
+        return;
+      }
+
+      if (msg.errorMsg) {
+        content.removeEventListener("mozContentEvent", this._loadPaymentShim);
+        this._loadPaymentShim = null;
+        _error("ERROR_LOADING_PAYMENT_SHIM: " + msg.errorMsg);
+        return;
+      }
+
+      if (!msg.frame) {
+        content.removeEventListener("mozContentEvent", this._loadPaymentShim);
+        this._loadPaymentShim = null;
+        _error("ERROR_LOADING_PAYMENT_SHIM");
         return;
       }
 
       // Try to load the payment shim file containing the payment callbacks
       // in the content script.
-      if (!evt.detail.frame && !evt.detail.errorMsg) {
-        _error("ERROR_LOADING_PAYMENT_SHIM");
-        return;
-      }
-      let frame = evt.detail.frame;
+      let frame = msg.frame;
       let frameLoader = frame.QueryInterface(Ci.nsIFrameLoaderOwner)
-                        .frameLoader;
+                             .frameLoader;
       let mm = frameLoader.messageManager;
       try {
         mm.loadFrameScript(kPaymentShimFile, true);
         mm.sendAsyncMessage("Payment:LoadShim", { requestId: aRequestId });
       } catch (e) {
         if (this._debug) {
           this.LOG("Error loading " + kPaymentShimFile + " as a frame script: "
                     + e);
         }
         _error("ERROR_LOADING_PAYMENT_SHIM");
       } finally {
-        content.removeEventListener("mozContentEvent", loadPaymentShim);
+        content.removeEventListener("mozContentEvent", this._loadPaymentShim);
+        this._loadPaymentShim = null;
       }
-    }).bind(this));
+    }).bind(this);
+    content.addEventListener("mozContentEvent", this._loadPaymentShim);
 
     // We also listen for UI notifications about a closed payment flow. The UI
     // should provide the reason of the closure within the 'errorMsg' parameter
-    this._notifyPayFlowClosed = function _notifyPayFlowClosed (evt) {
-      if (evt.detail.id != id) {
+    this._notifyPayFlowClosed = (function _notifyPayFlowClosed(evt) {
+      let msg = evt.detail;
+      if (msg.id != id) {
+        return;
+      }
+
+      if (msg.type != 'cancel') {
         return;
       }
-      if (evt.detail.errorMsg) {
-        _error(evt.detail.errorMsg);
-        content.removeEventListener("mozContentEvent",
-                                    this._notifyPayFlowClosed);
-        return;
+
+      if (msg.errorMsg) {
+        _error(msg.errorMsg);
       }
-    };
+      content.removeEventListener("mozContentEvent",
+                                  this._notifyPayFlowClosed);
+      this._notifyPayFlowClosed = null;
+    }).bind(this);
     content.addEventListener("mozContentEvent",
-                             this._notifyPayFlowClosed.bind(this));
+                             this._notifyPayFlowClosed);
 
     browser.shell.sendChromeEvent(detail);
   },
 
   cleanup: function cleanup() {
     let browser = Services.wm.getMostRecentWindow("navigator:browser");
     let content = browser.getContentWindow();
     if (!content) {
       return;
     }
-    content.removeEventListener("mozContentEvent", this._notifyPayFlowClosed);
+
+    if (this._handleSelection) {
+      content.removeEventListener("mozContentEvent", this._handleSelection);
+      this._handleSelection = null;
+    }
+
+    if (this._notifyPayFlowClosed) {
+      content.removeEventListener("mozContentEvent", this._notifyPayFlowClosed);
+      this._notifyPayFlowClosed = null;
+    }
+
+    if (this._loadPaymentShim) {
+      content.removeEventListener("mozContentEvent", this._loadPaymentShim);
+      this._loadPaymentShim = null;
+    }
   },
 
   getRandomId: function getRandomId() {
     return uuidgen.generateUUID().toString();
   },
 
   LOG: function LOG(s) {
     if (!this._debug) {
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "fefcf4aab784c6e9a0c8b3f4b282c21fb0e0ac6e", 
+    "revision": "3c75e49f5f1bce3b2bab558146ff2a8f5bafd601", 
     "repo_path": "/integration/gaia-central"
 }
--- a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
+++ b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js
@@ -1776,25 +1776,31 @@ MobileMessageDatabaseService.prototype =
         insertMessageRecord(threadId);
       };
     });
   },
 
   forEachMatchedMmsDeliveryInfo:
     function forEachMatchedMmsDeliveryInfo(aDeliveryInfo, aNeedle, aCallback) {
 
-    let typedAddress = MMS.Address.resolveType(aNeedle);
+    let typedAddress = {
+      type: MMS.Address.resolveType(aNeedle),
+      address: aNeedle
+    };
     let normalizedAddress, parsedAddress;
     if (typedAddress.type === "PLMN") {
       normalizedAddress = PhoneNumberUtils.normalize(aNeedle, false);
       parsedAddress = PhoneNumberUtils.parse(normalizedAddress);
     }
 
     for (let element of aDeliveryInfo) {
-      let typedStoredAddress = MMS.Address.resolveType(element.receiver);
+      let typedStoredAddress = {
+        type: MMS.Address.resolveType(element.receiver),
+        address: element.receiver
+      };
       if (typedAddress.type !== typedStoredAddress.type) {
         // Not even my type.  Skip.
         continue;
       }
 
       if (typedAddress.address == typedStoredAddress.address) {
         // Have a direct match.
         aCallback(element);