mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-16 23:39:44 +00:00
LibWeb: Add a NavigationObserver to be notified of navigable updates
This contains a hook to be notified when a navigable navigation is complete, to be used by WebDriver.
This commit is contained in:
parent
247307a2a2
commit
74ef9dc393
Notes:
github-actions[bot]
2024-10-26 09:26:57 +00:00
Author: https://github.com/trflynn89
Commit: 74ef9dc393
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1967
6 changed files with 105 additions and 0 deletions
34
Userland/Libraries/LibWeb/HTML/NavigationObserver.h
Normal file
34
Userland/Libraries/LibWeb/HTML/NavigationObserver.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibJS/Heap/HeapFunction.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
class NavigationObserver final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(NavigationObserver, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(NavigationObserver);
|
||||
|
||||
public:
|
||||
[[nodiscard]] JS::GCPtr<JS::HeapFunction<void()>> navigation_complete() const { return m_navigation_complete; }
|
||||
void set_navigation_complete(Function<void()>);
|
||||
|
||||
private:
|
||||
NavigationObserver(JS::Realm&, Navigable&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
JS::NonnullGCPtr<Navigable> m_navigable;
|
||||
JS::GCPtr<JS::HeapFunction<void()>> m_navigation_complete;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue