mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00: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:
parent
cf523137ad
commit
b11ba4cc90
Notes:
github-actions[bot]
2025-03-02 22:28:18 +00:00
Author: https://github.com/trflynn89
Commit: b11ba4cc90
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3760
5 changed files with 43 additions and 1 deletions
|
@ -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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue