Bug 760749. Make interface type constructor args work in WebIDL bindings. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 04 Jun 2012 21:30:00 -0400
changeset 96160 e789e3ca90cefd29451cf6eafcc9ea89120a036a
parent 96159 e0b462a2ad9fc1e9f3137790099e02dd5767ee16
child 96161 db893d2f7d048093f9c54ac1f16845474c8078a6
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerskhuey
bugs760749
milestone15.0a1
Bug 760749. Make interface type constructor args work in WebIDL bindings. r=khuey
dom/bindings/parser/WebIDL.py
dom/bindings/test/TestBindingHeader.h
dom/bindings/test/TestCodeGen.webidl
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -455,16 +455,20 @@ class IDLInterface(IDLObjectWithScope):
                 raise WebIDLError("Multiple " + memberType + " on %s" % (self),
                                    self.location)
 
             specialMembersSeen.add(memberType)
 
         for member in self.members:
             member.finish(scope)
 
+        ctor = self.ctor()
+        if ctor is not None:
+            ctor.finish(scope)
+
     def isInterface(self):
         return True
 
     def isExternal(self):
         return False
 
     def setCallback(self, value):
         self._callback = value
--- a/dom/bindings/test/TestBindingHeader.h
+++ b/dom/bindings/test/TestBindingHeader.h
@@ -59,16 +59,23 @@ public:
   static
   already_AddRefed<TestInterface> Constructor(nsISupports*, ErrorResult&);
   static
   already_AddRefed<TestInterface> Constructor(nsISupports*, const nsAString&,
                                               ErrorResult&);
   static
   already_AddRefed<TestInterface> Constructor(nsISupports*, uint32_t,
                                               Nullable<bool>&, ErrorResult&);
+  static
+  already_AddRefed<TestInterface> Constructor(nsISupports*, TestInterface*,
+                                              ErrorResult&);
+  static
+  already_AddRefed<TestInterface> Constructor(nsISupports*,
+                                              NonNull<TestNonCastableInterface>&,
+                                              ErrorResult&);
 
   // Integer types
   int8_t GetReadonlyByte(ErrorResult&);
   int8_t GetWritableByte(ErrorResult&);
   void SetWritableByte(int8_t, ErrorResult&);
   void PassByte(int8_t, ErrorResult&);
   int8_t ReceiveByte(ErrorResult&);
   void PassOptionalByte(const Optional<int8_t>&, ErrorResult&);
--- a/dom/bindings/test/TestCodeGen.webidl
+++ b/dom/bindings/test/TestCodeGen.webidl
@@ -13,17 +13,19 @@ enum TestEnum {
   "a",
   "b"
 };
 
 callback TestCallback = void();
 
 [Constructor,
  Constructor(DOMString str),
- Constructor(unsigned long num, boolean? bool)]
+ Constructor(unsigned long num, boolean? bool),
+ Constructor(TestInterface? iface),
+ Constructor(TestNonCastableInterface iface)]
 interface TestInterface {
   // Integer types
   // XXXbz add tests for infallible versions of all the integer stuff
   readonly attribute byte readonlyByte;
   attribute byte writableByte;
   void passByte(byte arg);
   byte receiveByte();
   void passOptionalByte(optional byte arg);