IndexedDB operations in a Page fail after a StorageProcess crash.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2018 05:48:35 +0000 (05:48 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2018 05:48:35 +0000 (05:48 +0000)
commit0c75570e883bfc5f3f608e9b1a91ccdf21ef5f42
tree110380d5c0632478ee4a2dd2461a0ae53b444cd1
parent462bccd8919e9de547a3b2311481259c21a28cb8
IndexedDB operations in a Page fail after a StorageProcess crash.
<rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123

Reviewed by Alex Christensen.

Source/WebCore:

Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html

When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
in the WebProcess about it.

This puts Documents/Workers in an error mode where requests fail instead of timeout.
It also clears the Page's connection so *new* Documents and Workers will get a fresh
new connection that works.

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater):
(WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
(WebCore::IDBClient::IDBConnectionToServer::openDatabase):
(WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
(WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
(WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
(WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
(WebCore::IDBClient::IDBConnectionToServer::createIndex):
(WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
(WebCore::IDBClient::IDBConnectionToServer::renameIndex):
(WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
(WebCore::IDBClient::IDBConnectionToServer::getRecord):
(WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
(WebCore::IDBClient::IDBConnectionToServer::getCount):
(WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
(WebCore::IDBClient::IDBConnectionToServer::openCursor):
(WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
(WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
(WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
(WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
(WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
(WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
(WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer):
(WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost):
(WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled):
(WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
(WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
(WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
(WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
* Modules/indexeddb/client/IDBConnectionToServer.h:

* Modules/indexeddb/shared/IDBError.h:
(WebCore::IDBError::serverConnectionLostError):

* page/Page.cpp:
(WebCore::Page::setSessionID):
(WebCore::Page::idbConnection):
(WebCore::Page::optionalIDBConnection):
(WebCore::Page::clearIDBConnection):
* page/Page.h:

Source/WebKit:

When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
in the WebProcess about it.

This puts Documents/Workers in an error mode where requests fail instead of timeout.
It also clears the Page's connection so *new* Documents and Workers will get a fresh
new connection that works.

* UIProcess/API/C/WKContext.cpp:
(WKContextTerminateStorageProcess):

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _terminateStorageProcess]):

* UIProcess/Storage/StorageProcessProxy.cpp:
(WebKit::StorageProcessProxy::terminateForTesting):
* UIProcess/Storage/StorageProcessProxy.h:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::terminateStorageProcessForTesting):
(WebKit::WebProcessPool::terminateStorageProcess): Deleted.
* UIProcess/WebProcessPool.h:

* WebProcess/Storage/WebToStorageProcessConnection.cpp:
(WebKit::WebToStorageProcessConnection::didClose):
* WebProcess/Storage/WebToStorageProcessConnection.h:
(WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier):

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::webToStorageProcessConnectionClosed):

LayoutTests:

* storage/indexeddb/modern/opendatabase-after-storage-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233562 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/platform/wk2/TestExpectations
LayoutTests/storage/indexeddb/modern/opendatabase-after-storage-crash-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/opendatabase-after-storage-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
Source/WebCore/Modules/indexeddb/shared/IDBError.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/C/WKContext.cpp
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/Storage/StorageProcessProxy.cpp
Source/WebKit/UIProcess/Storage/StorageProcessProxy.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.cpp
Source/WebKit/WebProcess/Storage/WebToStorageProcessConnection.h
Source/WebKit/WebProcess/WebProcess.cpp