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 124825 7dc016fc39bfa566c810ee4e242ae50cd46e18d0
parent 124824 c994692d1ea862ace947e81e36e173cfc6754713
child 124826 083ae059a5f161cfb15769e9a4bc1d8d0d6e926b
push id24436
push userryanvm@gmail.com
push dateFri, 15 Mar 2013 11:52:55 +0000
treeherdermozilla-central@8f5b1f9f5804 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs837339
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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")