Changeset 259770 in webkit
- Timestamp:
- Apr 8, 2020, 5:38:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r259768 r259770 1 2020-04-08 Alex Christensen <achristensen@webkit.org> 2 3 WKWebViews should behave as if they had loaded something after restoring session state 4 https://bugs.webkit.org/show_bug.cgi?id=210097 5 <rdar://problem/58778490> 6 7 Reviewed by Chris Dumez. 8 9 Specifically, we don't want to close a WKWebView after restoring the session state into another 10 WKWebView into it then navigating to a phishing page. We want to be at the previous page after 11 the user clicks "Go back". 12 13 * UIProcess/WebPageProxy.cpp: 14 (WebKit::WebPageProxy::restoreFromSessionState): 15 1 16 2020-04-08 Kate Cheney <katherine_cheney@apple.com> 2 17 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r259731 r259770 5137 5137 } 5138 5138 5139 m_pageClient->showSafeBrowsingWarning(*safeBrowsingWarning, [ protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler), policyAction] (auto&& result) mutable {5139 m_pageClient->showSafeBrowsingWarning(*safeBrowsingWarning, [this, protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler), policyAction] (auto&& result) mutable { 5140 5140 switchOn(result, [&] (const URL& url) { 5141 5141 completionHandler(PolicyAction::Ignore); 5142 protectedThis->loadRequest({ url });5142 loadRequest({ url }); 5143 5143 }, [&] (ContinueUnsafeLoad continueUnsafeLoad) { 5144 5144 switch (continueUnsafeLoad) { 5145 5145 case ContinueUnsafeLoad::No: 5146 if (! protectedThis->hasCommittedAnyProvisionalLoads())5147 protectedThis->m_uiClient->close(protectedThis.ptr());5146 if (!hasCommittedAnyProvisionalLoads() && !m_sessionStateWasRestoredByAPIRequest) 5147 m_uiClient->close(protectedThis.ptr()); 5148 5148 completionHandler(PolicyAction::Ignore); 5149 5149 break; -
trunk/Tools/ChangeLog
r259767 r259770 1 2020-04-08 Alex Christensen <achristensen@webkit.org> 2 3 WKWebViews should behave as if they had loaded something after restoring session state 4 https://bugs.webkit.org/show_bug.cgi?id=210097 5 <rdar://problem/58778490> 6 7 Reviewed by Chris Dumez. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: 10 (TEST): 11 1 12 2020-04-08 Ross Kirsling <ross.kirsling@sony.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm
r246892 r259770 240 240 } 241 241 242 TEST(SafeBrowsing, GoBackAfterRestoreFromSessionState) 243 { 244 auto webView1 = adoptNS([WKWebView new]); 245 [webView1 loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; 246 [webView1 _test_waitForDidFinishNavigation]; 247 _WKSessionState *state = [webView1 _sessionState]; 248 249 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); 250 251 auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]); 252 auto webView2 = adoptNS([WKWebView new]); 253 [webView2 configuration].preferences.fraudulentWebsiteWarningEnabled = YES; 254 [webView2 setNavigationDelegate:delegate.get()]; 255 [webView2 setUIDelegate:delegate.get()]; 256 [webView2 _restoreSessionState:state andNavigate:YES]; 257 EXPECT_FALSE(warningShown); 258 while (![webView2 _safeBrowsingWarning]) 259 TestWebKitAPI::Util::spinRunLoop(); 260 EXPECT_TRUE(warningShown); 261 #if !PLATFORM(MAC) 262 [[webView2 _safeBrowsingWarning] didMoveToWindow]; 263 #endif 264 EXPECT_FALSE(didCloseCalled); 265 goBack([webView2 _safeBrowsingWarning]); 266 EXPECT_FALSE(didCloseCalled); 267 WKBackForwardList *list = [webView2 backForwardList]; 268 EXPECT_FALSE(!!list.backItem); 269 EXPECT_FALSE(!!list.forwardItem); 270 EXPECT_TRUE([list.currentItem.URL.path hasSuffix:@"/simple.html"]); 271 } 272 242 273 template<typename ViewType> void visitUnsafeSite(ViewType *view) 243 274 {
Note:
See TracChangeset
for help on using the changeset viewer.