mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-23 18:51:55 +00:00
LibWeb: Let queue_global_task() take a JS::HeapFunction
Changes the signature of queue_global_task() from AK:Function to JS::HeapFunction to be more clear to the user of the function that this is what it uses internally.
This commit is contained in:
parent
9540af6489
commit
a3661fd7f2
Notes:
sideshowbarker
2024-07-17 03:05:16 +09:00
Author: https://github.com/kennethmyhra
Commit: a3661fd7f2
Pull-request: https://github.com/SerenityOS/serenity/pull/24026
23 changed files with 104 additions and 103 deletions
|
@ -679,12 +679,12 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::perform_a_navigation_api_trave
|
|||
|
||||
// 1. Queue a global task on the navigation and traversal task source given navigation's relevant global object
|
||||
// to reject the finished promise for apiMethodTracker with an "InvalidStateError" DOMException.
|
||||
queue_global_task(HTML::Task::Source::NavigationAndTraversal, relevant_global_object(*this), [this, api_method_tracker] {
|
||||
queue_global_task(HTML::Task::Source::NavigationAndTraversal, relevant_global_object(*this), JS::create_heap_function(heap(), [this, api_method_tracker] {
|
||||
auto& reject_realm = relevant_realm(*this);
|
||||
TemporaryExecutionContext execution_context { relevant_settings_object(*this) };
|
||||
WebIDL::reject_promise(reject_realm, api_method_tracker->finished_promise,
|
||||
WebIDL::InvalidStateError::create(reject_realm, "Cannot traverse with stale session history entry"_fly_string));
|
||||
});
|
||||
}));
|
||||
|
||||
// 2. Abort these steps.
|
||||
return;
|
||||
|
@ -712,20 +712,20 @@ WebIDL::ExceptionOr<NavigationResult> Navigation::perform_a_navigation_api_trave
|
|||
auto& realm = relevant_realm(*this);
|
||||
auto& global = relevant_global_object(*this);
|
||||
if (result == TraversableNavigable::HistoryStepResult::CanceledByBeforeUnload) {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, global, [this, api_method_tracker, &realm] {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, global, JS::create_heap_function(heap(), [this, api_method_tracker, &realm] {
|
||||
TemporaryExecutionContext execution_context { relevant_settings_object(*this) };
|
||||
reject_the_finished_promise(api_method_tracker, WebIDL::AbortError::create(realm, "Navigation cancelled by beforeunload"_fly_string));
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
// 6. If result is "initiator-disallowed", then queue a global task on the navigation and traversal task source
|
||||
// given navigation's relevant global object to reject the finished promise for apiMethodTracker with a
|
||||
// new "SecurityError" DOMException created in navigation's relevant realm.
|
||||
if (result == TraversableNavigable::HistoryStepResult::InitiatorDisallowed) {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, global, [this, api_method_tracker, &realm] {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, global, JS::create_heap_function(heap(), [this, api_method_tracker, &realm] {
|
||||
TemporaryExecutionContext execution_context { relevant_settings_object(*this) };
|
||||
reject_the_finished_promise(api_method_tracker, WebIDL::SecurityError::create(realm, "Navigation disallowed from this origin"_fly_string));
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue