Changeset 238368 in webkit


Ignore:
Timestamp:
Nov 18, 2018 11:14:51 PM (5 years ago)
Author:
Chris Dumez
Message:

[PSON] Received an invalid message "WebPageProxy.DidPerformClientRedirect" from the web process
https://bugs.webkit.org/show_bug.cgi?id=191828

Reviewed by Antti Koivisto.

Source/WebKit:

WebPageProxy::didPerformClientRedirect() had a MESSAGE_CHECK_URL() for both the source
and the destination URL. The macro calls WebProcessProxy::checkURLReceivedFromWebProcess()
to make sure that both URLs were actually loaded by this WebContent process.

However, now that we're enabled process-swap on cross-site navigation, these checks are no
longer fully valid. If the client-side redirect is cross-site, then the source and destination
URLs get loaded by 2 different WebContent processes. Since didPerformClientRedirect() gets
called after the redirect and gets set by the new WebContent process, only the destination URL
is guaranteed to have been loaded by this process. The source URL may have been loaded in
another process so this patch drops the message check for the source URL.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didPerformClientRedirect):

Tools:

Add API test coverage.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
  • TestWebKitAPI/Tests/WebKitCocoa/client-side-redirect.html: Added.
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238361 r238368  
     12018-11-18  Chris Dumez  <cdumez@apple.com>
     2
     3        [PSON] Received an invalid message "WebPageProxy.DidPerformClientRedirect" from the web process
     4        https://bugs.webkit.org/show_bug.cgi?id=191828
     5
     6        Reviewed by Antti Koivisto.
     7
     8        WebPageProxy::didPerformClientRedirect() had a MESSAGE_CHECK_URL() for both the source
     9        and the destination URL. The macro calls WebProcessProxy::checkURLReceivedFromWebProcess()
     10        to make sure that both URLs were actually loaded by this WebContent process.
     11
     12        However, now that we're enabled process-swap on cross-site navigation, these checks are no
     13        longer fully valid. If the client-side redirect is cross-site, then the source and destination
     14        URLs get loaded by 2 different WebContent processes. Since didPerformClientRedirect() gets
     15        called after the redirect and gets set by the new WebContent process, only the destination URL
     16        is guaranteed to have been loaded by this process. The source URL may have been loaded in
     17        another process so this patch drops the message check for the source URL.
     18
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::didPerformClientRedirect):
     21
    1222018-11-18  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    223
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r238358 r238368  
    44434443    MESSAGE_CHECK(frame);
    44444444    MESSAGE_CHECK(frame->page() == this);
    4445 
    4446     MESSAGE_CHECK_URL(sourceURLString);
    44474445    MESSAGE_CHECK_URL(destinationURLString);
    44484446
  • trunk/Tools/ChangeLog

    r238360 r238368  
     12018-11-18  Chris Dumez  <cdumez@apple.com>
     2
     3        [PSON] Received an invalid message "WebPageProxy.DidPerformClientRedirect" from the web process
     4        https://bugs.webkit.org/show_bug.cgi?id=191828
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Add API test coverage.
     9
     10        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     11        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     12        * TestWebKitAPI/Tests/WebKitCocoa/client-side-redirect.html: Added.
     13
    1142018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r238306 r238368  
    588588                83779C381F82FECE007CDA8A /* VisitedLinkStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */; };
    589589                837A35F11D9A1E7D00663C57 /* DownloadRequestBlobURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */; };
     590                839AA35F21A26B0300980DD6 /* client-side-redirect.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 839AA35E21A26ACD00980DD6 /* client-side-redirect.html */; };
    590591                83B6DE6F1EE75221001E792F /* RestoreSessionState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83B6DE6E1EE7520F001E792F /* RestoreSessionState.cpp */; };
    591592                83BAEE8D1EF4625500DDE894 /* PluginLoadClientPolicies.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BAEE8C1EF4625500DDE894 /* PluginLoadClientPolicies.mm */; };
     
    9991000                                2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */,
    10001001                                9BD4239C1E04C01C00200395 /* chinese-character-with-image.html in Copy Resources */,
     1002                                839AA35F21A26B0300980DD6 /* client-side-redirect.html in Copy Resources */,
    10011003                                1A50AA201A2A51FC00F4C345 /* close-from-within-create-page.html in Copy Resources */,
    10021004                                9B270FEE1DDC2C0B002D53F3 /* closed-shadow-tree-test.html in Copy Resources */,
     
    17371739                83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VisitedLinkStore.mm; sourceTree = "<group>"; };
    17381740                837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestBlobURL.html; sourceTree = "<group>"; };
     1741                839AA35E21A26ACD00980DD6 /* client-side-redirect.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "client-side-redirect.html"; sourceTree = "<group>"; };
    17391742                83B6DE6E1EE7520F001E792F /* RestoreSessionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestoreSessionState.cpp; sourceTree = "<group>"; };
    17401743                83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserIdioms.cpp; sourceTree = "<group>"; };
     
    27212724                                2EFF06C41D8867700004BB30 /* change-video-source-on-click.html */,
    27222725                                2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */,
     2726                                839AA35E21A26ACD00980DD6 /* client-side-redirect.html */,
    27232727                                E5036F77211BC22800BFDBE2 /* color-drop.html */,
    27242728                                F4B825D61EF4DBD4006E417F /* compressed-files.zip */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r238356 r238368  
    14581458}
    14591459
     1460TEST(ProcessSwap, CrossSiteClientSideRedirectFromFileURL)
     1461{
     1462    auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
     1463    processPoolConfiguration.get().processSwapsOnNavigation = YES;
     1464    processPoolConfiguration.get().prewarmsProcessesAutomatically = YES;
     1465    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     1466
     1467    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     1468    [webViewConfiguration setProcessPool:processPool.get()];
     1469    auto handler = adoptNS([[PSONScheme alloc] init]);
     1470    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];
     1471
     1472    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     1473    auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     1474    [webView setNavigationDelegate:delegate.get()];
     1475
     1476    willPerformClientRedirect = false;
     1477    didPerformClientRedirect = false;
     1478
     1479    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"client-side-redirect" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
     1480    [webView loadRequest:request];
     1481
     1482    TestWebKitAPI::Util::run(&done);
     1483    done = false;
     1484
     1485    auto pid1 = [webView _webProcessIdentifier];
     1486
     1487    TestWebKitAPI::Util::run(&done);
     1488    done = false;
     1489
     1490    auto pid2 = [webView _webProcessIdentifier];
     1491    EXPECT_NE(pid1, pid2);
     1492
     1493    EXPECT_EQ(2U, [processPool _webProcessCountIgnoringPrewarmed]);
     1494    EXPECT_TRUE(willPerformClientRedirect);
     1495    EXPECT_TRUE(didPerformClientRedirect);
     1496}
     1497
    14601498static void runNavigationWithLockedHistoryTest(ShouldEnablePSON shouldEnablePSON)
    14611499{
Note: See TracChangeset for help on using the changeset viewer.