Title: [243320] trunk
- Revision
- 243320
- Author
- [email protected]
- Date
- 2019-03-21 13:31:19 -0700 (Thu, 21 Mar 2019)
Log Message
WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
https://bugs.webkit.org/show_bug.cgi?id=196041
<rdar://problem/49083230>
Reviewed by Alex Christensen.
Source/WebKit:
WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
We do not support having several WebsiteDataStores sharing the same WebProcess.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage):
Tools:
Add API test coverage.
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewConfiguration.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (243319 => 243320)
--- trunk/Source/WebKit/ChangeLog 2019-03-21 20:23:46 UTC (rev 243319)
+++ trunk/Source/WebKit/ChangeLog 2019-03-21 20:31:19 UTC (rev 243320)
@@ -1,3 +1,19 @@
+2019-03-21 Chris Dumez <[email protected]>
+
+ WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
+ https://bugs.webkit.org/show_bug.cgi?id=196041
+ <rdar://problem/49083230>
+
+ Reviewed by Alex Christensen.
+
+ WebKit should throw when trying to create a WKWebView with a related view that is using a different data store.
+ We do not support having several WebsiteDataStores sharing the same WebProcess.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::createWebPage):
+
2019-03-21 Alex Christensen <[email protected]>
Add SPI to inform applications of WKContentRuleList actions
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (243319 => 243320)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-03-21 20:23:46 UTC (rev 243319)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-03-21 20:31:19 UTC (rev 243320)
@@ -552,6 +552,8 @@
WKProcessPool *relatedWebViewProcessPool = [relatedWebView->_configuration processPool];
if (processPool && processPool != relatedWebViewProcessPool)
[NSException raise:NSInvalidArgumentException format:@"Related web view %@ has process pool %@ but configuration specifies a different process pool %@", relatedWebView, relatedWebViewProcessPool, configuration.processPool];
+ if ([relatedWebView->_configuration websiteDataStore] != [_configuration websiteDataStore])
+ [NSException raise:NSInvalidArgumentException format:@"Related web view %@ has data store %@ but configuration specifies a different data store %@", relatedWebView, [relatedWebView->_configuration websiteDataStore], [_configuration websiteDataStore]];
[_configuration setProcessPool:relatedWebViewProcessPool];
}
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (243319 => 243320)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-21 20:23:46 UTC (rev 243319)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-21 20:31:19 UTC (rev 243320)
@@ -1215,6 +1215,9 @@
if (pageConfiguration->relatedPage()) {
// Sharing processes, e.g. when creating the page via window.open().
process = &pageConfiguration->relatedPage()->process();
+ // We do not support several WebsiteDataStores sharing a single process.
+ ASSERT(process.get() == m_dummyProcessProxy || &pageConfiguration->websiteDataStore()->websiteDataStore() == &process->websiteDataStore());
+ ASSERT(&pageConfiguration->relatedPage()->websiteDataStore() == &pageConfiguration->websiteDataStore()->websiteDataStore());
} else if (WebKit::isInspectorProcessPool(*this)) {
// Do not delay process launch for inspector pages as inspector pages do not know how to transition from a terminated process.
process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { });
Modified: trunk/Tools/ChangeLog (243319 => 243320)
--- trunk/Tools/ChangeLog 2019-03-21 20:23:46 UTC (rev 243319)
+++ trunk/Tools/ChangeLog 2019-03-21 20:31:19 UTC (rev 243320)
@@ -1,3 +1,16 @@
+2019-03-21 Chris Dumez <[email protected]>
+
+ WebKit should throw when trying to create a WKWebView with a related view that is using a different data store
+ https://bugs.webkit.org/show_bug.cgi?id=196041
+ <rdar://problem/49083230>
+
+ Reviewed by Alex Christensen.
+
+ Add API test coverage.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewConfiguration.mm:
+ (TEST):
+
2019-03-21 Alex Christensen <[email protected]>
Add SPI to inform applications of WKContentRuleList actions
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewConfiguration.mm (243319 => 243320)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewConfiguration.mm 2019-03-21 20:23:46 UTC (rev 243319)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewConfiguration.mm 2019-03-21 20:31:19 UTC (rev 243320)
@@ -28,6 +28,7 @@
#import "PlatformUtilities.h"
#import <WebKit/WKWebView.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebsiteDataStore.h>
#import <wtf/Function.h>
#import <wtf/RetainPtr.h>
@@ -62,6 +63,14 @@
[configuration _setVisitedLinkStore:nil];
});
#pragma clang diagnostic pop
+
+ // Related WebViews cannot use different data stores.
+ auto configurationForEphemeralView = adoptNS([[WKWebViewConfiguration alloc] init]);
+ configurationForEphemeralView.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
+ auto ephemeralWebView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configurationForEphemeralView.get()]);
+ shouldThrowExceptionWhenUsed([&](WKWebViewConfiguration *configuration) {
+ [configuration _setRelatedWebView:ephemeralWebView.get()];
+ });
}
TEST(WebKit, ConfigurationGroupIdentifierIsCopied)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes