Bug 1338059 - Part 1: Generate cycle collection related code for WebIDL type Promise, r=bz draft
authorbtian <btian@mozilla.com>
Fri, 05 May 2017 10:12:40 +0800
changeset 572981 055cbc34525cbf8d67f143f56528ff6165a61786
parent 572425 4a6a71f4aa22e4dc3961884ce505ce34bdd799a2
child 572982 1f7aece35191a23b6db9f574fdfdc3a634c9a634
push id57252
push userbmo:btian@mozilla.com
push dateFri, 05 May 2017 03:30:41 +0000
reviewersbz
bugs1338059
milestone55.0a1
Bug 1338059 - Part 1: Generate cycle collection related code for WebIDL type Promise, r=bz MozReview-Commit-ID: 1wQFBCur0Uy
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -75,17 +75,17 @@ def idlTypeNeedsCycleCollection(type):
     type = type.unroll()  # Takes care of sequences and nullables
     if ((type.isPrimitive() and type.tag() in builtinNames) or
         type.isEnum() or
         type.isString() or
         type.isAny() or
         type.isObject() or
         type.isSpiderMonkeyInterface()):
         return False
-    elif type.isCallback() or type.isGeckoInterface():
+    elif type.isCallback() or type.isPromise() or type.isGeckoInterface():
         return True
     elif type.isUnion():
         return any(idlTypeNeedsCycleCollection(t) for t in type.flatMemberTypes)
     elif type.isRecord():
         if idlTypeNeedsCycleCollection(type.inner):
             raise TypeError("Cycle collection for type %s is not supported" % type)
         return False
     elif type.isDictionary():