LibWeb: Do not pass JS::Handle into NativeFunction callback captures
NativeFunction uses JS::HeapFunction for the callback so GC-allocated captures will be visited anyway.
This commit is contained in:
parent
90aaa8ab40
commit
3bcd368703
Notes:
sideshowbarker
2024-07-18 03:20:18 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/3bcd368703 Pull-request: https://github.com/SerenityOS/serenity/pull/21235
1 changed files with 1 additions and 1 deletions
|
@ -561,7 +561,7 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
|
|||
// location.reload();
|
||||
// The body element is no longer in the DOM and there is no variable holding onto it. However, the onunload handler is still called, meaning the callback keeps the body element alive.
|
||||
auto callback_function = JS::NativeFunction::create(
|
||||
realm, [event_target = JS::make_handle(*this), name](JS::VM& vm) mutable -> JS::ThrowCompletionOr<JS::Value> {
|
||||
realm, [event_target = this, name](JS::VM& vm) mutable -> JS::ThrowCompletionOr<JS::Value> {
|
||||
// The event dispatcher should only call this with one argument.
|
||||
VERIFY(vm.argument_count() == 1);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue