mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 20:52:54 +00:00
LibWeb: Implement CloseWatcher API
This implements most of the CloseWatcher API from the html spec. AbortSignal support is unimplemented. Integration with dialogs and popovers is also unimplemented.
This commit is contained in:
parent
527632f416
commit
b216046234
Notes:
sideshowbarker
2024-07-17 07:31:31 +09:00
Author: https://github.com/lukewarlow
Commit: b216046234
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/240
Reviewed-by: https://github.com/awesomekling
15 changed files with 432 additions and 3 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <LibWeb/DOM/HTMLCollection.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/CloseWatcherManager.h>
|
||||
#include <LibWeb/HTML/CustomElements/CustomElementRegistry.h>
|
||||
#include <LibWeb/HTML/DocumentState.h>
|
||||
#include <LibWeb/HTML/EventHandler.h>
|
||||
|
@ -129,6 +130,7 @@ void Window::visit_edges(JS::Cell::Visitor& visitor)
|
|||
visitor.visit(m_pdf_viewer_mime_type_objects);
|
||||
visitor.visit(m_count_queuing_strategy_size_function);
|
||||
visitor.visit(m_byte_length_queuing_strategy_size_function);
|
||||
visitor.visit(m_close_watcher_manager);
|
||||
}
|
||||
|
||||
void Window::finalize()
|
||||
|
@ -973,6 +975,16 @@ JS::NonnullGCPtr<Navigator> Window::navigator()
|
|||
return JS::NonnullGCPtr { *m_navigator };
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#close-watcher-manager
|
||||
JS::NonnullGCPtr<CloseWatcherManager> Window::close_watcher_manager()
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
if (!m_close_watcher_manager)
|
||||
m_close_watcher_manager = heap().allocate<CloseWatcherManager>(realm, realm);
|
||||
return JS::NonnullGCPtr { *m_close_watcher_manager };
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-alert
|
||||
void Window::alert(String const& message)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue