Diff
Modified: trunk/Source/WebKit/ChangeLog (242974 => 242975)
--- trunk/Source/WebKit/ChangeLog 2019-03-14 23:04:18 UTC (rev 242974)
+++ trunk/Source/WebKit/ChangeLog 2019-03-14 23:08:27 UTC (rev 242975)
@@ -1,3 +1,20 @@
+2019-03-14 Youenn Fablet <[email protected]>
+
+ Move IDB storage in private browsing mode to NetworkProcess
+ https://bugs.webkit.org/show_bug.cgi?id=195602
+
+ Reviewed by Brady Eidson.
+
+ Covered by existing IDB tests and added API test.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::createIDBServer):
+ Make sure that path is empty for private sessions.
+ This will make IDB use a memory backing store.
+ * WebProcess/Databases/WebDatabaseProvider.cpp:
+ (WebKit::WebDatabaseProvider::idbConnectionToServerForSession):
+ Use NetworkProcess IDB server instead of InProcessIDBServer.
+
2019-03-14 Wenson Hsieh <[email protected]>
REGRESSION (r242801): [iOS] preventDefault() on touchstart in a subframe does not prevent focusing the subframe
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (242974 => 242975)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-03-14 23:04:18 UTC (rev 242974)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-03-14 23:08:27 UTC (rev 242975)
@@ -2052,10 +2052,11 @@
#if ENABLE(INDEXED_DATABASE)
Ref<IDBServer::IDBServer> NetworkProcess::createIDBServer(PAL::SessionID sessionID)
{
- auto path = m_idbDatabasePaths.get(sessionID);
- // There should already be a registered path for this PAL::SessionID.
- // If there's not, then where did this PAL::SessionID come from?
- ASSERT(!path.isEmpty());
+ String path;
+ if (!sessionID.isEphemeral()) {
+ ASSERT(m_idbDatabasePaths.contains(sessionID));
+ path = m_idbDatabasePaths.get(sessionID);
+ }
auto server = IDBServer::IDBServer::create(sessionID, path, *this, [this, weakThis = makeWeakPtr(this)](PAL::SessionID sessionID, const auto& origin) -> StorageQuotaManager* {
if (!weakThis)
Modified: trunk/Source/WebKit/WebProcess/Databases/WebDatabaseProvider.cpp (242974 => 242975)
--- trunk/Source/WebKit/WebProcess/Databases/WebDatabaseProvider.cpp 2019-03-14 23:04:18 UTC (rev 242974)
+++ trunk/Source/WebKit/WebProcess/Databases/WebDatabaseProvider.cpp 2019-03-14 23:08:27 UTC (rev 242975)
@@ -69,14 +69,6 @@
#if ENABLE(INDEXED_DATABASE)
WebCore::IDBClient::IDBConnectionToServer& WebDatabaseProvider::idbConnectionToServerForSession(const PAL::SessionID& sessionID)
{
- if (sessionID.isEphemeral()) {
- auto result = m_idbEphemeralConnectionMap.add(sessionID.sessionID(), nullptr);
- if (result.isNewEntry)
- result.iterator->value = WebCore::InProcessIDBServer::create(sessionID);
-
- return result.iterator->value->connectionToServer();
- }
-
return WebProcess::singleton().ensureNetworkProcessConnection().idbConnectionToServerForSession(sessionID).coreConnectionToServer();
}
#endif
Modified: trunk/Source/WebKit/WebProcess/Databases/WebDatabaseProvider.h (242974 => 242975)
--- trunk/Source/WebKit/WebProcess/Databases/WebDatabaseProvider.h 2019-03-14 23:04:18 UTC (rev 242974)
+++ trunk/Source/WebKit/WebProcess/Databases/WebDatabaseProvider.h 2019-03-14 23:08:27 UTC (rev 242975)
@@ -44,10 +44,6 @@
private:
explicit WebDatabaseProvider(uint64_t identifier);
-#if ENABLE(INDEXED_DATABASE)
- HashMap<uint64_t, RefPtr<WebCore::InProcessIDBServer>> m_idbEphemeralConnectionMap;
-#endif
-
const uint64_t m_identifier;
};
Modified: trunk/Tools/ChangeLog (242974 => 242975)
--- trunk/Tools/ChangeLog 2019-03-14 23:04:18 UTC (rev 242974)
+++ trunk/Tools/ChangeLog 2019-03-14 23:08:27 UTC (rev 242975)
@@ -1,3 +1,13 @@
+2019-03-14 Youenn Fablet <[email protected]>
+
+ Move IDB storage in private browsing mode to NetworkProcess
+ https://bugs.webkit.org/show_bug.cgi?id=195602
+
+ Reviewed by Brady Eidson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/IndexedDBPersistence.mm:
+ (TEST):
+
2019-03-14 Aakash Jain <[email protected]>
[ews-build] Make descriptionDone messages more readable
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBPersistence.mm (242974 => 242975)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBPersistence.mm 2019-03-14 23:04:18 UTC (rev 242974)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBPersistence.mm 2019-03-14 23:08:27 UTC (rev 242975)
@@ -31,6 +31,7 @@
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKUserContentControllerPrivate.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/_WKProcessPoolConfiguration.h>
#import <WebKit/_WKUserStyleSheet.h>
#import <wtf/RetainPtr.h>
@@ -92,6 +93,50 @@
EXPECT_WK_STREQ(@"2 TestObjectStore", string3.get());
}
+TEST(IndexedDB, IndexedDBPersistencePrivate)
+{
+ RetainPtr<IndexedDBMessageHandler> handler = adoptNS([[IndexedDBMessageHandler alloc] init]);
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"];
+
+ auto ephemeralStore = [WKWebsiteDataStore nonPersistentDataStore];
+ configuration.get().websiteDataStore = ephemeralStore;
+
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"IndexedDBPersistence-1" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string1 = (NSString *)[lastScriptMessage body];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string2 = (NSString *)[lastScriptMessage body];
+
+ auto webViewPid1 = [webView _webProcessIdentifier];
+ // Ditch this web view (ditching its web process)
+ webView = nil;
+
+ // Make a new web view to finish the test
+ webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"IndexedDBPersistence-2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string3 = (NSString *)[lastScriptMessage body];
+
+ auto webViewPid2 = [webView _webProcessIdentifier];
+ EXPECT_NE(webViewPid1, webViewPid2);
+
+ EXPECT_WK_STREQ(@"UpgradeNeeded", string1.get());
+ EXPECT_WK_STREQ(@"Success", string2.get());
+ EXPECT_WK_STREQ(@"2 TestObjectStore", string3.get());
+}
+
TEST(IndexedDB, IndexedDBDataRemoval)
{
auto websiteDataTypes = adoptNS([[NSSet alloc] initWithArray:@[WKWebsiteDataTypeIndexedDBDatabases]]);