Bug 847928 - Element type of a WebIDL array must not be a sequence or dictionary type. r=bzbarsky
authorPranav Ravichandran <prp.1111@gmail.com>
Wed, 06 Mar 2013 13:06:23 -0500
changeset 123988 ddf8cdc9d2e3220dac570534b1ff42e9a58bc433
parent 123987 569168aed87a728a278e26bb84e5d6e48325a47c
child 123989 bc115ba15bb61ddef8f79c2c00c7d7fe58592c61
push id24168
push userryanvm@gmail.com
push dateWed, 06 Mar 2013 18:06:54 +0000
treeherdermozilla-inbound@abe7aef12731 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs847928
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 847928 - Element type of a WebIDL array must not be a sequence or dictionary type. r=bzbarsky
dom/bindings/parser/WebIDL.py
dom/bindings/parser/tests/test_array.py
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -1656,16 +1656,24 @@ class IDLArrayType(IDLType):
         self.inner.resolveType(parentScope)
 
     def isComplete(self):
         return self.inner.isComplete()
 
     def complete(self, scope):
         self.inner = self.inner.complete(scope)
         self.name = self.inner.name
+
+        if self.inner.isDictionary():
+            raise WebIDLError("Array type must not contain "
+                              "dictionary as element type.",
+                              [self.inner.location])
+
+        assert not self.inner.isSequence()
+
         return self
 
     def unroll(self):
         return self.inner.unroll()
 
     def isDistinguishableFrom(self, other):
         if other.isUnion():
             # Just forward to the union; it'll deal
new file mode 100644
--- /dev/null
+++ b/dom/bindings/parser/tests/test_array.py
@@ -0,0 +1,18 @@
+def WebIDLTest(parser, harness):
+    threw = False
+    try:
+        parser.parse("""
+          dictionary Foo {
+            short a;
+          };
+
+          dictionary Foo1 {
+            Foo[] b;
+          };
+        """)
+        results = parser.finish()
+    except:
+        threw = True
+
+    harness.ok(threw, "Array must not contain dictionary "
+                      "as element type.")