Diff
Modified: trunk/Source/WebCore/ChangeLog (202358 => 202359)
--- trunk/Source/WebCore/ChangeLog 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebCore/ChangeLog 2016-06-22 23:46:05 UTC (rev 202359)
@@ -1,3 +1,26 @@
+2016-06-22 Brady Eidson <[email protected]>
+
+ DatabaseProcess doesn't handle WebProcesses going away uncleanly.
+ https://bugs.webkit.org/show_bug.cgi?id=158894
+
+ Reviewed by Alex Christensen.
+
+ No new tests (Covered by additions to existing API test).
+
+ * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+ (WebCore::IDBServer::IDBConnectionToClient::registerDatabaseConnection):
+ (WebCore::IDBServer::IDBConnectionToClient::unregisterDatabaseConnection):
+ (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
+ * Modules/indexeddb/server/IDBConnectionToClient.h:
+
+ * Modules/indexeddb/server/IDBServer.cpp:
+ (WebCore::IDBServer::IDBServer::unregisterConnection): Call connectionToClientClosed() on
+ the connection, which cleans up after it in the server.
+
+ * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
+ (WebCore::IDBServer::UniqueIDBDatabaseConnection::~UniqueIDBDatabaseConnection):
+
2016-06-22 Benjamin Poulain <[email protected]>
AX: Add support for CSS4 :focus-within pseudo
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (202358 => 202359)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp 2016-06-22 23:46:05 UTC (rev 202359)
@@ -148,6 +148,29 @@
m_delegate->didGetAllDatabaseNames(callbackID, databaseNames);
}
+void IDBConnectionToClient::registerDatabaseConnection(UniqueIDBDatabaseConnection& connection)
+{
+ ASSERT(!m_databaseConnections.contains(&connection));
+ m_databaseConnections.add(&connection);
+}
+
+void IDBConnectionToClient::unregisterDatabaseConnection(UniqueIDBDatabaseConnection& connection)
+{
+ m_databaseConnections.remove(&connection);
+}
+
+void IDBConnectionToClient::connectionToClientClosed()
+{
+ auto databaseConnections = m_databaseConnections;
+
+ for (auto connection : databaseConnections) {
+ if (m_databaseConnections.contains(connection))
+ connection->connectionClosedFromClient();
+ }
+
+ m_databaseConnections.clear();
+}
+
} // namespace IDBServer
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (202358 => 202359)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h 2016-06-22 23:46:05 UTC (rev 202359)
@@ -29,6 +29,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "IDBConnectionToClientDelegate.h"
+#include <wtf/HashSet.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
@@ -72,10 +73,15 @@
void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames);
+ void registerDatabaseConnection(UniqueIDBDatabaseConnection&);
+ void unregisterDatabaseConnection(UniqueIDBDatabaseConnection&);
+ void connectionToClientClosed();
+
private:
IDBConnectionToClient(IDBConnectionToClientDelegate&);
Ref<IDBConnectionToClientDelegate> m_delegate;
+ HashSet<UniqueIDBDatabaseConnection*> m_databaseConnections;
};
} // namespace IDBServer
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (202358 => 202359)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2016-06-22 23:46:05 UTC (rev 202359)
@@ -80,6 +80,8 @@
ASSERT(m_connectionMap.contains(connection.identifier()));
ASSERT(m_connectionMap.get(connection.identifier()) == &connection);
+ connection.connectionToClientClosed();
+
m_connectionMap.remove(connection.identifier());
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (202358 => 202359)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp 2016-06-22 23:46:05 UTC (rev 202359)
@@ -56,11 +56,13 @@
, m_openRequestIdentifier(request.requestData().requestIdentifier())
{
m_database.server().registerDatabaseConnection(*this);
+ m_connectionToClient.registerDatabaseConnection(*this);
}
UniqueIDBDatabaseConnection::~UniqueIDBDatabaseConnection()
{
m_database.server().unregisterDatabaseConnection(*this);
+ m_connectionToClient.unregisterDatabaseConnection(*this);
}
bool UniqueIDBDatabaseConnection::hasNonFinishedTransactions() const
Modified: trunk/Source/WebKit2/ChangeLog (202358 => 202359)
--- trunk/Source/WebKit2/ChangeLog 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-22 23:46:05 UTC (rev 202359)
@@ -1,3 +1,18 @@
+2016-06-22 Brady Eidson <[email protected]>
+
+ DatabaseProcess doesn't handle WebProcesses going away uncleanly.
+ https://bugs.webkit.org/show_bug.cgi?id=158894
+
+ Reviewed by Alex Christensen.
+
+ * DatabaseProcess/DatabaseToWebProcessConnection.cpp:
+ (WebKit::DatabaseToWebProcessConnection::didClose):
+
+ * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
+ (WebKit::WebIDBConnectionToClient::disconnectedFromWebProcess): Actually unregister this connection
+ from the IDBServer so it can clean up.
+ (WebKit::WebIDBConnectionToClient::~WebIDBConnectionToClient):
+
2016-06-22 Chris Dumez <[email protected]>
Stop using PassRefPtr in ShareableResource
Modified: trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp (202358 => 202359)
--- trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebKit2/DatabaseProcess/DatabaseToWebProcessConnection.cpp 2016-06-22 23:46:05 UTC (rev 202359)
@@ -85,7 +85,11 @@
void DatabaseToWebProcessConnection::didClose(IPC::Connection&)
{
#if ENABLE(INDEXED_DATABASE)
- // FIXME: (Modern IDB) The WebProcess has disconnected, close all of the connections associated with it
+ auto connections = m_webIDBConnections;
+ for (auto& connection : connections.values())
+ connection->disconnectedFromWebProcess();
+
+ m_webIDBConnections.clear();
#endif
}
Modified: trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp (202358 => 202359)
--- trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp 2016-06-22 23:46:05 UTC (rev 202359)
@@ -58,11 +58,11 @@
WebIDBConnectionToClient::~WebIDBConnectionToClient()
{
- DatabaseProcess::singleton().idbServer().unregisterConnection(*m_connectionToClient);
}
void WebIDBConnectionToClient::disconnectedFromWebProcess()
{
+ DatabaseProcess::singleton().idbServer().unregisterConnection(*m_connectionToClient);
}
IPC::Connection* WebIDBConnectionToClient::messageSenderConnection()
Modified: trunk/Tools/ChangeLog (202358 => 202359)
--- trunk/Tools/ChangeLog 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Tools/ChangeLog 2016-06-22 23:46:05 UTC (rev 202359)
@@ -1,3 +1,15 @@
+2016-06-22 Brady Eidson <[email protected]>
+
+ DatabaseProcess doesn't handle WebProcesses going away uncleanly.
+ https://bugs.webkit.org/show_bug.cgi?id=158894
+
+ Reviewed by Alex Christensen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess.mm:
+
2016-06-22 Jon Lee <[email protected]>
Update animometer.plan
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (202358 => 202359)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-06-22 23:46:05 UTC (rev 202359)
@@ -70,6 +70,7 @@
51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */; };
51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */; };
517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
+ 51A5877D1D1B49CD004BA9AF /* IndexedDBMultiProcess-3.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */; };
51B1EE961C80FAEF0064FB98 /* IndexedDBPersistence-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */; };
51B1EE971C80FAEF0064FB98 /* IndexedDBPersistence-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */; };
51BCEE4E1C84F53B0042C82E /* IndexedDBMultiProcess-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51BCEE4C1C84F52C0042C82E /* IndexedDBMultiProcess-1.html */; };
@@ -468,6 +469,7 @@
dstPath = TestWebKitAPI.resources;
dstSubfolderSpec = 7;
files = (
+ 51A5877D1D1B49CD004BA9AF /* IndexedDBMultiProcess-3.html in Copy Resources */,
9984FACE1CFFB090008D198C /* editable-body.html in Copy Resources */,
51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */,
51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */,
@@ -696,6 +698,7 @@
51714EB91D087416004723C4 /* CrossThreadTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadTask.cpp; sourceTree = "<group>"; };
517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
+ 51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBMultiProcess-3.html"; sourceTree = "<group>"; };
51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBPersistence.mm; sourceTree = "<group>"; };
51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBPersistence-1.html"; sourceTree = "<group>"; };
51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBPersistence-2.html"; sourceTree = "<group>"; };
@@ -1254,6 +1257,7 @@
5714ECBA1CA8BFD100051AC8 /* DownloadRequestOriginalURLFrame.html */,
51BCEE4C1C84F52C0042C82E /* IndexedDBMultiProcess-1.html */,
51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */,
+ 51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */,
51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */,
51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */,
51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */,
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html (202358 => 202359)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html 2016-06-22 23:46:05 UTC (rev 202359)
@@ -9,6 +9,7 @@
req._onsuccess_ = function(event)
{
window.webkit.messageHandlers.testHandler.postMessage('Value of foo: ' + req.result);
+ continueTest1();
}
req._onerror_ = function(event)
@@ -29,4 +30,63 @@
// Unexpected upgrade needed
window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded');
}
+
+function continueTest1()
+{
+ var request = window.indexedDB.deleteDatabase("ProcessCloseIDBCleanup");
+ request._onsuccess_ = function(e)
+ {
+ continueTest2();
+ }
+ request._onerror_ = function(e)
+ {
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Error deleting ProcessCloseIDBCleanup database');
+ }
+}
+
+function startGetLoop()
+{
+ var request = window.indexedDB.open("ProcessCloseIDBCleanup");
+ request._onsuccess_ = function(e)
+ {
+ var req = e.target.result.transaction(["TestObjectStore"]).objectStore("TestObjectStore").get("foo");
+ req._onsuccess_ = startGetLoop;
+ req._onerror_ = function(e)
+ {
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Error with a get loop');
+ }
+ }
+
+ request._onerror_ = function(e)
+ {
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Error with a get loop');
+ }
+}
+
+function continueTest2()
+{
+ var request = window.indexedDB.open("ProcessCloseIDBCleanup");
+ request._onsuccess_ = function(e)
+ {
+ for (var i = 0; i < 75; ++i)
+ startGetLoop();
+
+ setTimeout("window.webkit.messageHandlers.testHandler.postMessage('Get loops started');", 0);
+ }
+
+ request._onerror_ = function(e)
+ {
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Error opening ProcessCloseIDBCleanup database');
+ }
+
+ request._onupgradeneeded_ = function(e)
+ {
+ e.target.result.createObjectStore("TestObjectStore").put("bar", "foo");
+ }
+}
+
</script>
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html (0 => 202359)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html 2016-06-22 23:46:05 UTC (rev 202359)
@@ -0,0 +1,21 @@
+<script>
+
+var request = window.indexedDB.deleteDatabase("ProcessCloseIDBCleanup");
+
+request._onsuccess_ = function(event)
+{
+ window.webkit.messageHandlers.testHandler.postMessage('Deleted!');
+}
+
+request._onerror_ = function()
+{
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database');
+}
+
+request._onblocked_ = function(event)
+{
+ window.webkit.messageHandlers.testHandler.postMessage('Blocked!');
+}
+
+</script>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess.mm (202358 => 202359)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess.mm 2016-06-22 23:35:25 UTC (rev 202358)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess.mm 2016-06-22 23:46:05 UTC (rev 202359)
@@ -81,7 +81,7 @@
receivedScriptMessage = false;
RetainPtr<NSString> string3 = (NSString *)[lastScriptMessage body];
- // Make a new web view with a new web process to finish the test
+ // Make a new web view with a new web process to continue the test
RetainPtr<WKWebView> webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"IndexedDBMultiProcess-2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
@@ -95,6 +95,29 @@
EXPECT_WK_STREQ(@"Transaction complete", string2.get());
EXPECT_WK_STREQ(@"Open success", string3.get());
EXPECT_WK_STREQ(@"Value of foo: bar", string4.get());
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string5 = (NSString *)[lastScriptMessage body];
+ EXPECT_WK_STREQ(@"Get loops started", string5.get());
+
+ // Make a new web view with a new web process to continue the test
+ RetainPtr<WKWebView> webView3 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"IndexedDBMultiProcess-3" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView3 loadRequest:request];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string6 = (NSString *)[lastScriptMessage body];
+ EXPECT_WK_STREQ(@"Blocked!", string6.get());
+
+ // Kill the blocking web process
+ webView2 = nil;
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string7 = (NSString *)[lastScriptMessage body];
+ EXPECT_WK_STREQ(@"Deleted!", string7.get());
}
#endif