Bug 864578 - Allow NamedConstructor and NoInterfaceObject in the same interface. r=bz
authorReuben Morais <reuben.morais@gmail.com>
Mon, 22 Apr 2013 18:05:25 -0700
changeset 129537 138187d07a1c27c61a97ff9a22c7d236c5598862
parent 129536 b67bcb5f1a8e0f0d3dd6603cddaa4cec3e8da29f
child 129538 cd89b7d8dbf09c402d00adc346b8f4d54c2ce75f
push id26886
push userreuben.morais@gmail.com
push dateTue, 23 Apr 2013 01:06:45 +0000
treeherdermozilla-inbound@138187d07a1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs864578
milestone23.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 864578 - Allow NamedConstructor and NoInterfaceObject in the same interface. r=bz
dom/bindings/parser/WebIDL.py
dom/bindings/parser/tests/test_constructor_no_interface_object.py
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -834,17 +834,17 @@ class IDLInterface(IDLObjectWithScope):
                                       [attr.location])
 
                 if self.ctor():
                     raise WebIDLError("Constructor and NoInterfaceObject are incompatible",
                                       [self.location])
 
                 self._noInterfaceObject = True
             elif identifier == "Constructor" or identifier == "NamedConstructor":
-                if not self.hasInterfaceObject():
+                if identifier == "Constructor" and not self.hasInterfaceObject():
                     raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
                                       [self.location])
 
                 if identifier == "NamedConstructor" and not attr.hasValue():
                     raise WebIDLError("NamedConstructor must either take an identifier or take a named argument list",
                                       [attr.location])
 
                 args = attr.args() if attr.hasArgs() else []
--- a/dom/bindings/parser/tests/test_constructor_no_interface_object.py
+++ b/dom/bindings/parser/tests/test_constructor_no_interface_object.py
@@ -21,8 +21,16 @@ def WebIDLTest(parser, harness):
             };
         """)
 
         results = parser.finish()
     except:
         threw = True
 
     harness.ok(threw, "Should have thrown.")
+
+    parser.parse("""
+        [NoInterfaceObject, NamedConstructor=FooBar]
+        interface TestNamedConstructorNoInterfaceObject {
+        };
+    """)
+
+    parser = parser.reset()