Changeset 258272 in webkit


Ignore:
Timestamp:
Mar 11, 2020 12:34:01 PM (4 years ago)
Author:
Chris Dumez
Message:

Assertion hit under WebPageProxy::suspendCurrentPageIfPossible() when bypassing certificate warning page
https://bugs.webkit.org/show_bug.cgi?id=208927
<rdar://problem/55448331>

Reviewed by Alex Christensen.

Source/WebKit:

When suspending a previous page after a process-swap, we refuse to do the suspension if the currently
committed URL does not match the url of the current back/forward list item. This makes sense since we
will store the suspended page on the back/forward list item and restore that back when navigating back
to that item. I had a debug assertion in there to help me figure out how this could happen. It turns
out that calling loadAlternateHTML on the view will replace the content of the view with the provided
HTML string, update the committed URL but not create a new back/forward list item. This is so that
if you reload or go/back to this back/forward list item, we will attempt to load the original URL
again. This would however trip my assertion. I am therefore removing my debug assertion and adding API
test coverage.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::suspendCurrentPageIfPossible):

Tools:

Add API test coverage.

  • TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r258269 r258272  
     12020-03-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Assertion hit under WebPageProxy::suspendCurrentPageIfPossible() when bypassing certificate warning page
     4        https://bugs.webkit.org/show_bug.cgi?id=208927
     5        <rdar://problem/55448331>
     6
     7        Reviewed by Alex Christensen.
     8
     9        When suspending a previous page after a process-swap, we refuse to do the suspension if the currently
     10        committed URL does not match the url of the current back/forward list item. This makes sense since we
     11        will store the suspended page on the back/forward list item and restore that back when navigating back
     12        to that item. I had a debug assertion in there to help me figure out how this could happen. It turns
     13        out that calling loadAlternateHTML on the view will replace the content of the view with the provided
     14        HTML string, update the committed URL but not create a new back/forward list item. This is so that
     15        if you reload or go/back to this back/forward list item, we will attempt to load the original URL
     16        again. This would however trip my assertion. I am therefore removing my debug assertion and adding API
     17        test coverage.
     18
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
     21
    1222020-03-11  Alex Christensen  <achristensen@webkit.org>
    223
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r258247 r258272  
    833833    if (fromItem && fromItem->url() != pageLoadState().url()) {
    834834        RELEASE_LOG_ERROR_IF_ALLOWED(ProcessSwapping, "suspendCurrentPageIfPossible: Not suspending current page for process pid %i because fromItem's URL does not match the page URL.", m_process->processIdentifier());
    835         ASSERT_NOT_REACHED();
    836835        return false;
    837836    }
  • trunk/Tools/ChangeLog

    r258271 r258272  
     12020-03-11  Chris Dumez  <cdumez@apple.com>
     2
     3        Assertion hit under WebPageProxy::suspendCurrentPageIfPossible() when bypassing certificate warning page
     4        https://bugs.webkit.org/show_bug.cgi?id=208927
     5        <rdar://problem/55448331>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add API test coverage.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     12
    1132020-03-11  Diego Pino Garcia  <dpino@igalia.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r257359 r258272  
    62386238}
    62396239
     6240TEST(ProcessSwap, LoadAlternativeHTML)
     6241{
     6242    [[WKContentRuleListStore defaultStore] removeContentRuleListForIdentifier:@"ContentBlockingAfterProcessSwapExtension" completionHandler:^(NSError *error) {
     6243        done = true;
     6244    }];
     6245    TestWebKitAPI::Util::run(&done);
     6246    done = false;
     6247
     6248    auto processPoolConfiguration = psonProcessPoolConfiguration();
     6249    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     6250
     6251    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     6252    [webViewConfiguration setProcessPool:processPool.get()];
     6253    webViewConfiguration.get()._allowTopNavigationToDataURLs = YES;
     6254
     6255    RetainPtr<PSONMessageHandler> messageHandler = adoptNS([[PSONMessageHandler alloc] init]);
     6256    [[webViewConfiguration userContentController] addScriptMessageHandler:messageHandler.get() name:@"pson"];
     6257
     6258    __block bool doneCompiling = false;
     6259    [[WKContentRuleListStore defaultStore] compileContentRuleListForIdentifier:@"ContentBlockingAfterProcessSwapExtension" encodedContentRuleList:blockmeFilter completionHandler:^(WKContentRuleList *ruleList, NSError *error) {
     6260
     6261        EXPECT_NOT_NULL(ruleList);
     6262        EXPECT_NULL(error);
     6263
     6264        [webViewConfiguration.get().userContentController addContentRuleList:ruleList];
     6265
     6266        doneCompiling = true;
     6267    }];
     6268    TestWebKitAPI::Util::run(&doneCompiling);
     6269
     6270    auto handler = adoptNS([[PSONScheme alloc] init]);
     6271    [handler addMappingFromURLString:@"pson://www.apple.com/blockme.html" toData:notifyLoadedBytes];
     6272    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
     6273
     6274    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     6275    auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     6276    [webView setNavigationDelegate:delegate.get()];
     6277
     6278    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     6279    [webView loadRequest:request];
     6280    TestWebKitAPI::Util::run(&done);
     6281    done = false;
     6282
     6283    receivedMessage = false;
     6284    failed = false;
     6285    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/blockme.html"]];
     6286    [webView loadRequest:request];
     6287    TestWebKitAPI::Util::run(&failed);
     6288    failed = false;
     6289    EXPECT_FALSE(receivedMessage);
     6290
     6291    [webView _loadAlternateHTMLString:@"Blocked" baseURL:[NSURL URLWithString:@"foo:blockedWarning.html"] forUnreachableURL:[NSURL URLWithString:@"pson://www.apple.com/blockme.html"]];
     6292    TestWebKitAPI::Util::run(&done);
     6293    done = false;
     6294
     6295    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     6296    [webView loadRequest:request];
     6297    TestWebKitAPI::Util::run(&done);
     6298    done = false;
     6299}
     6300
    62406301static bool isCapturing = false;
    62416302@interface GetUserMediaUIDelegate : NSObject<WKUIDelegate>
Note: See TracChangeset for help on using the changeset viewer.