mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
LibWeb: Remove unnecessary WeakPtr in queue_microtask_impl()
Capturing a WeakPtr to a GC-allocated object in a JS::SafeFunction is basically pointless, since the SafeFunction mechanism will then keep the object alive anyway.
This commit is contained in:
parent
57f508f048
commit
94f0c34dfe
1 changed files with 2 additions and 6 deletions
|
@ -488,15 +488,11 @@ void Window::fire_a_page_transition_event(FlyString const& event_name, bool pers
|
|||
void Window::queue_microtask_impl(WebIDL::CallbackType& callback)
|
||||
{
|
||||
// The queueMicrotask(callback) method must queue a microtask to invoke callback,
|
||||
HTML::queue_a_microtask(&associated_document(), [weak_window = make_weak_ptr<Window>(), &callback]() mutable {
|
||||
JS::GCPtr<Window> window = weak_window.ptr();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
HTML::queue_a_microtask(&associated_document(), [this, &callback]() mutable {
|
||||
auto result = WebIDL::invoke_callback(callback, {});
|
||||
// and if callback throws an exception, report the exception.
|
||||
if (result.is_error())
|
||||
HTML::report_exception(result, window->realm());
|
||||
HTML::report_exception(result, realm());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue