mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
LibWeb: Remove now-unnecessary JS::Handles in HTML task capture lists
JS::SafeFunction will protect anything captures for HTML tasks now.
This commit is contained in:
parent
d505192014
commit
2ccb9bef49
6 changed files with 22 additions and 22 deletions
|
@ -1105,7 +1105,7 @@ DOM::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_index,
|
|||
if (new_document->ready_state() == "complete"sv) {
|
||||
// then queue a global task on the DOM manipulation task source given newDocument's relevant global object to run the following steps:
|
||||
|
||||
queue_global_task(Task::Source::DOMManipulation, relevant_global_object(*new_document), [new_document = JS::make_handle(*new_document)]() mutable {
|
||||
queue_global_task(Task::Source::DOMManipulation, relevant_global_object(*new_document), [new_document]() mutable {
|
||||
// 1. If newDocument's page showing flag is true, then abort these steps.
|
||||
if (new_document->page_showing())
|
||||
return;
|
||||
|
@ -1174,7 +1174,7 @@ DOM::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_index,
|
|||
// 20. If hashChanged is true,
|
||||
if (hash_changed) {
|
||||
// then queue a global task on the DOM manipulation task source given newDocument's relevant global object
|
||||
queue_global_task(Task::Source::DOMManipulation, relevant_global_object(*new_document), [new_document = JS::make_handle(*new_document)]() mutable {
|
||||
queue_global_task(Task::Source::DOMManipulation, relevant_global_object(*new_document), [new_document]() mutable {
|
||||
// to fire an event named hashchange at newDocument's relevant global object,
|
||||
// using HashChangeEvent, with the oldURL attribute initialized to oldURL
|
||||
// and the newURL attribute initialized to newURL.
|
||||
|
|
|
@ -87,11 +87,11 @@ void MessagePort::post_message(JS::Value message)
|
|||
|
||||
// FIXME: This is an ad-hoc hack implementation instead, since we don't currently
|
||||
// have serialization and deserialization of messages.
|
||||
main_thread_event_loop().task_queue().add(HTML::Task::create(HTML::Task::Source::PostedMessage, nullptr, [strong_port = JS::make_handle(*target_port), strong_message = JS::make_handle(message)]() mutable {
|
||||
main_thread_event_loop().task_queue().add(HTML::Task::create(HTML::Task::Source::PostedMessage, nullptr, [target_port, message]() mutable {
|
||||
MessageEventInit event_init {};
|
||||
event_init.data = strong_message.value();
|
||||
event_init.data = message;
|
||||
event_init.origin = "<origin>";
|
||||
strong_port->dispatch_event(*MessageEvent::create(verify_cast<HTML::Window>(strong_port->realm().global_object()), HTML::EventNames::message, event_init));
|
||||
target_port->dispatch_event(*MessageEvent::create(verify_cast<HTML::Window>(target_port->realm().global_object()), HTML::EventNames::message, event_init));
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void EnvironmentSettingsObject::notify_about_rejected_promises(Badge<EventLoop>)
|
|||
auto& global = global_object();
|
||||
|
||||
// 5. Queue a global task on the DOM manipulation task source given global to run the following substep:
|
||||
queue_global_task(Task::Source::DOMManipulation, global, [this, global = JS::make_handle(&global), list = move(list)]() mutable {
|
||||
queue_global_task(Task::Source::DOMManipulation, global, [this, &global, list = move(list)]() mutable {
|
||||
// 1. For each promise p in list:
|
||||
for (auto promise_handle : list) {
|
||||
auto& promise = *promise_handle.cell();
|
||||
|
@ -217,7 +217,7 @@ void EnvironmentSettingsObject::notify_about_rejected_promises(Badge<EventLoop>)
|
|||
/* .reason = */ promise.result(),
|
||||
};
|
||||
// FIXME: This currently assumes that global is a WindowObject.
|
||||
auto& window = verify_cast<HTML::Window>(*global.cell());
|
||||
auto& window = verify_cast<HTML::Window>(global);
|
||||
|
||||
auto promise_rejection_event = PromiseRejectionEvent::create(window, HTML::EventNames::unhandledrejection, event_init);
|
||||
|
||||
|
|
|
@ -600,11 +600,11 @@ DOM::ExceptionOr<void> Window::post_message_impl(JS::Value message, String const
|
|||
{
|
||||
// FIXME: This is an ad-hoc hack implementation instead, since we don't currently
|
||||
// have serialization and deserialization of messages.
|
||||
HTML::queue_global_task(HTML::Task::Source::PostedMessage, *this, [strong_this = JS::make_handle(*this), strong_message = JS::make_handle(message)]() mutable {
|
||||
HTML::queue_global_task(HTML::Task::Source::PostedMessage, *this, [this, message]() mutable {
|
||||
HTML::MessageEventInit event_init {};
|
||||
event_init.data = strong_message.value();
|
||||
event_init.data = message;
|
||||
event_init.origin = "<origin>";
|
||||
strong_this->dispatch_event(*HTML::MessageEvent::create(*strong_this, HTML::EventNames::message, event_init));
|
||||
dispatch_event(*HTML::MessageEvent::create(*this, HTML::EventNames::message, event_init));
|
||||
});
|
||||
return {};
|
||||
}
|
||||
|
@ -655,8 +655,8 @@ void Window::start_an_idle_period()
|
|||
|
||||
// 5. Queue a task on the queue associated with the idle-task task source,
|
||||
// which performs the steps defined in the invoke idle callbacks algorithm with window and getDeadline as parameters.
|
||||
HTML::queue_global_task(HTML::Task::Source::IdleTask, *this, [window = JS::make_handle(*this)]() mutable {
|
||||
window->invoke_idle_callbacks();
|
||||
HTML::queue_global_task(HTML::Task::Source::IdleTask, *this, [this]() mutable {
|
||||
invoke_idle_callbacks();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -679,8 +679,8 @@ void Window::invoke_idle_callbacks()
|
|||
HTML::report_exception(result);
|
||||
// 4. If window's list of runnable idle callbacks is not empty, queue a task which performs the steps
|
||||
// in the invoke idle callbacks algorithm with getDeadline and window as a parameters and return from this algorithm
|
||||
HTML::queue_global_task(HTML::Task::Source::IdleTask, *this, [window = JS::make_handle(*this)]() mutable {
|
||||
window->invoke_idle_callbacks();
|
||||
HTML::queue_global_task(HTML::Task::Source::IdleTask, *this, [this]() mutable {
|
||||
invoke_idle_callbacks();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue