Bug 191660 - REGRESSION (r238115): [iOS] TestWebKitAPI.ProcessSwap.NavigateToInvalidURL is failing
Summary: REGRESSION (r238115): [iOS] TestWebKitAPI.ProcessSwap.NavigateToInvalidURL is...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-14 15:02 PST by Ryan Haddad
Modified: 2018-11-14 19:33 PST (History)
9 users (show)

See Also:


Attachments
Patch (4.17 KB, patch)
2018-11-14 16:24 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Haddad 2018-11-14 15:02:41 PST
Failed

    TestWebKitAPI.ProcessSwap.NavigateToInvalidURL
        Received data during response processing, queuing it.
        
        /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:2382
        Expected equality of these values:
          2
          numberOfDecidePolicyCalls
            Which is: 1

https://build.webkit.org/builders/Apple%20iOS%2012%20Simulator%20Release%20WK2%20%28Tests%29/builds/959/steps/run-api-tests/logs/stdio
Comment 1 Ryan Haddad 2018-11-14 15:06:37 PST
I think this regressed with https://trac.webkit.org/changeset/238115
Comment 2 Chris Dumez 2018-11-14 15:15:08 PST
TEST(ProcessSwap, NavigateToInvalidURL)
{
    auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
    processPoolConfiguration.get().processSwapsOnNavigation = YES;
    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);

    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
    [webViewConfiguration setProcessPool:processPool.get()];
    auto handler = adoptNS([[PSONScheme alloc] initWithBytes:navigateToInvalidURLTestBytes]);
    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];

    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
    auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
    [webView setNavigationDelegate:navigationDelegate.get()];
    auto uiDelegate = adoptNS([[PSONUIDelegate alloc] initWithNavigationDelegate:navigationDelegate.get()]);
    [webView setUIDelegate:uiDelegate.get()];

    numberOfDecidePolicyCalls = 0;
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]];
    TestWebKitAPI::Util::run(&done);
    done = false;
    auto pid1 = [webView _webProcessIdentifier];
    EXPECT_TRUE(!!pid1);

    TestWebKitAPI::Util::run(&didReceiveAlert);
    didReceiveAlert = false;
    auto pid2 = [webView _webProcessIdentifier];
    EXPECT_TRUE(!!pid2);

    EXPECT_EQ(2, numberOfDecidePolicyCalls);
    EXPECT_EQ(pid1, pid2);
}

Since the safe browsing check, we're getting one decidePolicyForNavigationAction call instead of 2. Previously there would be one for "pson://www.webkit.org/main.html" and presumably another one for the invalid URL load 'http://A=a%B=b'.

Alex?
Comment 3 Chris Dumez 2018-11-14 15:53:21 PST
(In reply to Chris Dumez from comment #2)
> TEST(ProcessSwap, NavigateToInvalidURL)
> {
>     auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration
> alloc] init]);
>     processPoolConfiguration.get().processSwapsOnNavigation = YES;
>     auto processPool = adoptNS([[WKProcessPool alloc]
> _initWithConfiguration:processPoolConfiguration.get()]);
> 
>     auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc]
> init]);
>     [webViewConfiguration setProcessPool:processPool.get()];
>     auto handler = adoptNS([[PSONScheme alloc]
> initWithBytes:navigateToInvalidURLTestBytes]);
>     [webViewConfiguration setURLSchemeHandler:handler.get()
> forURLScheme:@"PSON"];
> 
>     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0,
> 800, 600) configuration:webViewConfiguration.get()]);
>     auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
>     [webView setNavigationDelegate:navigationDelegate.get()];
>     auto uiDelegate = adoptNS([[PSONUIDelegate alloc]
> initWithNavigationDelegate:navigationDelegate.get()]);
>     [webView setUIDelegate:uiDelegate.get()];
> 
>     numberOfDecidePolicyCalls = 0;
>     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL
> URLWithString:@"pson://www.webkit.org/main.html"]]];
>     TestWebKitAPI::Util::run(&done);
>     done = false;
>     auto pid1 = [webView _webProcessIdentifier];
>     EXPECT_TRUE(!!pid1);
> 
>     TestWebKitAPI::Util::run(&didReceiveAlert);
>     didReceiveAlert = false;
>     auto pid2 = [webView _webProcessIdentifier];
>     EXPECT_TRUE(!!pid2);
> 
>     EXPECT_EQ(2, numberOfDecidePolicyCalls);
>     EXPECT_EQ(pid1, pid2);
> }
> 
> Since the safe browsing check, we're getting one
> decidePolicyForNavigationAction call instead of 2. Previously there would be
> one for "pson://www.webkit.org/main.html" and presumably another one for the
> invalid URL load 'http://A=a%B=b'.
> 
> Alex?

Oh, I think this is just a timing issue and the safe browsing check merely delayed things by a bit. I am investigate. Likely, I just need to write the test in a better way.
Comment 4 Chris Dumez 2018-11-14 16:24:51 PST
Created attachment 354868 [details]
Patch
Comment 5 WebKit Commit Bot 2018-11-14 19:32:39 PST
Comment on attachment 354868 [details]
Patch

Clearing flags on attachment: 354868

Committed r238216: <https://trac.webkit.org/changeset/238216>
Comment 6 WebKit Commit Bot 2018-11-14 19:32:41 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-11-14 19:33:36 PST
<rdar://problem/46084621>