Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaymentDetails "total" member should be required #320

Closed
bzbarsky opened this issue Nov 21, 2016 · 10 comments
Closed

PaymentDetails "total" member should be required #320

bzbarsky opened this issue Nov 21, 2016 · 10 comments
Assignees

Comments

@bzbarsky
Copy link

bzbarsky commented Nov 21, 2016

Right now there is prose in https://w3c.github.io/browser-payment-api/#constructor step 4 that attempts (not quite correctly) to enforce that. Please just mark it as required in the IDL instead.

@foolip
Copy link
Member

foolip commented Nov 29, 2016

Just noticed this as well. AFAICT Blink always throws TypeError when it's missing, so offloading this to generated bindings would be nice.

@adrianba
Copy link
Contributor

total isn't always required.

@foolip
Copy link
Member

foolip commented Nov 29, 2016

@adrianba, I see it's used also in https://w3c.github.io/browser-payment-api/#dom-paymentrequestupdateevent-updatewith, is that the place?

If so, the because the dictionary has no required members it'd have to be made optional in the constructor, even though it'd always throw when emitted. (getUserMedia() is also like this.)

@adrianba
Copy link
Contributor

Yes. We discussed this with @marcoscaceres and he was going to think about refactoring.

@bzbarsky
Copy link
Author

It's probably a better idea to just use two dictionary types in the two places that want different behavior.

Failing that, you should fix the constructor to at least properly define the behavior it wants. And note that updateWith as specced is fairly nonsensical; I still need to report an issue on that...

@foolip
Copy link
Member

foolip commented Dec 1, 2016

Splitting the dictionaries SGTM, that would also get rid of the forbidden error in field in the constructor, which is a bit unusual.

@bzbarsky
Copy link
Author

bzbarsky commented Dec 1, 2016

Note that the shared fields could be a shared parent dictionary if desired.

@domenic
Copy link
Collaborator

domenic commented Dec 13, 2016

Splitting the dictionaries would have the normative change of making error passed to the constructor ignored, instead of causing an error to be thrown. Is that desired?

@foolip
Copy link
Member

foolip commented Dec 13, 2016

That seems fine to me, having a dictionary member that does nothing except throw is present is a bit odd, so unless it's expected to be a common mistake just ignoring it probably works?

@marcoscaceres marcoscaceres self-assigned this Feb 13, 2017
@domenic
Copy link
Collaborator

domenic commented Mar 6, 2017

Closed by 3c3a100

@domenic domenic closed this as completed Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants