Closed
Bug 1492295
Opened 6 years ago
Closed 6 years ago
Wrong binding code generated when required member inside optional dictionary
Categories
(Core :: DOM: Bindings (WebIDL), defect)
Core
DOM: Bindings (WebIDL)
Tracking
()
RESOLVED
DUPLICATE
of bug 1368949
People
(Reporter: marcosc, Unassigned)
References
(Blocks 1 open bug)
Details
The following event has an `updateWith()` method that expects a `PaymentDetailsUpdate` dictionary. If some members of that dictionary are passed, the are `required` to have some particular values:
```
interface PaymentRequestUpdateEvent : Event {
void updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
};
dictionary PaymentDetailsUpdate : PaymentDetailsBase {
DOMString error;
PaymentItem total;
AddressErrors shippingAddressErrors;
};
dictionary PaymentItem {
required DOMString label;
required PaymentCurrencyAmount amount;
boolean pending = false;
PaymentItemType type;
};
dictionary PaymentCurrencyAmount {
required DOMString currency;
required DOMString value;
};
```
It seems that the above confuses our IDL binding layer, in that the following fails:
```JS
ev.updateWith({});
```
And instead, expects all `required` things to be present (even though they are optional, unless present). So:
```JS
ev.updateWith({
// this now has to be here, for instance.
total: {label: "", { currency: "USD", value: "123" }},
// possibly other optional but "required" things...
});
```
Reporter | ||
Updated•6 years ago
|
Blocks: paymentrequest
Reporter | ||
Comment 1•6 years ago
|
||
The problem can be seen here in the "dom/payments/test/test_payerDetails.html" file:
https://phabricator.services.mozilla.com/D5841#change-DbWV8rTCwvbW
Where we have to call updateWith() with a spread of ...defaultDetails:
```
event.updateWith({ error: "update-with", payerErrors: payer, ...defaultDetails });
```
Where `defaultDetails` contains all the "required" things.
(Does Phabricator support linking to line numbers in files?)
Reporter | ||
Comment 2•6 years ago
|
||
Hi bz, is the above a known issue? I'm unsure who to ping about it.
Flags: needinfo?(bzbarsky)
Updated•6 years ago
|
Whiteboard: [webpayments-reserve]
Updated•6 years ago
|
Flags: qe-verify?
Priority: -- → P3
![]() |
||
Comment 3•6 years ago
|
||
> Hi bz, is the above a known issue?
Yes, see bug 1368949. I will follow up there.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(bzbarsky)
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Flags: qe-verify?
Priority: P3 → --
Whiteboard: [webpayments-reserve]
You need to log in
before you can comment on or make changes to this bug.
Description
•