Diff
Modified: trunk/LayoutTests/ChangeLog (269521 => 269522)
--- trunk/LayoutTests/ChangeLog 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/LayoutTests/ChangeLog 2020-11-06 18:33:25 UTC (rev 269522)
@@ -1,3 +1,16 @@
+2020-11-06 Jer Noble <[email protected]>
+
+ Do not allow pages to enter fullscreen while an exit fullscreen operation is ongoing.
+ https://bugs.webkit.org/show_bug.cgi?id=218640
+ <rdar://problem/70697738>
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ * fullscreen/full-screen-enter-while-exiting-expected.txt: Added.
+ * fullscreen/full-screen-enter-while-exiting.html: Added.
+ * platform/wk2/TestExpectations:
+
2020-11-06 Diego Pino Garcia <[email protected]>
[WPE] Unreviewed test gardening. Gardened several flaky failures reported by the bot.
Modified: trunk/LayoutTests/TestExpectations (269521 => 269522)
--- trunk/LayoutTests/TestExpectations 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/LayoutTests/TestExpectations 2020-11-06 18:33:25 UTC (rev 269522)
@@ -4638,3 +4638,6 @@
# These tests are for iOS port.
fast/shadow-dom/ios/ [ Skip ]
+
+# Requires WK2 TestRunner
+fullscreen/full-screen-enter-while-exiting.html [ Skip ]
\ No newline at end of file
Added: trunk/LayoutTests/fullscreen/full-screen-enter-while-exiting-expected.txt (0 => 269522)
--- trunk/LayoutTests/fullscreen/full-screen-enter-while-exiting-expected.txt (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-enter-while-exiting-expected.txt 2020-11-06 18:33:25 UTC (rev 269522)
@@ -0,0 +1,15 @@
+Enter fullscreen with target1
+RUN(target1.webkitRequestFullScreen())
+RUN(internals.webkitWillEnterFullScreenForElement(target1))
+EVENT(webkitfullscreenchange)
+RUN(internals.webkitDidEnterFullScreenForElement(target1))
+Exit fullscreen with target1
+RUN(document.webkitExitFullscreen())
+RUN(internals.webkitWillExitFullScreenForElement(target1))
+Attempt to enter fullscreen with target2
+RUN(target2.webkitRequestFullScreen())
+EVENT(webkitfullscreenchange)
+EVENT(webkitfullscreenerror)
+RUN(internals.webkitDidExitFullScreenForElement(target1))
+END OF TEST
+
Added: trunk/LayoutTests/fullscreen/full-screen-enter-while-exiting.html (0 => 269522)
--- trunk/LayoutTests/fullscreen/full-screen-enter-while-exiting.html (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-enter-while-exiting.html 2020-11-06 18:33:25 UTC (rev 269522)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>full-screen-enter-while-exiting</title>
+ <script src=""
+ <script>
+
+ window.addEventListener('load', async event => {
+ if (Element.prototype.webkitRequestFullScreen == undefined) {
+ logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+ endTest();
+ return;
+ }
+
+ if (!window.testRunner) {
+ logResult(false, "This test requires Internals.");
+ endTest();
+ return;
+ }
+
+ if (!testRunner.setEnterFullscreenForElementCallback) {
+ logResult(false, "This test requires WebKitTestRunner.")
+ endTest();
+ return;
+ }
+
+ testRunner.setHasCustomFullScreenBehavior(true);
+
+ let enterFullScreenPromise = new Promise(resolve => {
+ testRunner.setEnterFullscreenForElementCallback(resolve);
+ });
+
+ consoleWrite('Enter fullscreen with target1');
+ internals.withUserGesture(() => { run('target1.webkitRequestFullScreen()'); });
+
+ await enterFullScreenPromise;
+
+ var changePromise = waitFor(target1, 'webkitfullscreenchange');
+ run('internals.webkitWillEnterFullScreenForElement(target1)');
+
+ await changePromise;
+
+ run('internals.webkitDidEnterFullScreenForElement(target1)');
+
+ let exitFullScreenPromise = new Promise(resolve => {
+ testRunner.setExitFullscreenForElementCallback(resolve);
+ });
+
+ consoleWrite('Exit fullscreen with target1');
+ run('document.webkitExitFullscreen()');
+ await exitFullScreenPromise;
+ changePromise = waitFor(document, 'webkitfullscreenchange')
+
+ run('internals.webkitWillExitFullScreenForElement(target1)');
+
+ consoleWrite('Attempt to enter fullscreen with target2');
+ internals.withUserGesture(() => { run('target2.webkitRequestFullScreen()'); });
+
+ await waitFor(target2, 'webkitfullscreenerror');
+
+ run('internals.webkitDidExitFullScreenForElement(target1)');
+ await changePromise;
+
+ testRunner.setHasCustomFullScreenBehavior(false);
+
+ endTest();
+ });
+</script>
+</head>
+<body>
+<span id="target1"></span>
+<span id="target2"></span>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (269521 => 269522)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2020-11-06 18:33:25 UTC (rev 269522)
@@ -821,3 +821,4 @@
# WebKit2 only.
js/throw-large-string-oom.html [ Pass ]
+fullscreen/full-screen-enter-while-exiting.html [ Pass ]
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (269521 => 269522)
--- trunk/Source/WebCore/ChangeLog 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Source/WebCore/ChangeLog 2020-11-06 18:33:25 UTC (rev 269522)
@@ -1,3 +1,26 @@
+2020-11-06 Jer Noble <[email protected]>
+
+ Do not allow pages to enter fullscreen while an exit fullscreen operation is ongoing.
+ https://bugs.webkit.org/show_bug.cgi?id=218640
+ <rdar://problem/70697738>
+
+ Reviewed by Eric Carlson.
+
+ Test: fullscreen/full-screen-enter-while-exiting.html
+
+ Pages can inadvertantly trap users in fullscreen mode by attempting to enter
+ fullscreen during an exit fullscreen operation, when both the exit and enter
+ were triggered by a user gesture. While this is not explicitly forbidden by
+ the Fullscreen specification, we already reject requests in similar situations,
+ such as when the document was hidden between the request and when the request
+ was handled.
+
+ * dom/FullscreenManager.cpp:
+ (WebCore::FullscreenManager::requestFullscreenForElement):
+ (WebCore::FullscreenManager::exitFullscreen):
+ (WebCore::FullscreenManager::didExitFullscreen):
+ * dom/FullscreenManager.h:
+
2020-11-06 Alex Christensen <[email protected]>
Fix crashes around NetworkStorageSession::registerCookieChangeListenersIfNecessary
Modified: trunk/Source/WebCore/dom/FullscreenManager.cpp (269521 => 269522)
--- trunk/Source/WebCore/dom/FullscreenManager.cpp 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Source/WebCore/dom/FullscreenManager.cpp 2020-11-06 18:33:25 UTC (rev 269522)
@@ -112,6 +112,12 @@
return;
}
+ // Don't allow fullscreen if we're inside an exitFullscreen operation.
+ if (m_pendingExitFullscreen) {
+ failedPreflights(WTFMove(element));
+ return;
+ }
+
// Don't allow fullscreen if document is hidden.
if (document().hidden()) {
failedPreflights(WTFMove(element));
@@ -314,6 +320,7 @@
// Only exit out of full screen window mode if there are no remaining elements in the
// full screen stack.
if (!newTop) {
+ m_pendingExitFullscreen = true;
page->chrome().client().exitFullScreenForElement(fullscreenElement.get());
return;
}
@@ -414,6 +421,7 @@
void FullscreenManager::didExitFullscreen()
{
+ m_pendingExitFullscreen = false;
auto fullscreenElement = fullscreenOrPendingElement();
if (!fullscreenElement)
return;
Modified: trunk/Source/WebCore/dom/FullscreenManager.h (269521 => 269522)
--- trunk/Source/WebCore/dom/FullscreenManager.h 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Source/WebCore/dom/FullscreenManager.h 2020-11-06 18:33:25 UTC (rev 269522)
@@ -110,6 +110,7 @@
RefPtr<Element> fullscreenOrPendingElement() const { return m_fullscreenElement ? m_fullscreenElement : m_pendingFullscreenElement; }
+ bool m_pendingExitFullscreen { false };
RefPtr<Element> m_pendingFullscreenElement;
RefPtr<Element> m_fullscreenElement;
Vector<RefPtr<Element>> m_fullscreenElementStack;
Modified: trunk/Tools/ChangeLog (269521 => 269522)
--- trunk/Tools/ChangeLog 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Tools/ChangeLog 2020-11-06 18:33:25 UTC (rev 269522)
@@ -1,3 +1,22 @@
+2020-11-06 Jer Noble <[email protected]>
+
+ Do not allow pages to enter fullscreen while an exit fullscreen operation is ongoing.
+ https://bugs.webkit.org/show_bug.cgi?id=218640
+ <rdar://problem/70697738>
+
+ Reviewed by Eric Carlson.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::enterFullScreenForElement):
+ (WTR::InjectedBundlePage::exitFullScreenForElement):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setEnterFullscreenForElementCallback):
+ (WTR::TestRunner::callEnterFullscreenForElementCallback):
+ (WTR::TestRunner::setExitFullscreenForElementCallback):
+ (WTR::TestRunner::callExitFullscreenForElementCallback):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
2020-11-06 Adrian Perez de Castro <[email protected]>
[Flatpak SDK] Update libmanette source URI to new location
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (269521 => 269522)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2020-11-06 18:33:25 UTC (rev 269522)
@@ -195,6 +195,8 @@
// Control full screen behavior.
undefined setHasCustomFullScreenBehavior(boolean value);
+ undefined setEnterFullscreenForElementCallback(object callback);
+ undefined setExitFullscreenForElementCallback(object callback);
// Web notifications support
undefined grantWebNotificationPermission(DOMString origin);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (269521 => 269522)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp 2020-11-06 18:33:25 UTC (rev 269522)
@@ -1761,7 +1761,8 @@
if (!injectedBundle.testRunner()->hasCustomFullScreenBehavior()) {
WKBundlePageWillEnterFullScreen(pageRef);
WKBundlePageDidEnterFullScreen(pageRef);
- }
+ } else
+ injectedBundle.testRunner()->callEnterFullscreenForElementCallback();
}
void InjectedBundlePage::exitFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef)
@@ -1773,7 +1774,8 @@
if (!injectedBundle.testRunner()->hasCustomFullScreenBehavior()) {
WKBundlePageWillExitFullScreen(pageRef);
WKBundlePageDidExitFullScreen(pageRef);
- }
+ } else
+ injectedBundle.testRunner()->callExitFullscreenForElementCallback();
}
void InjectedBundlePage::beganEnterFullScreen(WKBundlePageRef, WKRect, WKRect)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (269521 => 269522)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2020-11-06 18:33:25 UTC (rev 269522)
@@ -644,6 +644,8 @@
TextFieldDidEndEditingCallbackID,
CustomMenuActionCallbackID,
DidSetAppBoundDomainsCallbackID,
+ EnterFullscreenForElementCallbackID,
+ ExitFullscreenForElementCallbackID,
FirstUIScriptCallbackID = 100
};
@@ -749,6 +751,26 @@
postSynchronousMessage("SetOnlyAcceptFirstPartyCookies", accept);
}
+void TestRunner::setEnterFullscreenForElementCallback(JSValueRef callback)
+{
+ cacheTestRunnerCallback(EnterFullscreenForElementCallbackID, callback);
+}
+
+void TestRunner::callEnterFullscreenForElementCallback()
+{
+ callTestRunnerCallback(EnterFullscreenForElementCallbackID);
+}
+
+void TestRunner::setExitFullscreenForElementCallback(JSValueRef callback)
+{
+ cacheTestRunnerCallback(ExitFullscreenForElementCallbackID, callback);
+}
+
+void TestRunner::callExitFullscreenForElementCallback()
+{
+ callTestRunnerCallback(ExitFullscreenForElementCallbackID);
+}
+
double TestRunner::preciseTime()
{
return WallTime::now().secondsSinceEpoch().seconds();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (269521 => 269522)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2020-11-06 18:30:14 UTC (rev 269521)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2020-11-06 18:33:25 UTC (rev 269522)
@@ -275,6 +275,10 @@
// Custom full screen behavior.
void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; }
bool hasCustomFullScreenBehavior() const { return m_customFullScreenBehavior; }
+ void setEnterFullscreenForElementCallback(JSValueRef);
+ void callEnterFullscreenForElementCallback();
+ void setExitFullscreenForElementCallback(JSValueRef);
+ void callExitFullscreenForElementCallback();
// Web notifications.
static void grantWebNotificationPermission(JSStringRef origin);