mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
Issue #2678 - Switch DOMProxyHandler::EnsureExpandoObject to using normal wrapper preservation instead of RegisterDOMExpandoObject.
This commit is contained in:
parent
9f4fe4275c
commit
45bb4cb8b4
1 changed files with 4 additions and 18 deletions
|
|
@ -75,17 +75,9 @@ DOMProxyHandler::ClearExternalRefsForWrapperRelease(JSObject* obj)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(IsDOMProxy(obj), "expected a DOM proxy object");
|
MOZ_ASSERT(IsDOMProxy(obj), "expected a DOM proxy object");
|
||||||
JS::Value v = js::GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
|
JS::Value v = js::GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
|
||||||
if (v.isUndefined()) {
|
if (v.isUndefined() || v.isObject()) {
|
||||||
// No expando.
|
// No expando, or an expando that we reference from our slot anyway, so
|
||||||
return;
|
// don't have to clear state for.
|
||||||
}
|
|
||||||
|
|
||||||
// See EnsureExpandoObject for the work we're trying to undo here.
|
|
||||||
|
|
||||||
if (v.isObject()) {
|
|
||||||
// Drop us from the DOM expando hashtable. Don't worry about clearing our
|
|
||||||
// slot reference to the expando; we're about to die anyway.
|
|
||||||
xpc::ObjectScope(obj)->RemoveDOMExpandoObject(obj);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +100,6 @@ DOMProxyHandler::GetAndClearExpandoObject(JSObject* obj)
|
||||||
|
|
||||||
if (v.isObject()) {
|
if (v.isObject()) {
|
||||||
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, UndefinedValue());
|
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, UndefinedValue());
|
||||||
xpc::ObjectScope(obj)->RemoveDOMExpandoObject(obj);
|
|
||||||
} else {
|
} else {
|
||||||
js::ExpandoAndGeneration* expandoAndGeneration =
|
js::ExpandoAndGeneration* expandoAndGeneration =
|
||||||
static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
|
static_cast<js::ExpandoAndGeneration*>(v.toPrivate());
|
||||||
|
|
@ -168,19 +159,14 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle<JSObject*> obj)
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
return expando;
|
return expando;
|
||||||
}
|
}
|
||||||
|
cache->PreserveWrapper(native);
|
||||||
|
|
||||||
if (expandoAndGeneration) {
|
if (expandoAndGeneration) {
|
||||||
cache->PreserveWrapper(native);
|
|
||||||
expandoAndGeneration->expando.setObject(*expando);
|
expandoAndGeneration->expando.setObject(*expando);
|
||||||
|
|
||||||
return expando;
|
return expando;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xpc::ObjectScope(obj)->RegisterDOMExpandoObject(obj)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
cache->SetPreservingWrapper(true);
|
|
||||||
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, ObjectValue(*expando));
|
js::SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, ObjectValue(*expando));
|
||||||
|
|
||||||
return expando;
|
return expando;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue