From bcf9d165aea87ecc80e264d61b1c0c21c09ba653 Mon Sep 17 00:00:00 2001
From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 4 Jun 2012 21:30:00 -0400
Subject: [PATCH] Bug 760749.  Make interface type constructor args work in
 WebIDL bindings.  r=khuey

---
 dom/bindings/parser/WebIDL.py         | 4 ++++
 dom/bindings/test/TestBindingHeader.h | 7 +++++++
 dom/bindings/test/TestCodeGen.webidl  | 4 +++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py
index 7b7fcc1b966fb..5f1fa0a26e988 100644
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -460,6 +460,10 @@ class IDLInterface(IDLObjectWithScope):
         for member in self.members:
             member.finish(scope)
 
+        ctor = self.ctor()
+        if ctor is not None:
+            ctor.finish(scope)
+
     def isInterface(self):
         return True
 
diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h
index 7743c931f359d..64d8c98dbee9c 100644
--- a/dom/bindings/test/TestBindingHeader.h
+++ b/dom/bindings/test/TestBindingHeader.h
@@ -64,6 +64,13 @@ public:
   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&);
diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl
index ee4807e363160..7b66732a43b8b 100644
--- a/dom/bindings/test/TestCodeGen.webidl
+++ b/dom/bindings/test/TestCodeGen.webidl
@@ -18,7 +18,9 @@ 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
-- 
GitLab