Title: [243969] trunk
Revision
243969
Author
[email protected]
Date
2019-04-07 19:58:26 -0700 (Sun, 07 Apr 2019)

Log 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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (243968 => 243969)


--- trunk/Source/WebKit/ChangeLog	2019-04-07 23:31:01 UTC (rev 243968)
+++ trunk/Source/WebKit/ChangeLog	2019-04-08 02:58:26 UTC (rev 243969)
@@ -1,3 +1,19 @@
+2019-04-07  Commit Queue  <[email protected]>
+
+        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
+
 2019-04-07  Geoffrey Garen  <[email protected]>
 
         Remove stray byte added by r241131

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (243968 => 243969)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-04-07 23:31:01 UTC (rev 243968)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-04-08 02:58:26 UTC (rev 243969)
@@ -1355,19 +1355,12 @@
         auto strongSelf = weakSelf.get();
         if (!strongSelf)
             return;
-        bool navigatesFrame = WTF::switchOn(result,
+        bool navigatesMainFrame = WTF::switchOn(result,
             [] (WebKit::ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == WebKit::ContinueUnsafeLoad::Yes; },
             [] (const URL&) { return true; }
         );
-        bool forMainFrameNavigation = [strongSelf->_safeBrowsingWarning forMainFrameNavigation];
-        if (navigatesFrame && forMainFrameNavigation) {
-            // The safe browsing warning will be hidden once the next page is shown.
+        if (navigatesMainFrame && [strongSelf->_safeBrowsingWarning forMainFrameNavigation])
             return;
-        }
-        if (!navigatesFrame && strongSelf->_safeBrowsingWarning && !forMainFrameNavigation) {
-            [strongSelf goBack];
-            return;
-        }
         [std::exchange(strongSelf->_safeBrowsingWarning, nullptr) removeFromSuperview];
     }]);
     [self addSubview:_safeBrowsingWarning.get()];

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (243968 => 243969)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-04-07 23:31:01 UTC (rev 243968)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-04-08 02:58:26 UTC (rev 243969)
@@ -1587,19 +1587,12 @@
         completionHandler(WTFMove(result));
         if (!weakThis)
             return;
-        bool navigatesFrame = WTF::switchOn(result,
+        bool navigatesMainFrame = WTF::switchOn(result,
             [] (ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == ContinueUnsafeLoad::Yes; },
             [] (const URL&) { return true; }
         );
-        bool forMainFrameNavigation = [weakThis->m_safeBrowsingWarning forMainFrameNavigation];
-        if (navigatesFrame && forMainFrameNavigation) {
-            // The safe browsing warning will be hidden once the next page is shown.
+        if (navigatesMainFrame && [weakThis->m_safeBrowsingWarning forMainFrameNavigation])
             return;
-        }
-        if (!navigatesFrame && weakThis->m_safeBrowsingWarning && !forMainFrameNavigation) {
-            weakThis->m_page->goBack();
-            return;
-        }
         [std::exchange(weakThis->m_safeBrowsingWarning, nullptr) removeFromSuperview];
     }]);
     [m_view addSubview:m_safeBrowsingWarning.get()];

Modified: trunk/Tools/ChangeLog (243968 => 243969)


--- trunk/Tools/ChangeLog	2019-04-07 23:31:01 UTC (rev 243968)
+++ trunk/Tools/ChangeLog	2019-04-08 02:58:26 UTC (rev 243969)
@@ -1,3 +1,19 @@
+2019-04-07  Commit Queue  <[email protected]>
+
+        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
+
 2019-04-06  Ryosuke Niwa  <[email protected]>
 
         Added tests for WeakHashSet::computesEmpty and WeakHashSet::computeSize

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (243968 => 243969)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm	2019-04-07 23:31:01 UTC (rev 243968)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm	2019-04-08 02:58:26 UTC (rev 243969)
@@ -220,15 +220,12 @@
 }
 #endif
 
-template<typename ViewType> void goBack(ViewType *view, bool mainFrame = true)
+template<typename ViewType> void goBack(ViewType *view)
 {
     WKWebView *webView = (WKWebView *)view.superview;
     auto box = view.subviews.firstObject;
     checkTitleAndClick(box.subviews[3], "Go Back");
-    if (mainFrame)
-        EXPECT_EQ([webView _safeBrowsingWarning], nil);
-    else
-        EXPECT_NE([webView _safeBrowsingWarning], nil);
+    EXPECT_EQ([webView _safeBrowsingWarning], nil);
 }
 
 TEST(SafeBrowsing, GoBack)
@@ -371,16 +368,14 @@
     }
 }
 
-static RetainPtr<NSString> phishingResourceName;
-
-@interface SimpleLookupContext : NSObject
+@interface Simple3LookupContext : NSObject
 @end
 
-@implementation SimpleLookupContext
+@implementation Simple3LookupContext
 
-+ (SimpleLookupContext *)sharedLookupContext
++ (Simple3LookupContext *)sharedLookupContext
 {
-    static SimpleLookupContext *context = [[SimpleLookupContext alloc] init];
+    static Simple3LookupContext *context = [[Simple3LookupContext alloc] init];
     return context;
 }
 
@@ -387,7 +382,7 @@
 - (void)lookUpURL:(NSURL *)URL completionHandler:(void (^)(TestLookupResult *, NSError *))completionHandler
 {
     BOOL phishing = NO;
-    if ([URL isEqual:resourceURL(phishingResourceName.get())])
+    if ([URL isEqual:resourceURL(@"simple3")])
         phishing = YES;
     completionHandler([TestLookupResult resultWithResults:@[[TestServiceLookupResult resultWithProvider:@"TestProvider" phishing:phishing malware:NO unwantedSoftware:NO]]], nil);
 }
@@ -410,8 +405,7 @@
 
 TEST(SafeBrowsing, WKWebViewGoBack)
 {
-    phishingResourceName = @"simple3";
-    ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [SimpleLookupContext methodForSelector:@selector(sharedLookupContext)]);
+    ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [Simple3LookupContext methodForSelector:@selector(sharedLookupContext)]);
     
     auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]);
     auto webView = adoptNS([WKWebView new]);
@@ -433,27 +427,6 @@
     EXPECT_TRUE([[webView URL] isEqual:resourceURL(@"simple2")]);
 }
 
-TEST(SafeBrowsing, WKWebViewGoBackIFrame)
-{
-    phishingResourceName = @"simple";
-    ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [SimpleLookupContext methodForSelector:@selector(sharedLookupContext)]);
-    
-    auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]);
-    auto webView = adoptNS([WKWebView new]);
-    [webView configuration].preferences._safeBrowsingEnabled = YES;
-    [webView setNavigationDelegate:delegate.get()];
-    [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple2")]];
-    TestWebKitAPI::Util::run(&navigationFinished);
-    
-    [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple-iframe")]];
-    while (![webView _safeBrowsingWarning])
-        TestWebKitAPI::Util::spinRunLoop();
-    navigationFinished = false;
-    goBack([webView _safeBrowsingWarning], false);
-    TestWebKitAPI::Util::run(&navigationFinished);
-    EXPECT_TRUE([[webView URL] isEqual:resourceURL(@"simple2")]);
-}
-
 @interface NullLookupContext : NSObject
 @end
 @implementation NullLookupContext
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to