Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d9db6f38eff811fc082661ec2e820ea7e71c80e0
https://github.com/WebKit/WebKit/commit/d9db6f38eff811fc082661ec2e820ea7e71c80e0
Author: Jean Haberer <[email protected]>
Date: 2026-03-27 (Fri, 27 Mar 2026)
Changed paths:
M Source/WebCore/Modules/model-element/HTMLModelElement.cpp
M Source/WebCore/dom/DocumentImmersive.cpp
M Source/WebCore/dom/DocumentImmersive.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
Log Message:
-----------
Navigating away from the page can produce a stale immersive state
https://bugs.webkit.org/show_bug.cgi?id=310626
rdar://171750296
Reviewed by Etienne Segonzac.
When navigating away and back via the nav bar, the webpage incorrectly
showed the environment as active because pending/in-flight immersive
request state was never cleaned up.
* Source/WebCore/dom/DocumentImmersive.h:
* Source/WebCore/dom/DocumentImmersive.cpp:
(WebCore::DocumentImmersive::exitImmersive):
Move the immersiveElement null check inside the cancelActiveRequest
callback so that any pending state (m_pendingImmersiveElement, m_activeRequest)
is always cleaned up, even when no element has fully entered immersive yet.
(WebCore::DocumentImmersive::exitImmersiveIfNeeded):
When there is no active immersive element, clear m_pendingImmersiveElement
and m_activeRequest to handle the case where a request was in-flight
but hadn't completed.
(WebCore::DocumentImmersive::exitRemovedImmersiveElementIfNeeded):
Remove the ASSERT since this is now called unconditionally.
Clean up m_pendingImmersiveElement and m_activeRequest when the removed
element was mid-request but not yet the active immersive element.
Any rollback action will be handled appropriately by the in-flight request.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::exitImmersive const):
(WebKit::WebPage::didCommitLoad):
Call exitImmersive() on commit load to tear down immersive state
when navigating to a new page.
* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::deleteModelPlayer):
Always route through exitRemovedImmersiveElementIfNeeded when
MODEL_ELEMENT_IMMERSIVE is enabled and an immersive document exists.
Canonical link: https://commits.webkit.org/310072@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications