Bug 805123 - Remove country code validation from navigator.mozPay(); r=fabrice

This commit is contained in:
Fernando Jiménez 2012-10-29 10:52:44 +01:00
parent 25b9cf9ef0
commit 163d82d7d1
3 changed files with 5 additions and 13 deletions

View File

@ -304,23 +304,21 @@ let PaymentManager = {
}
// The payment request 'price' parameter is a collection of objects with
// 'country', 'currency' and 'amount' members.
// 'currency' and 'amount' members.
let productPrices = [];
if (!Array.isArray(pldRequest.price)) {
pldRequest.price = [pldRequest.price];
}
for (let i in pldRequest.price) {
if (!pldRequest.price[i].country || !pldRequest.price[i].currency ||
!pldRequest.price[i].amount) {
if (!pldRequest.price[i].currency || !pldRequest.price[i].amount) {
debug("Not valid payment request. " +
"Price parameter is not well formed");
return null;
}
let price = Cc["@mozilla.org/payment/product-price;1"]
.createInstance(Ci.nsIDOMPaymentProductPrice);
price.wrappedJSObject.init(pldRequest.price[i].country,
pldRequest.price[i].currency,
price.wrappedJSObject.init(pldRequest.price[i].currency,
pldRequest.price[i].amount);
productPrices.push(price);
}

View File

@ -33,12 +33,10 @@ PaymentProductPrice.prototype = {
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMPaymentProductPrice]
}),
country: null,
currency: null,
amount: null,
init: function init(aCountry, aCurrency, aAmount) {
this.country = aCountry;
init: function init(aCurrency, aAmount) {
this.currency = aCurrency;
this.amount = aAmount;
}

View File

@ -4,13 +4,9 @@
#include "nsISupports.idl"
[scriptable, uuid(393f54dc-13c1-44e5-ad36-ab410dc3334b)]
[scriptable, uuid(2a9bc152-ce8d-4ac5-a2b0-7fb52501178e)]
interface nsIDOMPaymentProductPrice : nsISupports
{
// A product might have a different price depending on the country. Even if
// the currency is the same.
readonly attribute DOMString country;
// Each price has a currency associated.
readonly attribute DOMString currency;