mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Clear the document's page's focused navigable upon destruction
We set the page's focused navigable upon mouse-down events from the UI. However, we neglected to ever clear that focused navigable upon events such as subsequent page navigations. This left the page with a stale reference to a no-longer-active navigable. The effect was that any key events from the UI would not be sent to the new page until either the reference was collected by GC, or another mouse-down event occurred. In the test added here, without this fix, the text sent to the input element would not be received, and the change event would not fire.
This commit is contained in:
Notes:
github-actions[bot]
2025-03-02 22:28:18 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/b11ba4cc903 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3760
@@ -63,6 +63,12 @@ void Page::set_focused_navigable(Badge<EventHandler>, HTML::Navigable& navigable
|
||||
m_focused_navigable = navigable;
|
||||
}
|
||||
|
||||
void Page::navigable_document_destroyed(Badge<DOM::Document>, HTML::Navigable& navigable)
|
||||
{
|
||||
if (&navigable == m_focused_navigable.ptr())
|
||||
m_focused_navigable.clear();
|
||||
}
|
||||
|
||||
void Page::load(URL::URL const& url)
|
||||
{
|
||||
(void)top_level_traversable()->navigate({ .url = url, .source_document = *top_level_traversable()->active_document(), .user_involvement = HTML::UserNavigationInvolvement::BrowserUI });
|
||||
|
||||
Reference in New Issue
Block a user