Changeset 255595 in webkit
- Timestamp:
- Feb 3, 2020 2:21:54 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r255581 r255595 1 2020-02-03 Chris Dumez <cdumez@apple.com> 2 3 Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=207121 5 <rdar://problem/58880177> 6 7 Reviewed by Alex Christensen. 8 9 WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView, in case we time out 10 while waiting for an answer from the WebProcess but the WebProcess eventually responds. 11 12 Change is covered by new API test. 13 14 * UIProcess/WebPageProxy.cpp: 15 (WebKit::WebPageProxy::tryClose): 16 1 17 2020-02-03 Eric Carlson <eric.carlson@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r255532 r255595 1130 1130 return; 1131 1131 1132 // If we timed out, don't ask the client to close again. 1133 if (!m_tryCloseTimeoutTimer.isActive()) 1134 return; 1135 1132 1136 m_tryCloseTimeoutTimer.stop(); 1133 1137 if (shouldClose) -
trunk/Tools/ChangeLog
r255590 r255595 1 2020-02-03 Chris Dumez <cdumez@apple.com> 2 3 Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView 4 https://bugs.webkit.org/show_bug.cgi?id=207121 5 <rdar://problem/58880177> 6 7 Reviewed by Alex Christensen. 8 9 Add API test coverage. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 12 * TestWebKitAPI/Tests/WebKit/beforeunload-slow.html: Added. 13 * TestWebKitAPI/Tests/WebKitCocoa/ModalAlerts.mm: 14 (-[SlowBeforeUnloadHandlerUIDelegate _webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:]): 15 (-[SlowBeforeUnloadHandlerUIDelegate webViewDidClose:]): 16 (TEST): 17 1 18 2020-02-03 Lauro Moura <lmoura@igalia.com> 2 19 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r255322 r255595 252 252 46EBD8472372320F00223A6E /* RestoreScrollPosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46EBD846237231E600223A6E /* RestoreScrollPosition.mm */; }; 253 253 46FA2FEE23846CA5000CCB0C /* HTTPHeaderMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46FA2FED23846C9A000CCB0C /* HTTPHeaderMap.cpp */; }; 254 46FACF7423E8842300A9EBC6 /* beforeunload-slow.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 46FACF7323E883EE00A9EBC6 /* beforeunload-slow.html */; }; 254 255 4909EE3A2D09480C88982D56 /* Markable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC79F168BE454E579E417B05 /* Markable.cpp */; }; 255 256 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; }; … … 1211 1212 F41AB9A01EF4696B0083FA08 /* background-image-link-and-input.html in Copy Resources */, 1212 1213 464C764D230DF85C00AFB020 /* BadServiceWorkerRegistrations-4.sqlite3 in Copy Resources */, 1214 46FACF7423E8842300A9EBC6 /* beforeunload-slow.html in Copy Resources */, 1213 1215 46C3AEB323D0E529001B0680 /* beforeunload.html in Copy Resources */, 1214 1216 2DE71B001D49C3ED00904094 /* blinking-div.html in Copy Resources */, … … 1816 1818 46EBD846237231E600223A6E /* RestoreScrollPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RestoreScrollPosition.mm; sourceTree = "<group>"; }; 1817 1819 46FA2FED23846C9A000CCB0C /* HTTPHeaderMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderMap.cpp; sourceTree = "<group>"; }; 1820 46FACF7323E883EE00A9EBC6 /* beforeunload-slow.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "beforeunload-slow.html"; sourceTree = "<group>"; }; 1818 1821 4A410F4B19AF7BD6002EBAB5 /* UserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMedia.cpp; sourceTree = "<group>"; }; 1819 1822 4A410F4D19AF7BEF002EBAB5 /* getUserMedia.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = getUserMedia.html; sourceTree = "<group>"; }; … … 3891 3894 C99B675A1E3971FC00FC6C80 /* autoplay-with-controls.html */, 3892 3895 C99BDF881E8097E300C7170E /* autoplay-zero-volume-check.html */, 3896 46FACF7323E883EE00A9EBC6 /* beforeunload-slow.html */, 3893 3897 46C3AEB223D0E50F001B0680 /* beforeunload.html */, 3894 3898 7C486BA01AA1254B003F6F9B /* bundle-file.html */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ModalAlerts.mm
r254711 r255595 191 191 } 192 192 193 #endif 193 static bool webViewDidCloseCalled = false; 194 static unsigned viewDidCloseCallCount = 0; 195 196 @interface SlowBeforeUnloadHandlerUIDelegate : NSObject <WKUIDelegate> 197 @end 198 199 @implementation SlowBeforeUnloadHandlerUIDelegate 200 201 - (void)_webView:(WKWebView *)webView runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler 202 { 203 completionHandler(YES); 204 } 205 206 - (void)webViewDidClose:(WKWebView *)webView 207 { 208 ++viewDidCloseCallCount; 209 webViewDidCloseCalled = true; 210 } 211 212 @end 213 214 TEST(WebKit, SlowBeforeUnloadHandlerSingleClosePageCall) 215 { 216 auto slowBeforeUnloadHandlerUIDelegate = adoptNS([[SlowBeforeUnloadHandlerUIDelegate alloc] init]); 217 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 218 [webView setUIDelegate:slowBeforeUnloadHandlerUIDelegate.get()]; 219 [webView synchronouslyLoadTestPageNamed:@"beforeunload-slow"]; 220 221 TestWebKitAPI::Util::spinRunLoop(10); 222 223 // Need a user gesture on the page before being allowed to show the beforeunload prompt. 224 [webView sendClicksAtPoint:NSMakePoint(5, 5) numberOfClicks:1]; 225 226 TestWebKitAPI::Util::spinRunLoop(100); 227 228 [webView _tryClose]; 229 230 TestWebKitAPI::Util::run(&webViewDidCloseCalled); 231 EXPECT_EQ(1U, viewDidCloseCallCount); 232 EXPECT_FALSE([webView _isClosed]); 233 234 TestWebKitAPI::Util::sleep(0.2); 235 236 EXPECT_EQ(1U, viewDidCloseCallCount); 237 EXPECT_FALSE([webView _isClosed]); 238 } 239 240 #endif
Note: See TracChangeset
for help on using the changeset viewer.