Bug 837339. Re-disallow nullable dictionary members inside dictionaries. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 14 Mar 2013 15:42:59 -0400
changeset 135223 7dc016fc39bfa566c810ee4e242ae50cd46e18d0
parent 135222 c994692d1ea862ace947e81e36e173cfc6754713
child 135224 083ae059a5f161cfb15769e9a4bc1d8d0d6e926b
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs837339
milestone22.0a1
Bug 837339. Re-disallow nullable dictionary members inside dictionaries. r=khuey
dom/bindings/parser/WebIDL.py
dom/bindings/parser/tests/test_dictionary.py
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -1077,16 +1077,20 @@ class IDLDictionary(IDLObjectWithScope):
                 else:
                     (contains, locations) = dictionaryContainsDictionary(dictMember.parent, dictionary)
                     if contains:
                         return (True, [dictMember.location] + locations)
 
             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." %
                                   self.identifier.name,
                                   [member.location] + locations)
 
     def addExtendedAttributes(self, attrs):
         assert len(attrs) == 0
--- a/dom/bindings/parser/tests/test_dictionary.py
+++ b/dom/bindings/parser/tests/test_dictionary.py
@@ -420,8 +420,25 @@ def WebIDLTest(parser, harness):
         """)
         results = parser.finish()
     except:
         threw = True
 
     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")