Closed
Bug 1436329
Opened 6 years ago
Closed 5 years ago
WebIDL parser doesn't support "partial dictionary"
Categories
(Core :: DOM: Bindings (WebIDL), enhancement, P2)
Core
DOM: Bindings (WebIDL)
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: ttaubert, Assigned: dpino)
References
Details
Attachments
(1 file, 2 obsolete files)
11.93 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
The term "partial dictionary" is defined here: https://heycam.github.io/webidl/#dfn-partial-dictionary The WebAuthn spec uses it in their extension model, all extensions are optional. https://w3c.github.io/webauthn/#dictdef-authenticationextensionsclientinputs partial dictionary AuthenticationExtensionsClientInputs { USVString appid; };
Updated•6 years ago
|
Priority: -- → P3
Comment 1•6 years ago
|
||
Actually, bumping this to P2 since this is blocking WebAuthn. Tim, is this stopping extension definitions from working?
Flags: needinfo?(ttaubert)
Priority: P3 → P2
Comment 2•6 years ago
|
||
It's not blocking, but it has made us sort of hack around it. See [1]. [1] https://searchfox.org/mozilla-central/source/dom/webidl/WebAuthentication.webidl#106
Flags: needinfo?(ttaubert)
Assignee | ||
Comment 3•5 years ago
|
||
Attachment #9026331 -
Flags: review?(peterv)
Comment 4•5 years ago
|
||
Comment on attachment 9026331 [details] [diff] [review] Bug-1436329-Parse-WebIDL-partial-dictionary.patch Review of attachment 9026331 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/parser/WebIDL.py @@ +629,2 @@ > > def addExtendedAttributes(self, attrs): I don't think it makes sense to reuse IDLPartialInterfaceOrNamespace, dictionaries don't have extended attributes. Probably better to have a IDLPartialDictionary class. @@ +1845,5 @@ > self.parent = parent > self._finished = False > self.members = list(members) > + self._partialDictionaries = [] > + self._extendedAttrDict = {} Again, dictionaries don't have extended attributes. @@ +1885,5 @@ > > + # Now go ahead and merge in our partial dictionaries. > + for partial in self._partialDictionaries: > + partial.finish(scope) > + self.addExtendedAttributes(partial.propagatedExtendedAttrs) And here. @@ +1996,5 @@ > + def addPartialDictionary(self, partial): > + assert self.identifier.name == partial.identifier.name > + self._partialDictionaries.append(partial) > + > + def getExtendedAttribute(self, name): And here. @@ +5713,5 @@ > [location, identifier, members]) > > + def p_PartialDictionary(self, p): > + """ > + PartialDictionary : DICTIONARY IDENTIFIER Inheritance LBRACE DictionaryMembers RBRACE SEMICOLON This is not what's in the spec. A partial dictionary doesn't provide inheritance: PartialDictionary :: dictionary identifier { DictionaryMembers } ; ::: dom/bindings/parser/tests/test_dictionary.py @@ +49,5 @@ > + harness.check(dict1.members[2].identifier.name, "g", > + "g should come after d") > + harness.check(dict1.members[3].identifier.name, "h", > + "h should be last") > + I think you should also add a test for name duplication across normal and partial dictionary (see following test).
Attachment #9026331 -
Flags: review?(peterv) → review-
Assignee | ||
Comment 5•5 years ago
|
||
Thanks for the detailed review. I updated the patch addressing the comments in https://bugzilla.mozilla.org/show_bug.cgi?id=1436329#c4
Attachment #9026331 -
Attachment is obsolete: true
Attachment #9028400 -
Flags: review?(peterv)
Comment 6•5 years ago
|
||
Comment on attachment 9028400 [details] [diff] [review] Bug-1436329-Parse-WebIDL-partial-dictionary.patch Review of attachment 9028400 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/parser/WebIDL.py @@ +5666,5 @@ > def handlePartialObject(self, location, identifier, nonPartialConstructor, > nonPartialConstructorArgs, > partialConstructorArgs): > """ > This handles partial objects (interfaces and namespaces) by checking for This comment needs updating (adding dictionary and IDLDictionary in the right places). @@ +5706,5 @@ > + if isinstance(nonPartialObject, IDLDictionary): > + partialDictionary = IDLPartialDictionary( > + *(partialConstructorArgs + [nonPartialObject])) > + return partialDictionary > + else: We usually don't do else after return. Please also assert here that isinstance(nonPartialObject, (IDLInterface, IDLNamespace)). ::: dom/bindings/parser/tests/test_dictionary.py @@ +82,5 @@ > + results = parser.finish() > + except: > + threw = True > + > + harness.ok(threw, "Should not allow name duplication across normal a partial dictionary") s/a/and/
Attachment #9028400 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 7•5 years ago
|
||
Addressed comments in latest review.
Attachment #9028400 -
Attachment is obsolete: true
Attachment #9028569 -
Flags: review?(peterv)
Updated•5 years ago
|
Attachment #9028569 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 8•5 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d85f82228bee18421ba3a83fe49f8221a1e585cb
Assignee | ||
Comment 9•5 years ago
|
||
Try seems Ok. I'd need to get the bug assigned so I can add tag :checkin-needed, or otherwise I'd someone to land it for me.
Updated•5 years ago
|
Assignee: nobody → dpino
Keywords: checkin-needed
Comment 10•5 years ago
|
||
Pushed by ebalazs@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/7f32ccd251ef Parse WebIDL "partial dictionary" r=peterv
Keywords: checkin-needed
Comment 11•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7f32ccd251ef
Status: NEW → RESOLVED
Closed: 5 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in
before you can comment on or make changes to this bug.
Description
•