Changeset 261761 in webkit


Ignore:
Timestamp:
May 15, 2020 2:31:22 PM (4 years ago)
Author:
commit-queue@webkit.org
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 <achristensen@webkit.org> 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):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r261735 r261761  
     12020-05-15  Alex Christensen  <achristensen@webkit.org>
     2
     3        Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe
     4        https://bugs.webkit.org/show_bug.cgi?id=211449
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Always call clearPendingAPIRequest in WebPageProxy::didStartProvisionalLoadForFrameShared.
     9        r249142 regressed this and caused more "loading appears to continue forever" bugs fixed in r249890.
     10        This should fix both, by removing the problematic half of r249142.
     11
     12        Covered by an API test.
     13
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
     16
    1172020-05-15  Adrian Perez de Castro  <aperez@igalia.com>
    218
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r261727 r261761  
    44454445
    44464446    auto transaction = m_pageLoadState.transaction();
    4447     bool fromAlternateHTMLAPI = !unreachableURL.isEmpty() && unreachableURL == m_pageLoadState.pendingAPIRequestURL();
    4448     if (navigation || fromAlternateHTMLAPI)
    4449         m_pageLoadState.clearPendingAPIRequest(transaction);
     4447    m_pageLoadState.clearPendingAPIRequest(transaction);
    44504448
    44514449    if (frame->isMainFrame()) {
  • trunk/Tools/ChangeLog

    r261758 r261761  
     12020-05-15  Alex Christensen  <achristensen@webkit.org>
     2
     3        Regression (iOS 13.4, r249142): WKWebView.loading is never reset after a Back navigation in an iframe
     4        https://bugs.webkit.org/show_bug.cgi?id=211449
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
     9        (-[LoadingObserver changesObserved]):
     10        (-[LoadingObserver observeValueForKeyPath:ofObject:change:context:]):
     11        (TEST):
     12
    1132020-05-15  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm

    r260546 r261761  
    2626#import "config.h"
    2727
     28#import "HTTPServer.h"
     29#import "PlatformUtilities.h"
     30#import "Test.h"
     31#import "TestUIDelegate.h"
     32#import "TestURLSchemeHandler.h"
    2833#import <WebKit/WKBackForwardListPrivate.h>
    2934#import <WebKit/WKNavigationActionPrivate.h>
     
    3439#import <wtf/RetainPtr.h>
    3540#import <wtf/Vector.h>
    36 #import "PlatformUtilities.h"
    37 #import "Test.h"
    38 #import "TestURLSchemeHandler.h"
    3941
    4042static bool isDone;
     
    672674    TestWebKitAPI::Util::run(&isDone);
    673675}
     676
    674677#endif // PLATFORM(MAC)
     678
     679#if HAVE(NETWORK_FRAMEWORK)
     680
     681@interface LoadingObserver : NSObject
     682@property (nonatomic, readonly) size_t changesObserved;
     683@end
     684
     685@implementation LoadingObserver {
     686    size_t _changesObserved;
     687}
     688
     689- (size_t)changesObserved
     690{
     691    return _changesObserved;
     692}
     693
     694- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
     695{
     696    EXPECT_WK_STREQ(keyPath, "loading");
     697    _changesObserved++;
     698}
     699
     700@end
     701
     702TEST(WKNavigation, FrameBackLoading)
     703{
     704    using namespace TestWebKitAPI;
     705    HTTPServer server({
     706        { "/", { "<iframe src='frame1.html'></iframe>" } },
     707        { "/frame1.html", { "<a href='frame2.html'>link</a>" } },
     708        { "/frame2.html", { "<script>alert('frame2 loaded')</script>" } },
     709    });
     710    auto webView = [[WKWebView new] autorelease];
     711    auto delegate = [[TestUIDelegate new] autorelease];
     712    auto observer = [[LoadingObserver new] autorelease];
     713    webView.UIDelegate = delegate;
     714    [webView addObserver:observer forKeyPath:@"loading" options:NSKeyValueObservingOptionNew context:nil];
     715    EXPECT_FALSE(webView.loading);
     716    EXPECT_EQ(observer.changesObserved, 0u);
     717    [webView loadRequest:server.request()];
     718    EXPECT_TRUE(webView.loading);
     719    EXPECT_EQ(observer.changesObserved, 1u);
     720    while (observer.changesObserved < 2u)
     721        Util::spinRunLoop();
     722    EXPECT_FALSE(webView.loading);
     723    EXPECT_EQ(observer.changesObserved, 2u);
     724    EXPECT_FALSE(webView.canGoBack);
     725    [webView evaluateJavaScript:@"document.querySelector('iframe').contentWindow.document.querySelector('a').click()" completionHandler:nil];
     726    EXPECT_WK_STREQ([delegate waitForAlert], "frame2 loaded");
     727    EXPECT_EQ(observer.changesObserved, 2u);
     728    EXPECT_TRUE(webView.canGoBack);
     729    [webView goBack];
     730    while (observer.changesObserved < 3)
     731        Util::spinRunLoop();
     732    EXPECT_TRUE(webView.loading);
     733    while (observer.changesObserved < 4)
     734        Util::spinRunLoop();
     735    EXPECT_FALSE(webView.loading);
     736    [webView removeObserver:observer forKeyPath:@"loading"];
     737
     738}
     739
     740#endif // HAVE(NETWORK_FRAMEWORK)
Note: See TracChangeset for help on using the changeset viewer.