Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
window.open from an iframe doesn't exit fullscreen for parent document
https://bugs.webkit.org/show_bug.cgi?id=255813 rdar://108387151 Reviewed by Tim Nguyen. Currently, invoking `window.open` from an `iframe` that has a parent document is fullscreen does not exit fullscreen, while invoking `window.open` from the main frame does. On macOS, the user is taken to a new tab, which is made visible, while the fullscreen content remains in its own space. On iOS, the user is taken to a new tab, but the existing content remains in fullscreen, leaving the user unaware of what has happened. WebKit's existing behavior in this scenario on macOS differs from both Chrome and Firefox, which completely exit fullscreen regardless of which frame invoked `window.open`. Additionally, the iOS behavior is confusing, as the user will suddenly viewing another page after they decide to exit fullscreen. To fix, ensure any successful call to `window.open` always exits fullscreen. * LayoutTests/fullscreen/enter-fullscreen-main-frame-window-open-iframe-expected.txt: Added. * LayoutTests/fullscreen/enter-fullscreen-main-frame-window-open-iframe.html: Added. * LayoutTests/fullscreen/resources/window-open-iframe.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: Skip test on WK1, similar to another "exit fullscreen from iframe" test. * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::createWindow): Call `FullscreenManager::cancelFullscreen` unconditionally, rather than checking if the frame's document has a fullscreen element, which would be false if the fullscreen element is in another document. `cancelFullscreen` already accounts for the top document, and is a no-op if there is no fullscreen element in any document. Canonical link: https://commits.webkit.org/263284@main
- Loading branch information