WebKit Bugzilla
Attachment 339030 Details for
Bug 185066
: PSON: Triggering a navigation to an invalid URL creates a new WebContent process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-185066-20180427143121.patch (text/plain), 5.84 KB, created by
Ryosuke Niwa
on 2018-04-27 14:31:21 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-04-27 14:31:21 PDT
Size:
5.84 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 231086) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2018-04-26 Ryosuke Niwa <rniwa@webkit.org> >+ >+ PSON: Triggering a navigation to an invalid URL creates a new WebContent process >+ https://bugs.webkit.org/show_bug.cgi?id=185066 >+ >+ Reviewed by Youenn Fablet. >+ >+ Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid. >+ >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::processForNavigationInternal): >+ > 2018-04-26 Megan Gardner <megan_gardner@apple.com> > > Add timeout for ensurePositionInformationIsUpToDate >Index: Source/WebKit/UIProcess/WebProcessPool.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebProcessPool.cpp (revision 231086) >+++ Source/WebKit/UIProcess/WebProcessPool.cpp (working copy) >@@ -2096,7 +2096,7 @@ Ref<WebProcessProxy> WebProcessPool::pro > > auto targetURL = navigation.currentRequest().url(); > auto url = URL { ParsedURLString, page.pageLoadState().url() }; >- if (!url.isValid() || url.isEmpty() || url.isBlankURL() ||protocolHostAndPortAreEqual(url, targetURL)) >+ if (!url.isValid() || !targetURL.isValid() || url.isEmpty() || url.isBlankURL() || protocolHostAndPortAreEqual(url, targetURL)) > return page.process(); > > if (m_configuration->alwaysKeepAndReuseSwappedProcesses()) { >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 231086) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2018-04-26 Ryosuke Niwa <rniwa@webkit.org> >+ >+ PSON: Triggering a navigation to an invalid URL creates a new WebContent process >+ https://bugs.webkit.org/show_bug.cgi?id=185066 >+ >+ Reviewed by Youenn Fablet. >+ >+ Added a new test case (ProcessSwap.NavigateToInvalidURL) for navigating to an invalid URL. >+ WebKit should not swap WebContent process in this case. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: >+ (-[PSONNavigationDelegate webView:didFailProvisionalNavigation:withError:]): >+ (-[PSONUIDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): >+ > 2018-04-26 Ryan Haddad <ryanhaddad@apple.com> > > REGRESSION (r231039): RunUnitTests step reports disabled tests as failures >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (revision 231086) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (working copy) >@@ -54,10 +54,12 @@ > #if WK_API_ENABLED > > static bool done; >+static bool failed; > static bool didCreateWebView; > static int numberOfDecidePolicyCalls; > > static RetainPtr<NSMutableArray> receivedMessages = adoptNS([@[] mutableCopy]); >+bool didReceiveAlert; > static bool receivedMessage; > static bool serverRedirected; > static HashSet<pid_t> seenPIDs; >@@ -83,6 +85,12 @@ @interface PSONNavigationDelegate : NSOb > > @implementation PSONNavigationDelegate > >+- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error >+{ >+ seenPIDs.add([webView _webProcessIdentifier]); >+ failed = true; >+} >+ > - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation > { > seenPIDs.add([webView _webProcessIdentifier]); >@@ -131,6 +139,12 @@ - (nullable WKWebView *)webView:(WKWebVi > return createdWebView.get(); > } > >+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler >+{ >+ didReceiveAlert = true; >+ completionHandler(); >+} >+ > @end > > @interface PSONScheme : NSObject <WKURLSchemeHandler> { >@@ -1275,4 +1289,43 @@ TEST(ProcessSwap, ProcessReuse) > EXPECT_EQ(pid1, pid3); > } > >+static const char* navigateToInvalidURLTestBytes = R"PSONRESOURCE( >+<!DOCTYPE html> >+<html> >+<body onload="setTimeout(() => alert('DONE'), 0); location.href = 'http://A=a%B=b'"> >+)PSONRESOURCE"; >+ >+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()]; >+ RetainPtr<PSONScheme> 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://host/main1.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); >+} >+ > #endif // WK_API_ENABLED
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
rniwa
:
commit-queue+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185066
:
338966
|
338977
| 339030