From affdb545ddc1e7f0f624c3a8e4c3ae748d33500d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 4 Dec 2015 09:51:04 -0500 Subject: [PATCH] Bug 1230291. Correctly include nsContentUtils when generating a manual hasInstance with nsIDOM* stuff or when we have a JS-implemented interface with clearable cached attrs --- dom/bindings/Codegen.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 824c7e18a4cf..2c097761cc43 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1008,6 +1008,8 @@ class CGHeaders(CGWrapper): d.interface.hasInterfaceObject() and NeedsGeneratedHasInstance(d) and d.interface.hasInterfacePrototypeObject()) + if len(hasInstanceIncludes) > 0: + hasInstanceIncludes.add("nsContentUtils.h") # Now find all the things we'll need as arguments because we # need to wrap or unwrap them. @@ -13120,7 +13122,11 @@ class CGBindingRoot(CGThing): # interface object might have a ChromeOnly constructor. (desc.interface.hasInterfaceObject() and (desc.interface.isJSImplemented() or - (ctor and isChromeOnly(ctor))))) + (ctor and isChromeOnly(ctor)))) or + # JS-implemented interfaces with clearable cached + # attrs have chromeonly _clearFoo methods. + (desc.interface.isJSImplemented() and + any(clearableCachedAttrs(desc)))) bindingHeaders["nsContentUtils.h"] = any( descriptorHasChromeOnly(d) for d in descriptors)