Bug 1932400 - Call base proxy handler's trace function from DOMProxyHandler::trace. r=edgar

Differential Revision: https://phabricator.services.mozilla.com/D229633
This commit is contained in:
Peter Van der Beken 2024-11-20 23:25:09 +00:00
parent 9ba30504e5
commit 43162f1c16
2 changed files with 22 additions and 12 deletions

View File

@ -16378,10 +16378,14 @@ class CGDOMJSProxyHandler_trace(ClassMethod):
def getBody(self):
iface = getReflectedHTMLAttributesIface(self.descriptor)
return "return %s::ReflectedHTMLAttributeSlots::Trace(%s, %s);\n" % (
toBindingNamespace(iface.identifier.name),
self.args[0].name,
self.args[1].name,
return fill(
"""
${reflectedAttributesBase}::ReflectedHTMLAttributeSlots::Trace(${trc}, ${proxy});
return Base::trace(${trc}, ${proxy});
""",
reflectedAttributesBase=toBindingNamespace(iface.identifier.name),
trc=self.args[0].name,
proxy=self.args[1].name,
)
@ -16808,6 +16812,18 @@ class CGDOMJSProxyHandler(CGClass):
or descriptor.supportsNamedProperties()
or descriptor.isMaybeCrossOriginObject()
)
if descriptor.interface.getExtendedAttribute("LegacyOverrideBuiltIns"):
assert not descriptor.isMaybeCrossOriginObject()
parentClass = "ShadowingDOMProxyHandler"
elif descriptor.isMaybeCrossOriginObject():
parentClass = "MaybeCrossOriginObject<mozilla::dom::DOMProxyHandler>"
else:
parentClass = "mozilla::dom::DOMProxyHandler"
typeAliases = [
ClassUsingDeclaration("Base", parentClass),
]
methods = [
CGDOMJSProxyHandler_getOwnPropDescriptor(descriptor),
CGDOMJSProxyHandler_defineProperty(descriptor),
@ -16863,18 +16879,11 @@ class CGDOMJSProxyHandler(CGClass):
]
)
if descriptor.interface.getExtendedAttribute("LegacyOverrideBuiltIns"):
assert not descriptor.isMaybeCrossOriginObject()
parentClass = "ShadowingDOMProxyHandler"
elif descriptor.isMaybeCrossOriginObject():
parentClass = "MaybeCrossOriginObject<mozilla::dom::DOMProxyHandler>"
else:
parentClass = "mozilla::dom::DOMProxyHandler"
CGClass.__init__(
self,
"DOMProxyHandler",
bases=[ClassBase(parentClass)],
typeAliases=typeAliases,
constructors=constructors,
methods=methods,
)

View File

@ -145,6 +145,7 @@ class DOMProxyHandler : public BaseDOMProxyHandler {
// Class used by shadowing handlers (the ones that have [OverrideBuiltins].
// This handles tracing the expando in JS::ExpandoAndGeneration.
class ShadowingDOMProxyHandler : public DOMProxyHandler {
public:
virtual void trace(JSTracer* trc, JSObject* proxy) const override;
};