Closed
Bug 1129239
Opened 11 years ago
Closed 11 years ago
Dictionaries with required properties shouldn't need to be optional
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
| Tracking | Status | |
|---|---|---|
| firefox40 | --- | fixed |
People
(Reporter: smaug, Assigned: bzbarsky)
Details
Attachments
(2 files, 1 obsolete file)
|
19.96 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
|
16.35 KB,
patch
|
Details | Diff | Splinter Review |
Currently we seem to require the last param to be optional if it is a dictionary,
but that doesn't quite make sense if the dictionary has required properties.
| Reporter | ||
Comment 1•11 years ago
|
||
| Assignee | ||
Comment 2•11 years ago
|
||
Assumin the spec changes, this would do the trick
Attachment #8558885 -
Flags: review?(bugs)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
| Reporter | ||
Comment 3•11 years ago
|
||
Comment on attachment 8558885 [details] [diff] [review]
Don't require 'optional' keyword on trailing dictionary arguments if the dictionary has a required member
Ok, so optional dictionaries with required params is still possible, but not needed.
Should we handle optional dictionaries with required properties somehow differently?
Attachment #8558885 -
Flags: review?(bugs) → review+
| Assignee | ||
Comment 4•11 years ago
|
||
The only principled thing to do there would be to have a distinction between "not passed" and "passed" for dictionaries with required props.
But in what situation would an API actually have different behavior there? That is, if you want to allow "not passed", why do you have required props? What do you do in the "not passed" case for those props?
| Reporter | ||
Comment 5•11 years ago
|
||
hmm, right. Maybe there isn't good use case for that after all.
Comment 6•11 years ago
|
||
Allowed the optional to be dropped when the dictionary has required members:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27953
| Assignee | ||
Comment 7•11 years ago
|
||
Oh, nice catch about ancestors with required members. I'll fix the patch here accordingly before landing it.
| Assignee | ||
Comment 8•11 years ago
|
||
This required me to move a bunch of validation to validate() methods, because otherwise it was happening before the dictionary knew what its parent is. I considered having complete() on the wrapper type finish() the dictionary, but conceptually putting validation in validate() makes more sense.
| Assignee | ||
Updated•11 years ago
|
Attachment #8558885 -
Attachment is obsolete: true
| Assignee | ||
Comment 9•11 years ago
|
||
This mostly moves stuff over to validate() and makes the union code not try to compute things needed for validation in complete(), deferring them to whenever they're asked for instead.
Attachment #8593780 -
Flags: review?(bugs)
| Reporter | ||
Comment 10•11 years ago
|
||
Comment on attachment 8593779 [details] [diff] [review]
With the ancestor dictionary thing
>+ def isOptional(self):
So rename this to canBeEmpty(self) or some such
ne
>+ def hasOptionalDictionaryType(self):
>+ return (self._dictionaryType is not None and
>+ self._dictionaryType.inner.isOptional())
this too
Attachment #8593779 -
Flags: review+
| Reporter | ||
Updated•11 years ago
|
Attachment #8593780 -
Flags: review?(bugs)
Comment 11•11 years ago
|
||
Comment 12•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•