Title: [261761] trunk
Revision
261761
Author
[email protected]
Date
2020-05-15 14:31:22 -0700 (Fri, 15 May 2020)

Log Message

Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe
https://bugs.webkit.org/show_bug.cgi?id=211449

Patch by Alex Christensen <[email protected]> on 2020-05-15
Reviewed by Geoffrey Garen.

Source/WebKit:

Always call clearPendingAPIRequest in WebPageProxy::didStartProvisionalLoadForFrameShared.
r249142 regressed this and caused more "loading appears to continue forever" bugs fixed in r249890.
This should fix both, by removing the problematic half of r249142.

Covered by an API test.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
(-[LoadingObserver changesObserved]):
(-[LoadingObserver observeValueForKeyPath:ofObject:change:context:]):
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (261760 => 261761)


--- trunk/Source/WebKit/ChangeLog	2020-05-15 21:27:07 UTC (rev 261760)
+++ trunk/Source/WebKit/ChangeLog	2020-05-15 21:31:22 UTC (rev 261761)
@@ -1,3 +1,19 @@
+2020-05-15  Alex Christensen  <[email protected]>
+
+        Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe
+        https://bugs.webkit.org/show_bug.cgi?id=211449
+
+        Reviewed by Geoffrey Garen.
+
+        Always call clearPendingAPIRequest in WebPageProxy::didStartProvisionalLoadForFrameShared.
+        r249142 regressed this and caused more "loading appears to continue forever" bugs fixed in r249890.
+        This should fix both, by removing the problematic half of r249142.
+
+        Covered by an API test.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
+
 2020-05-15  Adrian Perez de Castro  <[email protected]>
 
         [GTK3] Bring back usage of GtkMenu for context menus

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (261760 => 261761)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-05-15 21:27:07 UTC (rev 261760)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-05-15 21:31:22 UTC (rev 261761)
@@ -4444,9 +4444,7 @@
     RELEASE_LOG_IF_ALLOWED(Loading, "didStartProvisionalLoadForFrame: frameID = %" PRIu64, frameID.toUInt64());
 
     auto transaction = m_pageLoadState.transaction();
-    bool fromAlternateHTMLAPI = !unreachableURL.isEmpty() && unreachableURL == m_pageLoadState.pendingAPIRequestURL();
-    if (navigation || fromAlternateHTMLAPI)
-        m_pageLoadState.clearPendingAPIRequest(transaction);
+    m_pageLoadState.clearPendingAPIRequest(transaction);
 
     if (frame->isMainFrame()) {
         process->didStartProvisionalLoadForMainFrame(url);

Modified: trunk/Tools/ChangeLog (261760 => 261761)


--- trunk/Tools/ChangeLog	2020-05-15 21:27:07 UTC (rev 261760)
+++ trunk/Tools/ChangeLog	2020-05-15 21:31:22 UTC (rev 261761)
@@ -1,3 +1,15 @@
+2020-05-15  Alex Christensen  <[email protected]>
+
+        Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe
+        https://bugs.webkit.org/show_bug.cgi?id=211449
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
+        (-[LoadingObserver changesObserved]):
+        (-[LoadingObserver observeValueForKeyPath:ofObject:change:context:]):
+        (TEST):
+
 2020-05-15  Chris Dumez  <[email protected]>
 
         Make sure we use current data store in WKTR's TestController

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm (261760 => 261761)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm	2020-05-15 21:27:07 UTC (rev 261760)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm	2020-05-15 21:31:22 UTC (rev 261761)
@@ -25,6 +25,11 @@
 
 #import "config.h"
 
+#import "HTTPServer.h"
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestUIDelegate.h"
+#import "TestURLSchemeHandler.h"
 #import <WebKit/WKBackForwardListPrivate.h>
 #import <WebKit/WKNavigationActionPrivate.h>
 #import <WebKit/WKNavigationDelegatePrivate.h>
@@ -33,9 +38,6 @@
 #import <WebKit/WKWebViewConfigurationPrivate.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/Vector.h>
-#import "PlatformUtilities.h"
-#import "Test.h"
-#import "TestURLSchemeHandler.h"
 
 static bool isDone;
 static RetainPtr<WKNavigation> currentNavigation;
@@ -671,4 +673,68 @@
     [[webView backForwardList] _removeAllItems];
     TestWebKitAPI::Util::run(&isDone);
 }
+
 #endif // PLATFORM(MAC)
+
+#if HAVE(NETWORK_FRAMEWORK)
+
+@interface LoadingObserver : NSObject
+@property (nonatomic, readonly) size_t changesObserved;
+@end
+
+@implementation LoadingObserver {
+    size_t _changesObserved;
+}
+
+- (size_t)changesObserved
+{
+    return _changesObserved;
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    EXPECT_WK_STREQ(keyPath, "loading");
+    _changesObserved++;
+}
+
+@end
+
+TEST(WKNavigation, FrameBackLoading)
+{
+    using namespace TestWebKitAPI;
+    HTTPServer server({
+        { "/", { "<iframe src=''></iframe>" } },
+        { "/frame1.html", { "<a href=''>link</a>" } },
+        { "/frame2.html", { "<script>alert('frame2 loaded')</script>" } },
+    });
+    auto webView = [[WKWebView new] autorelease];
+    auto delegate = [[TestUIDelegate new] autorelease];
+    auto observer = [[LoadingObserver new] autorelease];
+    webView.UIDelegate = delegate;
+    [webView addObserver:observer forKeyPath:@"loading" options:NSKeyValueObservingOptionNew context:nil];
+    EXPECT_FALSE(webView.loading);
+    EXPECT_EQ(observer.changesObserved, 0u);
+    [webView loadRequest:server.request()];
+    EXPECT_TRUE(webView.loading);
+    EXPECT_EQ(observer.changesObserved, 1u);
+    while (observer.changesObserved < 2u)
+        Util::spinRunLoop();
+    EXPECT_FALSE(webView.loading);
+    EXPECT_EQ(observer.changesObserved, 2u);
+    EXPECT_FALSE(webView.canGoBack);
+    [webView evaluateJavaScript:@"document.querySelector('iframe').contentWindow.document.querySelector('a').click()" completionHandler:nil];
+    EXPECT_WK_STREQ([delegate waitForAlert], "frame2 loaded");
+    EXPECT_EQ(observer.changesObserved, 2u);
+    EXPECT_TRUE(webView.canGoBack);
+    [webView goBack];
+    while (observer.changesObserved < 3)
+        Util::spinRunLoop();
+    EXPECT_TRUE(webView.loading);
+    while (observer.changesObserved < 4)
+        Util::spinRunLoop();
+    EXPECT_FALSE(webView.loading);
+    [webView removeObserver:observer forKeyPath:@"loading"];
+
+}
+
+#endif // HAVE(NETWORK_FRAMEWORK)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to