Title: [236984] trunk
Revision
236984
Author
jer.no...@apple.com
Date
2018-10-09 14:45:14 -0700 (Tue, 09 Oct 2018)

Log Message

WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated
https://bugs.webkit.org/show_bug.cgi?id=190098
<rdar://problem/42822671>

Reviewed by Brian Burg.

Source/WebKit:

Forcibly exit fullscreen in resetState(), while the VideoFullscreenManagerProxy is still valid.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/CloseWebViewAfterEnterFullscreen.mm: Added.
(-[CloseWebViewAfterEnterFullscreenUIDelegate _webViewDidEnterFullscreen:]):
(-[CloseWebViewAfterEnterFullscreenUIDelegate _webViewDidExitFullscreen:]):
(TestWebKitAPI::TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (236983 => 236984)


--- trunk/Source/WebKit/ChangeLog	2018-10-09 21:31:35 UTC (rev 236983)
+++ trunk/Source/WebKit/ChangeLog	2018-10-09 21:45:14 UTC (rev 236984)
@@ -1,3 +1,16 @@
+2018-10-09  Jer Noble  <jer.no...@apple.com>
+
+        WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated
+        https://bugs.webkit.org/show_bug.cgi?id=190098
+        <rdar://problem/42822671>
+
+        Reviewed by Brian Burg.
+
+        Forcibly exit fullscreen in resetState(), while the VideoFullscreenManagerProxy is still valid.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::resetState):
+
 2018-10-09  Daniel Bates  <daba...@apple.com>
 
         [iOS] Ignore some deprecated declarations

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (236983 => 236984)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-10-09 21:31:35 UTC (rev 236983)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-10-09 21:45:14 UTC (rev 236984)
@@ -6111,7 +6111,10 @@
     }
 
 #if ENABLE(FULLSCREEN_API)
-    m_fullScreenManager = nullptr;
+    if (m_fullScreenManager) {
+        m_fullScreenManager->close();
+        m_fullScreenManager = nullptr;
+    }
 #endif
 
     if (m_openPanelResultListener) {

Modified: trunk/Tools/ChangeLog (236983 => 236984)


--- trunk/Tools/ChangeLog	2018-10-09 21:31:35 UTC (rev 236983)
+++ trunk/Tools/ChangeLog	2018-10-09 21:45:14 UTC (rev 236984)
@@ -1,3 +1,17 @@
+2018-10-09  Jer Noble  <jer.no...@apple.com>
+
+        WebDriver: thrown ObjC exception under -[WKFullScreenWindowController windowDidFailToEnterFullScreen:] when session is terminated
+        https://bugs.webkit.org/show_bug.cgi?id=190098
+        <rdar://problem/42822671>
+
+        Reviewed by Brian Burg.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/CloseWebViewAfterEnterFullscreen.mm: Added.
+        (-[CloseWebViewAfterEnterFullscreenUIDelegate _webViewDidEnterFullscreen:]):
+        (-[CloseWebViewAfterEnterFullscreenUIDelegate _webViewDidExitFullscreen:]):
+        (TestWebKitAPI::TEST):
+
 2018-10-09  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthN] Import CTAP HID message and packet structure from Chromium

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (236983 => 236984)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-10-09 21:31:35 UTC (rev 236983)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2018-10-09 21:45:14 UTC (rev 236984)
@@ -753,6 +753,7 @@
 		CDC9442F1EF205D60059C3C4 /* mediastreamtrack-detached.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC9442B1EF1FBD20059C3C4 /* mediastreamtrack-detached.html */; };
 		CDCFA7AA1E45183200C2433D /* SampleMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDCFA7A91E45122F00C2433D /* SampleMap.cpp */; };
 		CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */; };
+		CDF92237216D186400647AA7 /* CloseWebViewAfterEnterFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDF92236216D186400647AA7 /* CloseWebViewAfterEnterFullscreen.mm */; };
 		CE06DF9B1E1851F200E570C9 /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */; };
 		CE0947372063223B003C9BA0 /* SchemeRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE0947362063223B003C9BA0 /* SchemeRegistry.mm */; };
 		CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; };
