- Revision
- 259461
- Author
- [email protected]
- Date
- 2020-04-03 08:43:03 -0700 (Fri, 03 Apr 2020)
Log Message
ASSERTION FAILED: m_delegate in IDBConnectionToClient::identifier()
https://bugs.webkit.org/show_bug.cgi?id=209891
<rdar://problem/59293891>
Reviewed by Geoffrey Garen.
Source/WebCore:
IDBConnectionToClient::connectionToClientClosed() can lead UniqueIDBDatabase to start processing new requests,
and we should make sure it ignores the requests from the closed connection. Otherwise, the connection can be
held alive by the request being processed. We can do that by marking connection closed before calling
connectionToClientClosed on UniqueIDBDatabaseConnection.
API Test: IndexedDB.KillWebProcessWithOpenConnection
* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-1.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-2.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/WebProcessKillIDBCleanup.mm:
(TEST):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (259460 => 259461)
--- trunk/Source/WebCore/ChangeLog 2020-04-03 15:21:27 UTC (rev 259460)
+++ trunk/Source/WebCore/ChangeLog 2020-04-03 15:43:03 UTC (rev 259461)
@@ -1,3 +1,21 @@
+2020-04-03 Sihui Liu <[email protected]>
+
+ ASSERTION FAILED: m_delegate in IDBConnectionToClient::identifier()
+ https://bugs.webkit.org/show_bug.cgi?id=209891
+ <rdar://problem/59293891>
+
+ Reviewed by Geoffrey Garen.
+
+ IDBConnectionToClient::connectionToClientClosed() can lead UniqueIDBDatabase to start processing new requests,
+ and we should make sure it ignores the requests from the closed connection. Otherwise, the connection can be
+ held alive by the request being processed. We can do that by marking connection closed before calling
+ connectionToClientClosed on UniqueIDBDatabaseConnection.
+
+ API Test: IndexedDB.KillWebProcessWithOpenConnection
+
+ * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+ (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
+
2020-04-03 Zalan Bujtas <[email protected]>
[MultiColumn] Infinite loop in RenderBlockFlow::pushToNextPageWithMinimumLogicalHeight
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (259460 => 259461)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp 2020-04-03 15:21:27 UTC (rev 259460)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp 2020-04-03 15:43:03 UTC (rev 259461)
@@ -200,15 +200,15 @@
void IDBConnectionToClient::connectionToClientClosed()
{
+ m_isClosed = true;
auto databaseConnections = m_databaseConnections;
- for (auto connection : databaseConnections) {
- if (m_databaseConnections.contains(connection))
- connection->connectionClosedFromClient();
+ for (auto* connection : databaseConnections) {
+ ASSERT(m_databaseConnections.contains(connection));
+ connection->connectionClosedFromClient();
}
- m_isClosed = true;
- m_databaseConnections.clear();
+ ASSERT(m_databaseConnections.isEmpty());
}
} // namespace IDBServer
Modified: trunk/Tools/ChangeLog (259460 => 259461)
--- trunk/Tools/ChangeLog 2020-04-03 15:21:27 UTC (rev 259460)
+++ trunk/Tools/ChangeLog 2020-04-03 15:43:03 UTC (rev 259461)
@@ -1,3 +1,17 @@
+2020-04-03 Sihui Liu <[email protected]>
+
+ ASSERTION FAILED: m_delegate in IDBConnectionToClient::identifier()
+ https://bugs.webkit.org/show_bug.cgi?id=209891
+ <rdar://problem/59293891>
+
+ Reviewed by Geoffrey Garen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-1.html: Added.
+ * TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-2.html: Added.
+ * TestWebKitAPI/Tests/WebKitCocoa/WebProcessKillIDBCleanup.mm:
+ (TEST):
+
2020-04-03 Aakash Jain <[email protected]>
[ews] Display list of test failures along-with the layout-test build step
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (259460 => 259461)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-03 15:21:27 UTC (rev 259460)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-03 15:43:03 UTC (rev 259461)
@@ -762,6 +762,8 @@
9368A25F229EFB4700A829CA /* local-storage-process-suspends-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9368A25C229EFB3A00A829CA /* local-storage-process-suspends-2.html */; };
936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */; };
936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */; };
+ 937A6C8A24357C1700C3A6B0 /* KillWebProcessWithOpenConnection-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 937A6C8824357BF300C3A6B0 /* KillWebProcessWithOpenConnection-1.html */; };
+ 937A6C8B24357C1700C3A6B0 /* KillWebProcessWithOpenConnection-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 937A6C8924357BF300C3A6B0 /* KillWebProcessWithOpenConnection-2.html */; };
937B569E23CD23DB002AE640 /* IDBObjectStoreInfoUpgrade.sqlite3 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93BCBC8123CC6EF500CA2221 /* IDBObjectStoreInfoUpgrade.sqlite3 */; };
9399BA0423711140008392BF /* IndexedDBInPageCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9399BA01237110AE008392BF /* IndexedDBInPageCache.mm */; };
9399BA052371114F008392BF /* IndexedDBInPageCache.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9399BA02237110BF008392BF /* IndexedDBInPageCache.html */; };
@@ -1381,6 +1383,8 @@
C99B675D1E39722000FC6C80 /* js-play-with-controls.html in Copy Resources */,
C2CF975B16CEC71B0054E99D /* JSContextBackForwardCache1.html in Copy Resources */,
C2CF975A16CEC7140054E99D /* JSContextBackForwardCache2.html in Copy Resources */,
+ 937A6C8A24357C1700C3A6B0 /* KillWebProcessWithOpenConnection-1.html in Copy Resources */,
+ 937A6C8B24357C1700C3A6B0 /* KillWebProcessWithOpenConnection-2.html in Copy Resources */,
F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */,
55226A2F1EBA44B900C36AD0 /* large-red-square-image.html in Copy Resources */,
F4538EF71E8473E600B5C953 /* large-red-square.png in Copy Resources */,
@@ -2242,6 +2246,8 @@
9368A25D229EFB3A00A829CA /* local-storage-process-suspends-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "local-storage-process-suspends-1.html"; sourceTree = "<group>"; };
936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "large-video-with-audio.html"; sourceTree = "<group>"; };
936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "large-video-with-audio.mp4"; sourceTree = "<group>"; };
+ 937A6C8824357BF300C3A6B0 /* KillWebProcessWithOpenConnection-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "KillWebProcessWithOpenConnection-1.html"; sourceTree = "<group>"; };
+ 937A6C8924357BF300C3A6B0 /* KillWebProcessWithOpenConnection-2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "KillWebProcessWithOpenConnection-2.html"; sourceTree = "<group>"; };
9399BA01237110AE008392BF /* IndexedDBInPageCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBInPageCache.mm; sourceTree = "<group>"; };
9399BA02237110BF008392BF /* IndexedDBInPageCache.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IndexedDBInPageCache.html; sourceTree = "<group>"; };
9399BA03237110BF008392BF /* IndexedDBNotInPageCache.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IndexedDBNotInPageCache.html; sourceTree = "<group>"; };
@@ -3542,6 +3548,8 @@
5110FCF21E01CD77006F8D0B /* IndexUpgrade.blob */,
5110FCF31E01CD77006F8D0B /* IndexUpgrade.sqlite3 */,
2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */,
+ 937A6C8824357BF300C3A6B0 /* KillWebProcessWithOpenConnection-1.html */,
+ 937A6C8924357BF300C3A6B0 /* KillWebProcessWithOpenConnection-2.html */,
F4538EF01E846B4100B5C953 /* large-red-square.png */,
2E1B7B011D41B1B3007558B4 /* large-video-hides-controls-after-seek-to-end.html */,
2E54F40C1D7BC83900921ADF /* large-video-mutes-onplaying.html */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-1.html (0 => 259461)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-1.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-1.html 2020-04-03 15:43:03 UTC (rev 259461)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<script>
+var request = window.indexedDB.open("TestIndexedDB");
+request._onsuccess_ = () => {
+ window.webkit.messageHandlers.testHandler.postMessage("Open Succeeded");
+}
+request._onerror_ = () => {
+ window.webkit.messageHandlers.testHandler.postMessage("Open Failed");
+}
+</script>
\ No newline at end of file
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-2.html (0 => 259461)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-2.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/KillWebProcessWithOpenConnection-2.html 2020-04-03 15:43:03 UTC (rev 259461)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<script>
+var request = window.indexedDB.open("TestIndexedDB");
+request._onsuccess_ = (event) => {
+ db = event.target.result;
+ var secondRequest = window.indexedDB.open("TestIndexedDB", db.version + 1);
+ secondRequest._onsuccess_ = (event) => {
+ window.webkit.messageHandlers.testHandler.postMessage("Second Open Succeeded Unexpectedly");
+ }
+ secondRequest._onerror_ = (event) => {
+ window.webkit.messageHandlers.testHandler.postMessage("Second Open Failed Unexpectedly");
+ }
+ window.webkit.messageHandlers.testHandler.postMessage("First Open Succeeded");
+}
+request._onerror_ = () => {
+ window.webkit.messageHandlers.testHandler.postMessage("First Open Failed");
+}
+</script>
\ No newline at end of file
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebProcessKillIDBCleanup.mm (259460 => 259461)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebProcessKillIDBCleanup.mm 2020-04-03 15:21:27 UTC (rev 259460)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebProcessKillIDBCleanup.mm 2020-04-03 15:43:03 UTC (rev 259461)
@@ -100,3 +100,31 @@
EXPECT_WK_STREQ(@"Second open success", string5.get());
EXPECT_WK_STREQ(@"Second WebView Transaction Started", string6.get());
}
+
+TEST(IndexedDB, KillWebProcessWithOpenConnection)
+{
+ auto handler = adoptNS([[IndexedDBWebProcessKillMessageHandler alloc] init]);
+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"];
+
+ auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ NSURLRequest *request1 = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"KillWebProcessWithOpenConnection-1" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView1 loadRequest:request1];
+ RetainPtr<NSString> string1 = (NSString *)[getNextMessage() body];
+ EXPECT_WK_STREQ(@"Open Succeeded", string1.get());
+
+ auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ NSURLRequest *request2 = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"KillWebProcessWithOpenConnection-2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView2 loadRequest:request2];
+ RetainPtr<NSString> string2 = (NSString *)[getNextMessage() body];
+ EXPECT_WK_STREQ(@"First Open Succeeded", string2.get());
+
+ [webView2 _killWebContentProcessAndResetState];
+ [webView1 _killWebContentProcessAndResetState];
+
+ TestWebKitAPI::Util::spinRunLoop(10);
+
+ [webView1 reload];
+ RetainPtr<NSString> string3 = (NSString *)[getNextMessage() body];
+ EXPECT_WK_STREQ(@"Open Succeeded", string3.get());
+}