Bug 892068 - Expose MCC/MNC to payment providers in mozPay() so Webpay can disable payments per region. r=fabrice
authorFernando Jiménez <ferjmoreno@gmail.com>
Tue, 30 Jul 2013 00:50:22 +0200
changeset 152670 776f2e0b6860c916373b97bd7d3b3dab2dadae9b
parent 152669 e660fb3f8481190efb9842cf65752d62825e3fb7
child 152671 747326be60835ee6caad49b0d8638259c52ebc62
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs892068
milestone25.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 892068 - Expose MCC/MNC to payment providers in mozPay() so Webpay can disable payments per region. r=fabrice
b2g/chrome/content/payment.js
--- a/b2g/chrome/content/payment.js
+++ b/b2g/chrome/content/payment.js
@@ -21,19 +21,19 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "@mozilla.org/childprocessmessagemanager;1",
                                    "nsIMessageSender");
 
 XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
                                    "@mozilla.org/uuid-generator;1",
                                    "nsIUUIDGenerator");
 
 #ifdef MOZ_B2G_RIL
-XPCOMUtils.defineLazyServiceGetter(this, "mobileConnection",
+XPCOMUtils.defineLazyServiceGetter(this, "iccProvider",
                                    "@mozilla.org/ril/content-helper;1",
-                                   "nsIMobileConnectionProvider");
+                                   "nsIIccProvider");
 
 XPCOMUtils.defineLazyServiceGetter(this, "smsService",
                                    "@mozilla.org/sms/smsservice;1",
                                    "nsISmsService");
 
 const kSilentSmsReceivedTopic = "silent-sms-received";
 
 const MOBILEMESSAGECALLBACK_CID =
@@ -85,16 +85,18 @@ let gRequestId;
 let gBrowser = Services.wm.getMostRecentWindow("navigator:browser");
 
 let PaymentProvider = {
 #ifdef MOZ_B2G_RIL
   __exposedProps__: {
     paymentSuccess: 'r',
     paymentFailed: 'r',
     iccIds: 'r',
+    mcc: 'r',
+    mnc: 'r',
     sendSilentSms: 'r',
     observeSilentSms: 'r',
     removeSilentSmsObserver: 'r'
   },
 #else
   __exposedProps__: {
     paymentSuccess: 'r',
     paymentFailed: 'r'
@@ -167,22 +169,31 @@ let PaymentProvider = {
         return;
       }
       cpmm.sendAsyncMessage("Payment:Failed", { errorMsg: aErrorMsg,
                                                 requestId: gRequestId });
     });
   },
 
 #ifdef MOZ_B2G_RIL
+  // Until bug 814629 is done, we only have support for a single SIM, so we
+  // can only provide information for a single ICC. However, we return an array
+  // so the payment provider facing API won't need to change once we support
+  // multiple SIMs.
+
   get iccIds() {
-    // Until bug 814629 is done, we only have support for a single SIM, so we
-    // can only provide a single ICC ID. However, we return an array so the
-    // payment provider facing API won't need to change once we support
-    // multiple SIMs.
-    return [mobileConnection.iccInfo.iccid];
+    return [iccProvider.iccInfo.iccid];
+  },
+
+  get mcc() {
+    return [iccProvider.iccInfo.mcc];
+  },
+
+  get mnc() {
+    return [iccProvider.iccInfo.mnc];
   },
 
   _silentNumbers: null,
   _silentSmsObservers: null,
 
   sendSilentSms: function sendSilentSms(aNumber, aMessage) {
     if (_DEBUG) {
       _debug("Sending silent message " + aNumber + " - " + aMessage);