⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243969 in webkit


Ignore:
Timestamp:
Apr 7, 2019, 7:58:26 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r243956.
https://bugs.webkit.org/show_bug.cgi?id=196688

Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
by aakashjain on #webkit).

Reverted changeset:

"Clicking "Go Back" from a safe browsing warning from an
iframe should navigate the WKWebView back to the previous
page"
https://bugs.webkit.org/show_bug.cgi?id=196665
https://trac.webkit.org/changeset/243956

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243968 r243969  
     12019-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
    1172019-04-07  Geoffrey Garen  <ggaren@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r243968 r243969  
    13561356        if (!strongSelf)
    13571357            return;
    1358         bool navigatesFrame = WTF::switchOn(result,
     1358        bool navigatesMainFrame = WTF::switchOn(result,
    13591359            [] (WebKit::ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == WebKit::ContinueUnsafeLoad::Yes; },
    13601360            [] (const URL&) { return true; }
    13611361        );
    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])
    13651363            return;
    1366         }
    1367         if (!navigatesFrame && strongSelf->_safeBrowsingWarning && !forMainFrameNavigation) {
    1368             [strongSelf goBack];
    1369             return;
    1370         }
    13711364        [std::exchange(strongSelf->_safeBrowsingWarning, nullptr) removeFromSuperview];
    13721365    }]);
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm

    r243956 r243969  
    15881588        if (!weakThis)
    15891589            return;
    1590         bool navigatesFrame = WTF::switchOn(result,
     1590        bool navigatesMainFrame = WTF::switchOn(result,
    15911591            [] (ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == ContinueUnsafeLoad::Yes; },
    15921592            [] (const URL&) { return true; }
    15931593        );
    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])
    15971595            return;
    1598         }
    1599         if (!navigatesFrame && weakThis->m_safeBrowsingWarning && !forMainFrameNavigation) {
    1600             weakThis->m_page->goBack();
    1601             return;
    1602         }
    16031596        [std::exchange(weakThis->m_safeBrowsingWarning, nullptr) removeFromSuperview];
    16041597    }]);
  • trunk/Tools/ChangeLog

    r243965 r243969  
     12019-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
    1172019-04-06  Ryosuke Niwa  <rniwa@webkit.org>
    218
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm

    r243956 r243969  
    221221#endif
    222222
    223 template<typename ViewType> void goBack(ViewType *view, bool mainFrame = true)
     223template<typename ViewType> void goBack(ViewType *view)
    224224{
    225225    WKWebView *webView = (WKWebView *)view.superview;
    226226    auto box = view.subviews.firstObject;
    227227    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);
    232229}
    233230
     
    372369}
    373370
    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];
    384379    return context;
    385380}
     
    388383{
    389384    BOOL phishing = NO;
    390     if ([URL isEqual:resourceURL(phishingResourceName.get())])
     385    if ([URL isEqual:resourceURL(@"simple3")])
    391386        phishing = YES;
    392387    completionHandler([TestLookupResult resultWithResults:@[[TestServiceLookupResult resultWithProvider:@"TestProvider" phishing:phishing malware:NO unwantedSoftware:NO]]], nil);
     
    411406TEST(SafeBrowsing, WKWebViewGoBack)
    412407{
    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)]);
    415409   
    416410    auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]);
     
    434428}
    435429
    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 
    457430@interface NullLookupContext : NSObject
    458431@end
Note: See TracChangeset for help on using the changeset viewer.