Skip to content

Commit

Permalink
Bug 1870992 - Make Event code generator support dictionnary type. r=p…
Browse files Browse the repository at this point in the history
…eterv.

Differential Revision: https://phabricator.services.mozilla.com/D196943
  • Loading branch information
nchevobbe committed Jan 16, 2024
1 parent edaaa05 commit 434f591
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dom/bindings/Codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24065,6 +24065,8 @@ def getMethodBody(self):
)
else:
return "aRetVal = " + memberName + ".Clone();\n"
if type.isDictionary():
return "aRetVal = " + memberName + ";\n"
raise TypeError("Event code generator does not support this type!")

def declare(self, cgClass):
Expand Down Expand Up @@ -24561,6 +24563,15 @@ def getNativeTypeForIDLType(self, type):
nativeType = CGGeneric("nsCString")
elif type.isPromise():
nativeType = CGGeneric("RefPtr<Promise>")
elif type.isDictionary():
if typeNeedsRooting(type):
raise TypeError(
"We don't support event members that are dictionary types "
"that need rooting (%s)" % type
)
nativeType = CGGeneric(CGDictionary.makeDictionaryName(type.unroll().inner))
if type.nullable():
nativeType = CGTemplatedType("Nullable", nativeType)
elif type.isGeckoInterface():
iface = type.unroll().inner
nativeType = self.descriptor.getDescriptor(iface.identifier.name).nativeType
Expand Down

0 comments on commit 434f591

Please sign in to comment.