mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +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
Notes:
sideshowbarker
2024-07-17 05:17:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/94f0c34dfe Pull-request: https://github.com/SerenityOS/serenity/pull/15672
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…
Reference in a new issue