mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 21:26:22 +00:00
LibWeb: Don't capture proxy as root in ProxyConstructor::revocable
`revoker_closure` is used to construct `NativeFunction` that visits `raw_capture_range()`, so there is no need to use GC root for `proxy`.
This commit is contained in:
parent
66a19b8550
commit
3c3f1f9fad
Notes:
github-actions[bot]
2025-07-30 06:45:15 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 3c3f1f9fad
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5649
Reviewed-by: https://github.com/gmta ✅
1 changed files with 3 additions and 5 deletions
|
@ -86,21 +86,19 @@ JS_DEFINE_NATIVE_FUNCTION(ProxyConstructor::revocable)
|
||||||
auto* proxy = TRY(proxy_create(vm, target, handler));
|
auto* proxy = TRY(proxy_create(vm, target, handler));
|
||||||
|
|
||||||
// 2. Let revokerClosure be a new Abstract Closure with no parameters that captures nothing and performs the following steps when called:
|
// 2. Let revokerClosure be a new Abstract Closure with no parameters that captures nothing and performs the following steps when called:
|
||||||
auto revoker_closure = [proxy_handle = make_root(proxy)](auto&) -> ThrowCompletionOr<Value> {
|
auto revoker_closure = [proxy](auto&) -> ThrowCompletionOr<Value> {
|
||||||
// a. Let F be the active function object.
|
// a. Let F be the active function object.
|
||||||
|
|
||||||
// b. Let p be F.[[RevocableProxy]].
|
// b. Let p be F.[[RevocableProxy]].
|
||||||
auto& proxy = const_cast<ProxyObject&>(*proxy_handle.cell());
|
|
||||||
|
|
||||||
// c. If p is null, return undefined.
|
// c. If p is null, return undefined.
|
||||||
if (proxy.is_revoked())
|
if (proxy->is_revoked())
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
|
|
||||||
// d. Set F.[[RevocableProxy]] to null.
|
// d. Set F.[[RevocableProxy]] to null.
|
||||||
// e. Assert: p is a Proxy object.
|
// e. Assert: p is a Proxy object.
|
||||||
// f. Set p.[[ProxyTarget]] to null.
|
// f. Set p.[[ProxyTarget]] to null.
|
||||||
// g. Set p.[[ProxyHandler]] to null.
|
// g. Set p.[[ProxyHandler]] to null.
|
||||||
proxy.revoke();
|
proxy->revoke();
|
||||||
|
|
||||||
// h. Return undefined.
|
// h. Return undefined.
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue