1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +00:00

LibWeb: Add Page::has_ongoing_navigation()

Introduce has_ongoing_navigation() that allows to check if resource
state in FrameLoading is pending. This API is going to be used in
upcoming fix for wait_for_navigation_to_complete() in WebDriver.
This commit is contained in:
Aliaksandr Kalenik 2023-05-30 20:24:52 +03:00 committed by Andreas Kling
parent d1d9d7a4f3
commit 31b9729333
5 changed files with 23 additions and 9 deletions

View file

@ -37,9 +37,16 @@ public:
Type type() const { return m_type; }
bool is_loaded() const { return m_loaded; }
enum class State {
Pending,
Loaded,
Failed,
};
bool is_pending() const { return m_state == State::Pending; }
bool is_loaded() const { return m_state == State::Loaded; }
bool is_failed() const { return m_state == State::Failed; }
bool is_failed() const { return m_failed; }
DeprecatedString const& error() const { return m_error; }
bool has_encoded_data() const { return !m_encoded_data.is_empty(); }
@ -71,8 +78,7 @@ private:
LoadRequest m_request;
ByteBuffer m_encoded_data;
Type m_type { Type::Generic };
bool m_loaded { false };
bool m_failed { false };
State m_state { State::Pending };
DeprecatedString m_error;
Optional<DeprecatedString> m_encoding;