diff --git a/index.html b/index.html
index 86d35389..7f0503c3 100644
--- a/index.html
+++ b/index.html
@@ -1818,7 +1818,7 @@
[Constructor(DOMString type, optional PaymentRequestUpdateEventInit eventInitDict),SecureContext]
interface PaymentRequestUpdateEvent : Event {
- void updateWith(Promise<PaymentDetails> detailsPromise);
+ Promise<void> updateWith(Promise<PaymentDetails> detailsPromise);
};
@@ -1831,6 +1831,15 @@
a PaymentDetails dictionary containing changed values that the
user agent SHOULD present to the user.
+
+ The promise returned by updateWith() will be fulfilled with
+ undefined if all of the data is accepted, or rejected with a
+ TypeError if the update was complete but some data was
+ rejected as invalid. It can also be rejected if it is called
+ inappropriately, e.g. on a PaymentRequestUpdateEvent event
+ that is not being dispatched or has already been updated, or if
+ the passed promise rejects.
+
The PaymentRequestUpdateEvent constructor MUST set the
internal slot [[\waitForUpdate]] to false.
@@ -1850,20 +1859,22 @@
If target is not a PaymentRequest object,
- then throw a TypeError.
+ then return a promise rejected with a TypeError.
- If the dispatch flag is unset, then throw an
- "InvalidStateError" DOMException.
+ If the dispatch flag is unset, then return a promise
+ rejected with an "InvalidStateError" DOMException.
- If event.[[\waitForUpdate]] is true, then
- throw an "InvalidStateError" DOMException.
+ If event.[[\waitForUpdate]] is true, then
+ return a promise rejected with an "InvalidStateError"
+ DOMException.
If target.[[\state]] is not
- interactive, then throw an "InvalidStateError"
- DOMException.
+ interactive, then return a promise rejected with an
+ "InvalidStateError" DOMException.
- If target.[[\updating]] is true, then
- throw an "InvalidStateError" DOMException.
+ If target.[[\updating]] is true, then return
+ a promise rejected with an "InvalidStateError"
+ DOMException.
Set event's stop propagation flag and stop
immediate propagation flag.
@@ -1884,10 +1895,12 @@
Only one update may be processed at a time.
+ Let returnedPromise be a new promise.
+
- Return from the method and perform the remaining steps in
- parallel.
+ Return returnedPromise, and perform the remaining
+ steps in parallel.
The remaining steps are conditional on the
@@ -1914,6 +1927,9 @@
+ Reject returnedPromise with an
+ "AbortError" DOMException.
+
If the promise
detailsPromise is rejected then this
@@ -1934,8 +1950,11 @@
- Let details be the result of converting
value to a PaymentDetails dictionary. If this
- throws an exception, abort these substeps, and
- optionally show an error message to the user.
+ throws an exception, reject returnedPromise
+ with the exception, abort these substeps, and optionally show
+ an error message to the user.
+
+ - Let errorsList be an empty list.
- If the total member
of details is present, then:
@@ -1952,6 +1971,13 @@
target.[[\details]]. (Negative total
amounts are ignored.)
+ - Otherwise, add an error message describing the fact
+ that details.total.amount.value was invalid to
+ errorsList.
+
If the
displayItems
field of target.[[\details]].
+
Otherwise, add an error message describing the fact
+ that one of the displayItems had an
+ invalid amount.value to
+ errorsList.
+
If the modifiers
@@ -1987,10 +2021,20 @@
member.total.amount.value is not a
- valid decimal monetary value, then set
- modifiers to an empty sequence and
- serializedModifierData to an empty list, and
- jump to the step labeled copy modifiers below.
+ valid decimal monetary value, then:
+
+ - Set modifiers to an empty sequence.
+
+ - Set serializedModifierData to an
+ empty list.
+
+ - Add an error describing the invalid total value
+ to errorsList.
+
+ - Jump to the step labeled copy modifiers
+ below.
+
+
If the additionalDisplayItems member of
modifier is present, then for each
@@ -2003,11 +2047,21 @@
"PaymentCurrencyAmount.value">value.
If amountValue is not a valid
- decimal monetary value, then set
- modifiers to an empty sequence and
- serializedModifierData to an empty list,
- and jump to the step labeled copy
- modifiers below.
+ decimal monetary value, then:
+
+ - Set modifiers to an empty
+ sequence.
+
+ - Set serializedModifierData to an
+ empty list.
+
+ - Add an error describing the invalid item
+ value to errorsList.
+
+ - Jump to the step labeled copy
+ modifiers below.
+
+
@@ -2017,11 +2071,22 @@
if the data member of
modifier is present, or null if it is not.
- If JSON-serializing throws an exception, then
- set modifiers to an empty sequence and
- serializedModifierData to an empty list,
- and jump to the step labeled copy modifiers
- below.
+ If JSON-serializing throws an exception, then:
+
+ - Set modifiers to an empty sequence.
+
+ - Set serializedModifierData to an
+ empty list.
+
+ - Add an error describing the fact that the given
+ modifier's data was not
+ JSON-parseable to errorsList.
+
+ - Jump to the step labeled copy modifiers
+ below.
+
+
Add serializedData to
serializedModifierData.
@@ -2059,13 +2124,29 @@
If option.amount.value is not a
- valid decimal monetary value, then set
- options to the empty sequence and break.
+ valid decimal monetary value, then:
+
+ - Set options to the empty sequence.
+
+ - Add an error describing the invalid option
+ value to errorsList.
+
+ - Break.
+
+
If seenIDs contains
option.id, then set
- options to an empty sequence and break.
+ "PaymentShippingOption.id">id, then:
+
+ - Set options to the empty sequence.
+
+ - Add an error describing the fact that there are
+ duplicate option IDs to errorsList.
+
+ - Break.
+
+
Append option.id to
@@ -2096,6 +2177,12 @@
should update the user interface to display the error message
contained in error.
+
If errorsList is empty, fulfill
+ returnedPromise with undefined. Otherwise, reject
+ returnedPromise with a TypeError. User agents
+ SHOULD use the information from errorsList to
+ provide the message for the TypeError.
+
In either case, run the following steps, after either the upon