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)

defect
Not set
normal

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... }); ```
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?)
Hi bz, is the above a known issue? I'm unsure who to ping about it.
Flags: needinfo?(bzbarsky)
Whiteboard: [webpayments-reserve]
Flags: qe-verify?
Priority: -- → P3
> 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
Flags: qe-verify?
Priority: P3 → --
Whiteboard: [webpayments-reserve]
You need to log in before you can comment on or make changes to this bug.