Title: [275344] trunk/Tools
- Revision
- 275344
- Author
- [email protected]
- Date
- 2021-03-31 20:18:20 -0700 (Wed, 31 Mar 2021)
Log Message
Add API test for Bug 224022
https://bugs.webkit.org/show_bug.cgi?id=224024
Reviewed by Alex Christensen.
The way to reproduce the bug was to make sure that the NetworkProcessProxy was not associated
with any datastore at the time of the crash, then construct a new view and do a load, which
would hang.
If the NetworkProcessProxy was associated with a datastore and the WKWebSiteDataStore's
m_networkProcess was not null, then WebsiteDataStore::networkProcessCrashed() would take
care of calling `m_networkProcess->didTerminate()`, which would destroy the NetworkProcessProxy
singleton.
* TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (275343 => 275344)
--- trunk/Tools/ChangeLog 2021-04-01 02:55:07 UTC (rev 275343)
+++ trunk/Tools/ChangeLog 2021-04-01 03:18:20 UTC (rev 275344)
@@ -1,3 +1,22 @@
+2021-03-31 Chris Dumez <[email protected]>
+
+ Add API test for Bug 224022
+ https://bugs.webkit.org/show_bug.cgi?id=224024
+
+ Reviewed by Alex Christensen.
+
+ The way to reproduce the bug was to make sure that the NetworkProcessProxy was not associated
+ with any datastore at the time of the crash, then construct a new view and do a load, which
+ would hang.
+
+ If the NetworkProcessProxy was associated with a datastore and the WKWebSiteDataStore's
+ m_networkProcess was not null, then WebsiteDataStore::networkProcessCrashed() would take
+ care of calling `m_networkProcess->didTerminate()`, which would destroy the NetworkProcessProxy
+ singleton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm:
+ (TEST):
+
2021-03-31 Wenson Hsieh <[email protected]>
List of extents should be bounds-checked when iterating display list items
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm (275343 => 275344)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm 2021-04-01 02:55:07 UTC (rev 275343)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm 2021-04-01 03:18:20 UTC (rev 275344)
@@ -29,7 +29,9 @@
#import "TestWKWebView.h"
#import "Utilities.h"
#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/WKWebsiteDataStorePrivate.h>
+#import <WebKit/_WKWebsiteDataStoreConfiguration.h>
#import <wtf/BlockPtr.h>
#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
@@ -88,3 +90,33 @@
[[webView configuration].processPool _registerURLSchemeAsBypassingContentSecurityPolicy:@"test"];
EXPECT_FALSE([[webView configuration].websiteDataStore _networkProcessExists]);
}
+
+TEST(WebKit, NetworkProcessCrashWhenNotAssociatedWithDataStore)
+{
+ pid_t networkProcessPID = 0;
+ @autoreleasepool {
+ auto viewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ auto dataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] initNonPersistentConfiguration]);
+ auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()]);
+ [viewConfiguration setWebsiteDataStore:dataStore.get()];
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:viewConfiguration.get()]);
+ [webView loadHTMLString:@"foo" baseURL:[NSURL URLWithString:@"about:blank"]];
+ while (![dataStore _networkProcessIdentifier])
+ TestWebKitAPI::Util::spinRunLoop(10);
+ networkProcessPID = [dataStore _networkProcessIdentifier];
+ EXPECT_TRUE(!!networkProcessPID);
+ }
+ TestWebKitAPI::Util::spinRunLoop(10);
+
+ // Kill the network process once it is no longer associated with any WebsiteDataStore.
+ kill(networkProcessPID, 9);
+ TestWebKitAPI::Util::spinRunLoop(10);
+
+ auto viewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ auto dataStoreConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] initNonPersistentConfiguration]);
+ auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration.get()]);
+ [viewConfiguration setWebsiteDataStore:dataStore.get()];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:viewConfiguration.get()]);
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+ EXPECT_NE(networkProcessPID, [webView configuration].websiteDataStore._networkProcessIdentifier);
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes