Bug 872149 - Make Payments ui use async prompts. r=mfinkle
☠☠ backed out by b11bffd58de9 ☠ ☠
authorWes Johnston <wjohnston@mozilla.com>
Mon, 03 Jun 2013 09:20:45 -0700
changeset 133818 80455a25276b4eed1fbe9067c901860ae08c1a3d
parent 133817 c3b5567f1271c88ebc991c6155a35e3db5121d34
child 133819 8904d2bf5da0db6c4dddb632ae85291ffa6e6cc3
push id28907
push userwjohnston@mozilla.com
push dateMon, 03 Jun 2013 16:22:12 +0000
treeherdermozilla-inbound@8904d2bf5da0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs872149
milestone24.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
Bug 872149 - Make Payments ui use async prompts. r=mfinkle
mobile/android/components/PaymentsUI.js
--- a/mobile/android/components/PaymentsUI.js
+++ b/mobile/android/components/PaymentsUI.js
@@ -77,38 +77,29 @@ PaymentUI.prototype = {
     // Otherwise, let the user select a payment provider from a list.
     for (let i = 0; i < aRequests.length; i++) {
       let request = aRequests[i].wrappedJSObject;
       let requestText = request.providerName;
       if (request.productPrice) {
         requestText += " (" + request.productPrice[0].amount + " " +
                               request.productPrice[0].currency + ")";
       }
-      listItems.push({
-        label: requestText,
-        isGroup: false,
-        inGroup: false,
-        disabled: false,
-        id: i
-      });
+      listItems.push({ label: requestText });
     }
 
-    let result = this.sendMessageToJava({
-      type: "Prompt:Show",
+    let p = new Prompt({
+      window: null,
       title: this.bundle.GetStringFromName("payments.providerdialog.title"),
-      multiple: false,
-      selected: [],
-      listItems: listItems,
+    }).setSingleChoiceItems(listItems).show(function(data) {
+      if (data.button > -1 && aSuccessCb) {
+        aSuccessCb.onresult(aRequestId, aRequests[data.button].wrappedJSObject.type);
+      } else {
+        _error(aRequestId, "USER_CANCELED");
+      }
     });
-
-    if (result.button > -1 && aSuccessCb) {
-      aSuccessCb.onresult(aRequestId, aRequests[result.button].wrappedJSObject.type);
-    } else {
-      _error(aRequestId, "USER_CANCELED");
-    }
   },
 
   _error: function(aCallback) {
     return function _error(id, msg) {
       if (aCallback) {
         aCallback.onresult(id, msg);
       }
     };