This patch changes the test_construction.html with following modification.
1. Modify the test testWithDuplicateShippingOptionsParameters to expect a
TypeError when constructing wiht duplicate shippingOption ids.
2. Add test testShippingOtpionAttribute for shippingOption setting checking
with following conditions
1. No selected shippingOption and PaymentOptions.requestShipping is false
2. One selected shippingOption and PaymentOptions.requestShipping is false
3. One selected shippingOption and PaymentOptions.requestShipping is true
4. Multiple selected shippingOptions and PaymentOptions.requestShipping is
true.
This patch implements the following changes according to the spec change.
See https://w3c.github.io/payment-request/#constructor step 8 for more
details.
1. Return TypeError during PaymentRequest construction with duplicate
shippingOption id.
2. Set PaymentRequest.shippingOption with the selected shippingOption only
if options.requestShipping is true.
1. Create a new test test_currency_amount_validation.html to test validation
with following scenarios
* test with well formed currency codes.
* test with invalid currency codes.
* test with valid lower case currency codes and check is it converted to
upper case.
* test with invalid currency codes while calling
PaymentRequestUpdateEvent::updateWith().
* test with invalid amount value with calling
PaymentRequestUpdateEvent::updateWith().
2. Move tests of test_validate_decimal_value.html to
test_currency_amount_validation.html
This patch implements currency validation algorithm according to the spec
https://w3c.github.io/payment-request/#validity-checkers.
1. amount.currencySystem must be "urn:iso:std:iso:4217".
2. amount.currency is valid with following criteria
1. The currency length must be 3.
2. The currency contains any character that must be in the range "A" to
"Z"(U+0041 to U+005A) or the range "a" to "z"(U+0061 to U+007A).
According to the spec, converting the currency to upper case and save it in
nsIPaymentRequest.
Replace it with NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION, because it
has been the same for a while.
MozReview-Commit-ID: 5agRGFyUry1
--HG--
extra : rebase_source : 5388c56b2f6905c6ef969150f0c5b77bf247624d
1. Create a new action response status PAYMENT_NOTSUPPORTED and get rid of
unnecessary method isAccpeted() from nsIPaymentActionResponse.idl.
2. Create canMakePayment() in PaymentRequestService and run it before
launching UI. If canMakePayment() returns false, send PAYMENT_NOTSUPPORTED
back to content process.
3. If chrome process returns PAYMENT_NOTSUPPORTED when calling showPayment(),
throw NotSupportedError DOMException to merchant side.
1. Adding new checks in ConstructorChromeScript.js to checking the top level
document's principal information.
2. Adding a new test testCrossOriginTopLevelPrincipal in
test_constructor.html to testing the topLevelPrincipal attribute under
cross origin situation.
3. Removing some useless mochitest browser-chrome testcase.
Getting the top level document's principal when constructing PaymentRequest,
then sending it to chrome process and saving it in nsIPaymentRequest.
Creating a new readonly attribute nsIPrincipal topLevelPrincipal in
nsIPaymentRequest for UI to query the top level document's principal
information.
Per spec, given details and options parameters of PaymentRequest constructor,
1) if details.shippingOptions exists and IDs of all shipping options are unique,
request's shippingOption will be set to the last selected option's ID.
Otherwise, set request's shippingOption to null.
2) if options.requestShipping is ture, set request's shippingType to
options.shippingType. Otherwise, set request's shippingType to null.