diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 58d5d7e2ec23..8a001b42fa45 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -1082,6 +1082,10 @@ class IDLDictionary(IDLObjectWithScope): return (False, None) for member in self.members: + if member.type.isDictionary() and member.type.nullable(): + raise WebIDLError("Dictionary %s has member with nullable " + "dictionary type" % self.identifier.name, + [member.location]) (contains, locations) = typeContainsDictionary(member.type, self) if contains: raise WebIDLError("Dictionary %s has member with itself as type." % diff --git a/dom/bindings/parser/tests/test_dictionary.py b/dom/bindings/parser/tests/test_dictionary.py index da3996f42c4c..39037168ecd0 100644 --- a/dom/bindings/parser/tests/test_dictionary.py +++ b/dom/bindings/parser/tests/test_dictionary.py @@ -425,3 +425,20 @@ def WebIDLTest(parser, harness): harness.ok(threw, "Member type must not be a Dictionary, one of whose " "members or inherited members has a type that includes " "its Dictionary.") + + parser = parser.reset(); + threw = False + try: + parser.parse(""" + dictionary Foo { + }; + + dictionary Bar { + Foo? d; + }; + """) + results = parser.finish() + except: + threw = True + + harness.ok(threw, "Member type must not be a nullable dictionary")