Commit Graph

23 Commits

Author SHA1 Message Date
Eden Chuang
b4cd2e70aa Bug 1408234 - Cleanup the PaymentRequests when document close. r=baku
Let PaymentRequest inherit from nsIDocumentActivity interface.
    Calling RegisterActivityObserver() and UnregisterActivityObserver() in
    constructor and destructor to get activity notifications from document.
    When receiving the notification, NotifyOwnerDocumentActivityChanged() will
    check the owner document's activity status. If the status is disabled, calling
    PaymentRequestManager::CleanupPayment() to cleanup the PaymentRequest in
    content process and aslo sending the cleanup information to chrome process.
2018-08-13 11:24:54 +02:00
Marcos Cáceres
60e5daf61c Bug 1468356 - Implement onpaymentmethodchange attribute. r=mrbkap
--HG--
extra : rebase_source : 220c160ce0a4ab0568285c276de7326d4a16da23
2018-06-30 10:11:00 +03:00
Blake Kaplan
49d7053a3e Bug 1442453 - Create a single IPC actor per PaymentRequest. r=baku
There isn't any need to create an actor per call to the parent. This patch
lines up PaymentRequest with PPaymentRequestChild objects and links them
together. It also simplifies the maps and arrays we use to keep track of these
objects.

There's one tricky bit to note in this patch: in the case that a promise is
passed to paymentRequest.show(), we don't notify the parent process until the
promise resolves (when we call either UpdatePayment or AbortUpdate). In that
case, I needed to distinguish between an "update" because of the promise
resolving or a call to updateWith on an shippingaddresschange event in order
to get the bookkeeping right with the mActivePayments hashtable. In that case,
the PaymentRequest is kept alive by mShowingRequest alone. In all other cases,
mActivePayments keeps the PaymentRequest alive until we resolve or reject the
correct promise.

MozReview-Commit-ID: HoHjn8eqC4T

--HG--
extra : rebase_source : 4da1d65d1f791f4a5c18871ab3a3dcf94e833b90
2018-05-31 13:30:29 -07:00
Eden Chuang
1537e9d304 Bug 1441709 - Support PaymentRequest.show() with an optional PaymentDetailsUpdate promise parameter. r=baku
1. Add "optional Promise<PaymentDetailsUpdate> detailsPromise" as a parameter
   of PaymentRequest.show() in PaymentRequest.webidl.
2. Let PaymentRequest inherit from PromiseNativeHandler, and implement the
   ResolvedCallback() and RejectedCallback() to handle the PaymentDetailsUpdate
   promise.
3. Update PaymentRequest.show() implementation. If PaymentDetailsUpdate Promise
   is not nullptr, the show request would not be transferred to chrome process
   immediately until the promise is resolved/rejected.
4. Update selectedShippingOption when requestShipping is true.
5. Change the PaymentMethod id validation sequence according to the spec.

--HG--
extra : histedit_source : e591c759037cce4f66701b2faa5ecbe01c00e246
2018-04-02 23:12:21 +08:00
Henri Sivonen
2eb6c4eda3 Bug 1436903 - Avoid passing shipping options to the front end when shipping was not requested. r=baku
MozReview-Commit-ID: FdkC02izUy6

--HG--
extra : rebase_source : 4434a148379e33771950848c6cdf1350e33eb23b
2018-03-07 13:16:46 +02:00
Henri Sivonen
707e82855c Bug 1435155 - Redact the shipping address as it is visible before the promise from PaymentRequest.show() resolves successfully. r=baku
Spec PR: https://github.com/w3c/payment-request/pull/654

MozReview-Commit-ID: 2AiKI7htRhk

--HG--
extra : rebase_source : 3a1e41f8322424f1e57a5887d2d87862e609165d
2018-03-07 09:39:08 +02:00
Andreea Pavel
dc797492f3 Backed out changeset 8a29a154e88d (bug 1435155) for browser chrome leakchecks (APZEventState, ActiveElementManager, Array, AsyncFreeSnowWhite, AsyncLatencyLogger, ...) on a CLOSED TREE 2018-03-07 18:19:29 +02:00
Henri Sivonen
a4da46bb89 Bug 1435155 - Redact the shipping address as it is visible before the promise from PaymentRequest.show() resolves successfully. r=baku
Spec PR: https://github.com/w3c/payment-request/pull/654

