Bug 1229176 - make check for ChromeOnly interfaces for header inclusion more complete; r=bz

If an interface has a {Chrome,}Constructor(), it doesn't show up as a
normal member.  If the interface has a ChromeConstructor, we need to
include nsContentUtils.h in the generated file for a
ThreadsafeIsCallerChrome check.  There is an existing check for a
descriptor's ChromeOnly-ness in CGBindingRoot; this check is used to
determine whether nsContentUtils.h is included in the generated file.
But the check in descriptorHasChromeOnly doesn't detect this
(ChromeOnly) constructor, and so nsContentUtils.h won't be included if
there are no other ChromeOnly members, or if the interface itself is not
ChromeOnly.

Therefore, we need to take the constructor of the interface (if any)
into account when checking for ChromeOnly-ness.
This commit is contained in:
Nathan Froyd 2015-11-30 20:57:57 -05:00
Родитель 31cec702e0
Коммит df330eaf5c
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -13099,12 +13099,16 @@ class CGBindingRoot(CGThing):
d.concrete and d.proxy for d in descriptors) d.concrete and d.proxy for d in descriptors)
def descriptorHasChromeOnly(desc): def descriptorHasChromeOnly(desc):
ctor = desc.interface.ctor()
return (any(isChromeOnly(a) for a in desc.interface.members) or return (any(isChromeOnly(a) for a in desc.interface.members) or
desc.interface.getExtendedAttribute("ChromeOnly") is not None or desc.interface.getExtendedAttribute("ChromeOnly") is not None or
# JS-implemented interfaces with an interface object get a # JS-implemented interfaces with an interface object get a
# chromeonly _create method. # chromeonly _create method. And interfaces with an
(desc.interface.isJSImplemented() and # interface object might have a ChromeOnly constructor.
desc.interface.hasInterfaceObject())) (desc.interface.hasInterfaceObject() and
(desc.interface.isJSImplemented() or
(ctor and isChromeOnly(ctor)))))
bindingHeaders["nsContentUtils.h"] = any( bindingHeaders["nsContentUtils.h"] = any(
descriptorHasChromeOnly(d) for d in descriptors) descriptorHasChromeOnly(d) for d in descriptors)