@@ -1993,6 +1994,7 @@
 		CDCFA7A91E45122F00C2433D /* SampleMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SampleMap.cpp; sourceTree = "<group>"; };
 		CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenTopContentInset.html; sourceTree = "<group>"; };
 		CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenTopContentInset.mm; sourceTree = "<group>"; };
+		CDF92236216D186400647AA7 /* CloseWebViewAfterEnterFullscreen.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CloseWebViewAfterEnterFullscreen.mm; sourceTree = "<group>"; };
 		CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; };
 		CE0947362063223B003C9BA0 /* SchemeRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SchemeRegistry.mm; sourceTree = "<group>"; };
 		CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = "<group>"; };
@@ -2328,6 +2330,7 @@
 				1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
 				1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */,
 				5CB18BA71F5645B200EE23C4 /* ClickAutoFillButton.mm */,
+				CDF92236216D186400647AA7 /* CloseWebViewAfterEnterFullscreen.mm */,
 				1AAD19F51C7CE20300831E47 /* Coding.mm */,
 				7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */,
 				5C4A84941F7EEFD400ACFC54 /* Configuration.mm */,
@@ -3908,6 +3911,7 @@
 				5C0BF88D1DD5964D00B00328 /* MemoryPressureHandler.mm in Sources */,
 				7C83E0B71D0A64B800FEBCF3 /* MenuTypesForMouseEvents.cpp in Sources */,
 				5C0BF8941DD599C900B00328 /* MenuTypesForMouseEvents.mm in Sources */,
+				CDF92237216D186400647AA7 /* CloseWebViewAfterEnterFullscreen.mm in Sources */,
 				5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */,
 				A5B149DE1F5A19EA00C6DAFF /* MIMETypeRegistry.cpp in Sources */,
 				51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CloseWebViewAfterEnterFullscreen.mm (0 => 236984)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CloseWebViewAfterEnterFullscreen.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CloseWebViewAfterEnterFullscreen.mm	2018-10-09 21:45:14 UTC (rev 236984)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_API_ENABLED && PLATFORM(MAC)
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKFullscreenDelegate.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Seconds.h>
+
+static bool didEnterFullscreen;
+static bool didExitFullscreen;
+
+@interface CloseWebViewAfterEnterFullscreenUIDelegate : NSObject <_WKFullscreenDelegate>
+@end
+
+@implementation CloseWebViewAfterEnterFullscreenUIDelegate
+
+- (void)_webViewDidEnterFullscreen:(WKWebView *)webView
+{
+    didEnterFullscreen = true;
+}
+
+- (void)_webViewDidExitFullscreen:(WKWebView *)webView
+{
+    didExitFullscreen = true;
+}
+@end
+
+namespace TestWebKitAPI {
+
+TEST(CloseWebViewAfterEnterFullscreen, VideoFullscreen)
+{
+    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration preferences]._fullScreenEnabled = YES;
+    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
+    RetainPtr<CloseWebViewAfterEnterFullscreenUIDelegate> handler = adoptNS([[CloseWebViewAfterEnterFullscreenUIDelegate alloc] init]);
+    [webView _setFullscreenDelegate:handler.get()];
+
+    [webView synchronouslyLoadHTMLString:@"<video src="" controls></video>"];
+
+    didEnterFullscreen = false;
+    [webView evaluateJavaScript:@"document.querySelector('video').webkitEnterFullscreen()" completionHandler: nil];
+    TestWebKitAPI::Util::run(&didEnterFullscreen);
+    ASSERT_TRUE(didEnterFullscreen);
+
+    // Should not crash:
+    [webView _close];
+}
+
+
+TEST(CloseWebViewAfterEnterFullscreen, ElementFullscreen)
+{
+    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration preferences]._fullScreenEnabled = YES;
+    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
+    RetainPtr<CloseWebViewAfterEnterFullscreenUIDelegate> handler = adoptNS([[CloseWebViewAfterEnterFullscreenUIDelegate alloc] init]);
+    [webView _setFullscreenDelegate:handler.get()];
+
+    [webView synchronouslyLoadHTMLString:@"<div style=\"width:100px;height:100px;background-color:red;\"></div>"];
+
+    didEnterFullscreen = false;
+    [webView evaluateJavaScript:@"document.querySelector('div').webkitRequestFullscreen()" completionHandler: nil];
+    TestWebKitAPI::Util::run(&didEnterFullscreen);
+    ASSERT_TRUE(didEnterFullscreen);
+
+    // Should not crash:
+    [webView _close];
+}
+
+} // namespace TestWebKitAPI
+
+#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to