mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
WebContent: Close top-level traversables asynchronously
The spec is a bit out-of-date here, so this works around an issue with closing top-level traversables while a dialog is open in another window within the same agent.
This commit is contained in:
parent
4c61ce5b10
commit
185255efc3
Notes:
github-actions[bot]
2024-11-05 19:06:58 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/185255efc39 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2176 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 7 additions and 1 deletions
|
@ -460,7 +460,13 @@ Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window
|
|||
// 2. Handle any user prompts and return its value if it is an error.
|
||||
handle_any_user_prompts([this]() {
|
||||
// 3. Close the current top-level browsing context.
|
||||
current_top_level_browsing_context()->top_level_traversable()->close_top_level_traversable();
|
||||
// FIXME: Spec issue: Closing browsing contexts is no longer a spec concept, we must instead close the top-level
|
||||
// traversable. We must also do so asynchronously, as the implementation will spin the event loop in some
|
||||
// steps. If a user dialog is open in another window within this agent, the event loop will be paused, and
|
||||
// those spins will hang. So we must return control to the client, who can deal with the dialog.
|
||||
Web::HTML::queue_a_task(Web::HTML::Task::Source::Unspecified, nullptr, nullptr, JS::create_heap_function(current_top_level_browsing_context()->heap(), [this]() {
|
||||
current_top_level_browsing_context()->top_level_traversable()->close_top_level_traversable();
|
||||
}));
|
||||
|
||||
async_driver_execution_complete(JsonValue {});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue