Changeset 243969 in webkit
- Timestamp:
- Apr 7, 2019, 7:58:26 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243968 r243969 1 2019-04-07 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r243956. 4 https://bugs.webkit.org/show_bug.cgi?id=196688 5 6 Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested 7 by aakashjain on #webkit). 8 9 Reverted changeset: 10 11 "Clicking "Go Back" from a safe browsing warning from an 12 iframe should navigate the WKWebView back to the previous 13 page" 14 https://bugs.webkit.org/show_bug.cgi?id=196665 15 https://trac.webkit.org/changeset/243956 16 1 17 2019-04-07 Geoffrey Garen <ggaren@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r243968 r243969 1356 1356 if (!strongSelf) 1357 1357 return; 1358 bool navigates Frame = WTF::switchOn(result,1358 bool navigatesMainFrame = WTF::switchOn(result, 1359 1359 [] (WebKit::ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == WebKit::ContinueUnsafeLoad::Yes; }, 1360 1360 [] (const URL&) { return true; } 1361 1361 ); 1362 bool forMainFrameNavigation = [strongSelf->_safeBrowsingWarning forMainFrameNavigation]; 1363 if (navigatesFrame && forMainFrameNavigation) { 1364 // The safe browsing warning will be hidden once the next page is shown. 1362 if (navigatesMainFrame && [strongSelf->_safeBrowsingWarning forMainFrameNavigation]) 1365 1363 return; 1366 }1367 if (!navigatesFrame && strongSelf->_safeBrowsingWarning && !forMainFrameNavigation) {1368 [strongSelf goBack];1369 return;1370 }1371 1364 [std::exchange(strongSelf->_safeBrowsingWarning, nullptr) removeFromSuperview]; 1372 1365 }]); -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r243956 r243969 1588 1588 if (!weakThis) 1589 1589 return; 1590 bool navigates Frame = WTF::switchOn(result,1590 bool navigatesMainFrame = WTF::switchOn(result, 1591 1591 [] (ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == ContinueUnsafeLoad::Yes; }, 1592 1592 [] (const URL&) { return true; } 1593 1593 ); 1594 bool forMainFrameNavigation = [weakThis->m_safeBrowsingWarning forMainFrameNavigation]; 1595 if (navigatesFrame && forMainFrameNavigation) { 1596 // The safe browsing warning will be hidden once the next page is shown. 1594 if (navigatesMainFrame && [weakThis->m_safeBrowsingWarning forMainFrameNavigation]) 1597 1595 return; 1598 }1599 if (!navigatesFrame && weakThis->m_safeBrowsingWarning && !forMainFrameNavigation) {1600 weakThis->m_page->goBack();1601 return;1602 }1603 1596 [std::exchange(weakThis->m_safeBrowsingWarning, nullptr) removeFromSuperview]; 1604 1597 }]); -
trunk/Tools/ChangeLog
r243965 r243969 1 2019-04-07 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r243956. 4 https://bugs.webkit.org/show_bug.cgi?id=196688 5 6 Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested 7 by aakashjain on #webkit). 8 9 Reverted changeset: 10 11 "Clicking "Go Back" from a safe browsing warning from an 12 iframe should navigate the WKWebView back to the previous 13 page" 14 https://bugs.webkit.org/show_bug.cgi?id=196665 15 https://trac.webkit.org/changeset/243956 16 1 17 2019-04-06 Ryosuke Niwa <rniwa@webkit.org> 2 18 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm
r243956 r243969 221 221 #endif 222 222 223 template<typename ViewType> void goBack(ViewType *view , bool mainFrame = true)223 template<typename ViewType> void goBack(ViewType *view) 224 224 { 225 225 WKWebView *webView = (WKWebView *)view.superview; 226 226 auto box = view.subviews.firstObject; 227 227 checkTitleAndClick(box.subviews[3], "Go Back"); 228 if (mainFrame) 229 EXPECT_EQ([webView _safeBrowsingWarning], nil); 230 else 231 EXPECT_NE([webView _safeBrowsingWarning], nil); 228 EXPECT_EQ([webView _safeBrowsingWarning], nil); 232 229 } 233 230 … … 372 369 } 373 370 374 static RetainPtr<NSString> phishingResourceName; 375 376 @interface SimpleLookupContext : NSObject 377 @end 378 379 @implementation SimpleLookupContext 380 381 + (SimpleLookupContext *)sharedLookupContext 382 { 383 static SimpleLookupContext *context = [[SimpleLookupContext alloc] init]; 371 @interface Simple3LookupContext : NSObject 372 @end 373 374 @implementation Simple3LookupContext 375 376 + (Simple3LookupContext *)sharedLookupContext 377 { 378 static Simple3LookupContext *context = [[Simple3LookupContext alloc] init]; 384 379 return context; 385 380 } … … 388 383 { 389 384 BOOL phishing = NO; 390 if ([URL isEqual:resourceURL( phishingResourceName.get())])385 if ([URL isEqual:resourceURL(@"simple3")]) 391 386 phishing = YES; 392 387 completionHandler([TestLookupResult resultWithResults:@[[TestServiceLookupResult resultWithProvider:@"TestProvider" phishing:phishing malware:NO unwantedSoftware:NO]]], nil); … … 411 406 TEST(SafeBrowsing, WKWebViewGoBack) 412 407 { 413 phishingResourceName = @"simple3"; 414 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [SimpleLookupContext methodForSelector:@selector(sharedLookupContext)]); 408 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [Simple3LookupContext methodForSelector:@selector(sharedLookupContext)]); 415 409 416 410 auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]); … … 434 428 } 435 429 436 TEST(SafeBrowsing, WKWebViewGoBackIFrame)437 {438 phishingResourceName = @"simple";439 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [SimpleLookupContext methodForSelector:@selector(sharedLookupContext)]);440 441 auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]);442 auto webView = adoptNS([WKWebView new]);443 [webView configuration].preferences._safeBrowsingEnabled = YES;444 [webView setNavigationDelegate:delegate.get()];445 [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple2")]];446 TestWebKitAPI::Util::run(&navigationFinished);447 448 [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple-iframe")]];449 while (![webView _safeBrowsingWarning])450 TestWebKitAPI::Util::spinRunLoop();451 navigationFinished = false;452 goBack([webView _safeBrowsingWarning], false);453 TestWebKitAPI::Util::run(&navigationFinished);454 EXPECT_TRUE([[webView URL] isEqual:resourceURL(@"simple2")]);455 }456 457 430 @interface NullLookupContext : NSObject 458 431 @end
Note:
See TracChangeset
for help on using the changeset viewer.