Bug 1127341. If we make our codegen for a binding depend on the exposure set of an interface argument to one of the binding's methods, we need to adjust the dependency set of the binding accordingly, so we'll regenerate if the exposure set changes. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 09 Feb 2015 11:42:26 -0500
changeset 241793 657c0635dfb999be89aa4826d9a67aaa6bae776d
parent 241792 c4500f0d25cd43c9eb7a421c7554086a647e5726
child 241794 be4a51e14f3fbde5181b492d59c68799d3079949
push id619
push usercliu@mozilla.com
push dateMon, 09 Feb 2015 21:57:21 +0000
reviewerskhuey
bugs1127341
milestone38.0a1
Bug 1127341. If we make our codegen for a binding depend on the exposure set of an interface argument to one of the binding's methods, we need to adjust the dependency set of the binding accordingly, so we'll regenerate if the exposure set changes. r=khuey
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -6833,16 +6833,19 @@ class CGMethodCall(CGThing):
             def typeExposedInWorkers(type):
                 return (not type.isGeckoInterface() or
                         type.inner.isExternal() or
                         type.inner.isExposedInAnyWorker())
             if descriptor.workers:
                 # Filter out the signatures that should not be exposed in a
                 # worker.  The IDL parser enforces the return value being
                 # exposed correctly, but we have to check the argument types.
+                #
+                # If this code changes, adjust the self._deps
+                # computation in CGDDescriptor.__init__ as needed.
                 assert all(typeExposedInWorkers(sig[0]) for sig in signatures)
                 signatures = filter(
                     lambda sig: all(typeExposedInWorkers(arg.type)
                                     for arg in sig[1]),
                     signatures)
                 if len(signatures) == 0:
                     raise TypeError("%s.%s has a worker binding with no "
                                     "signatures that take arguments exposed in "
@@ -11003,16 +11006,31 @@ def memberProperties(m, descriptor):
 
 class CGDescriptor(CGThing):
     def __init__(self, descriptor):
         CGThing.__init__(self)
 
         assert not descriptor.concrete or descriptor.interface.hasInterfacePrototypeObject()
 
         self._deps = descriptor.interface.getDeps()
+        # If we have a worker descriptor, add dependencies on interface types we
+        # have as method arguments to overloaded methods.  See the
+        # filteredSignatures() bit in CGMethodCall.  Note that we have to add
+        # both interfaces that _are_ exposed in workers and ones that aren't;
+        # the idea is that we have to notice when the exposure set changes.
+        if descriptor.workers:
+            methods = (m for m in descriptor.interface.members if
+                       m.isMethod() and isMaybeExposedIn(m, descriptor) and
+                       len(m.signatures()) != 1)
+            for m in methods:
+                for sig in m.signatures():
+                    for arg in sig[1]:
+                        if (arg.type.isGeckoInterface() and
+                            not arg.type.inner.isExternal()):
+                            self._deps.add(arg.type.inner.filename())
 
         cgThings = []
         cgThings.append(CGGeneric(declare="typedef %s NativeType;\n" %
                                   descriptor.nativeType))
         parent = descriptor.interface.parent
         if parent:
             cgThings.append(CGGeneric("static_assert(IsRefcounted<NativeType>::value == IsRefcounted<%s::NativeType>::value,\n"
                                       "              \"Can't inherit from an interface with a different ownership model.\");\n" %