Bug 967694. Don't generate Xray resolveOwnProperty/enumerateOwnProperties hooks on WebIDL Xrays for plugin-loading elements, because those elements really only want to have the hook called when they're being touched by script from the same website. r=bholley

This commit is contained in:
Boris Zbarsky 2014-02-05 13:38:18 -05:00
parent 86e46501b5
commit bb0bc45763
2 changed files with 16 additions and 2 deletions

View File

@ -89,7 +89,7 @@ extern const NativePropertyHooks sNativePropertyHooks[];"""
if self.descriptor.concrete and self.descriptor.proxy:
resolveOwnProperty = "ResolveOwnProperty"
enumerateOwnProperties = "EnumerateOwnProperties"
elif self.descriptor.interface.getExtendedAttribute("NeedNewResolve"):
elif self.descriptor.needsXrayResolveHooks():
resolveOwnProperty = "ResolveOwnPropertyViaNewresolve"
enumerateOwnProperties = "EnumerateOwnPropertiesViaGetOwnPropertyNames"
else:
@ -8837,7 +8837,7 @@ class CGDescriptor(CGThing):
if not descriptor.workers and descriptor.concrete and descriptor.proxy:
cgThings.append(CGResolveOwnProperty(descriptor))
cgThings.append(CGEnumerateOwnProperties(descriptor))
elif descriptor.interface.getExtendedAttribute("NeedNewResolve"):
elif descriptor.needsXrayResolveHooks():
cgThings.append(CGResolveOwnPropertyViaNewresolve(descriptor))
cgThings.append(CGEnumerateOwnPropertiesViaGetOwnPropertyNames(descriptor))

View File

@ -495,6 +495,20 @@ class Descriptor(DescriptorProvider):
self.interface.getExtendedAttribute("PrefControlled") or
self.interface.getExtendedAttribute("AvailableIn"))
def needsXrayResolveHooks(self):
"""
Generally, any interface with NeedNewResolve needs Xray
resolveOwnProperty and enumerateOwnProperties hooks. But for
the special case of plugin-loading elements, we do NOT want
those, because we don't want to instantiate plug-ins simply
due to chrome touching them and that's all those hooks do on
those elements. So we special-case those here.
"""
return (self.interface.getExtendedAttribute("NeedNewResolve") and
self.interface.identifier.name not in ["HTMLObjectElement",
"HTMLEmbedElement",
"HTMLAppletElement"])
# Some utility methods
def getTypesFromDescriptor(descriptor):
"""