MozReview-Commit-ID: 2AiKI7htRhk

--HG--
extra : rebase_source : 77ea27abe066bd62a0ac84f52731fa52ea938b73
2018-03-07 09:39:08 +02:00
Andrew McCreight
298aa82710 Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot
This was automatically generated by the script modeline.py.

MozReview-Commit-ID: BgulzkGteAL

--HG--
extra : rebase_source : a4b9d16a4c06c4e85d7d85f485221b1e4ebdfede
2017-10-26 15:08:41 -07:00
Eden Chuang
3d2f4c7cfc Bug 1403080 - Return null DOMString while PaymentOptions.requestShipping is false. r=baku
--HG--
extra : rebase_source : ec5f87928253c69d834f2a7a9a0c9b3b1f523c45
2017-09-28 15:20:19 +08:00
Eden Chuang
150de62804 Bug 1389418 - Support payment method identifier validation in PaymentRequest API. r=baku
This patch implements payment method identifier validation algorithm
according to the spec https://w3c.github.io/payment-method-id/.

The steps to validate a payment method identifier with a string pmi are
given by the following algorithm. It returns true if the pmi is valid.

1. Let url be the result of running the basic URL parser with pmi.
2. If url is failure, validate a standardized payment method identifier with
   pmi and return the result.
3. Otherwise, validate a URL-based payment method identifier passing url and
   return the result.
2017-09-11 09:52:24 +08:00
Eden Chuang
2638e37728 Bug 1388661 - Support currency validation in PaymentRequet API. r=baku
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.
2017-09-06 14:36:24 +08:00
Eden Chuang
af95d86b7f Bug 1385187 - Reject PaymentRequest.show() with NotSupportedError DOMException if no supported method. r=baku
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.
2017-08-28 11:55:59 +08:00
Eden Chuang
4a1f15b449 Bug 1375345 - Basic card payment implementation. r=baku
--HG--
extra : rebase_source : d581a1e117bdfc041940911487187620c5ed35ff
2017-07-26 16:07:07 +08:00
Jocelyn Liu
809522fb3a Bug 1367694 - Set payment request's shippingOption and shippingType attributes when creating it. r=baku
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.
2017-07-05 15:16:43 -07:00
Eden Chuang
4282643952 Bug 1318990 - PaymentRequestUpdateEvent interface and PaymentRequest API onshippingaddress/optionchange implementation. r=baku 2017-06-23 17:15:51 +08:00
Alphan Chen
b89ef45eed Bug 1367669 - [PaymentRequest API] Revise the way to validate a decimal monetary value. r=baku 2017-06-21 13:23:24 +08:00
Eden Chuang
084d3f703e Bug 1345365 - PaymentRequest API canMakePayment(), abort() and show() implementation. r=baku
--HG--
extra : rebase_source : 09ea762ee2af888f090817617545c7cf7a15f1a9
2017-06-14 15:59:00 +08:00
Wes Kocher
1c6a87f4be Backed out 2 changesets (bug 1345365) for frequent failures in test_data.html a=backout
Backed out changeset 0ea7a5deacf6 (bug 1345365)
Backed out changeset bba1dee06769 (bug 1345365)

MozReview-Commit-ID: KURUgnesr8B
2017-06-15 00:52:04 -07:00
Eden Chuang
5b3b71aae6 Bug 1345365 - PaymentRequest API canMakePayment(), abort() and show() implementation. r=baku
--HG--
extra : rebase_source : 1471c9b98cd919d411b22426c55bc3159d4d2f00
2017-06-14 15:59:00 +08:00
Eden Chuang
68cf4559f8 Bug 1345361 - PaymentRequest constructor implementation. r=baku 2017-05-26 01:50:32 +08:00
Ryan VanderMeulen
df9dd3967c Backed out changeset 437d6df1859c (bug 1345361) for ESLint failures. 2017-05-25 18:05:15 -04:00
Eden Chuang
80717194b1 Bug 1345361 - PaymentRequest constructor implementation. r=baku 2017-05-26 01:50:32 +08:00