<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201461] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201461">201461</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-05-27 12:45:42 -0700 (Fri, 27 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: After closing a Netflix video, trying to watch it again fails.
<rdar://problem/25092473> and https://bugs.webkit.org/show_bug.cgi?id=158160
Reviewed by Alex Christensen.
Source/WebCore:
New APITest: IndexedDB.WebProcessKillIDBCleanup
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::stop):
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::connectionClosedFromClient): All active transactions need to be aborted
(without callback, since there's no connection to callback to).
(WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWebProcessKillIDBCleanup1html">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWebProcessKillIDBCleanup2html">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWebProcessKillIDBCleanupmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201460 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-27 19:22:09 UTC (rev 201460)
+++ trunk/Source/WebCore/ChangeLog        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-05-27 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: After closing a Netflix video, trying to watch it again fails.
+ <rdar://problem/25092473> and https://bugs.webkit.org/show_bug.cgi?id=158160
+
+ Reviewed by Alex Christensen.
+
+ New APITest: IndexedDB.WebProcessKillIDBCleanup
+
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::stop):
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::connectionClosedFromClient): All active transactions need to be aborted
+ (without callback, since there's no connection to callback to).
+ (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
+
</ins><span class="cx"> 2016-05-27 Adam Bergkvist <adam.bergkvist@ericsson.com>
</span><span class="cx">
</span><span class="cx"> WebRTC: Update RTCPeerConnection overloaded legacy operations to return a Promise
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (201460 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-05-27 19:22:09 UTC (rev 201460)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -328,7 +328,7 @@
</span><span class="cx">
</span><span class="cx"> void IDBTransaction::stop()
</span><span class="cx"> {
</span><del>- LOG(IndexedDB, "IDBTransaction::stop");
</del><ins>+ LOG(IndexedDB, "IDBTransaction::stop - %s", m_info.loggingString().utf8().data());
</ins><span class="cx"> ASSERT(currentThread() == m_database->originThreadID());
</span><span class="cx">
</span><span class="cx"> // IDBDatabase::stop() calls IDBTransaction::stop() for each of its active transactions.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (201460 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2016-05-27 19:22:09 UTC (rev 201460)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -1241,6 +1241,15 @@
</span><span class="cx"> if (!pendingTransactions.isEmpty())
</span><span class="cx"> m_pendingTransactions.swap(pendingTransactions);
</span><span class="cx">
</span><ins>+ Deque<RefPtr<UniqueIDBDatabaseTransaction>> transactionsToAbort;
+ for (auto& transaction : m_inProgressTransactions.values()) {
+ if (&transaction->databaseConnection() == &connection)
+ transactionsToAbort.append(transaction);
+ }
+
+ for (auto& transaction : transactionsToAbort)
+ transaction->abortWithoutCallback();
+
</ins><span class="cx"> if (m_currentOpenDBRequest)
</span><span class="cx"> notifyCurrentRequestConnectionClosedOrFiredVersionChangeEvent(connection.identifier());
</span><span class="cx">
</span><span class="lines">@@ -1404,6 +1413,10 @@
</span><span class="cx"> RefPtr<UniqueIDBDatabaseTransaction> UniqueIDBDatabase::takeNextRunnableTransaction(bool& hadDeferredTransactions)
</span><span class="cx"> {
</span><span class="cx"> hadDeferredTransactions = false;
</span><ins>+
+ if (m_pendingTransactions.isEmpty())
+ return nullptr;
+
</ins><span class="cx"> if (!m_backingStoreSupportsSimultaneousTransactions && hasUnfinishedTransactions()) {
</span><span class="cx"> LOG(IndexedDB, "UniqueIDBDatabase::takeNextRunnableTransaction - Backing store only supports 1 transaction, and we already have 1");
</span><span class="cx"> return nullptr;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (201460 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-05-27 19:22:09 UTC (rev 201460)
+++ trunk/Tools/ChangeLog        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-05-27 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: After closing a Netflix video, trying to watch it again fails.
+ <rdar://problem/25092473> and https://bugs.webkit.org/show_bug.cgi?id=158160
+
+ Reviewed by Alex Christensen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html: Added.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm: Added.
+
</ins><span class="cx"> 2016-05-27 Joanmarie Diggs <jdiggs@igalia.com>
</span><span class="cx">
</span><span class="cx"> AX: [ATK] accessibility/gtk/no-notification-for-unrendered-iframe-children.html began failing after r201416
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201460 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-27 19:22:09 UTC (rev 201460)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -68,6 +68,9 @@
</span><span class="cx">                 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
</span><span class="cx">                 51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */; };
</span><span class="cx">                 5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
</span><ins>+                51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */; };
+                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 */; };
</ins><span class="cx">                 517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
</span><span class="cx">                 51B1EE8E1C80F5880064FB98 /* IndexedDBPersistence.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */; };
</span><span class="cx">                 51B1EE961C80FAEF0064FB98 /* IndexedDBPersistence-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */; };
</span><span class="lines">@@ -424,6 +427,8 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */,
+                                51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */,
</ins><span class="cx">                                 93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */,
</span><span class="cx">                                 93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
</span><span class="cx">                                 936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
</span><span class="lines">@@ -641,6 +646,9 @@
</span><span class="cx">                 51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuCanCopyURL.mm; sourceTree = "<group>"; };
</span><span class="cx">                 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContextMenuCanCopyURL.html; sourceTree = "<group>"; };
</span><ins>+                51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "WebProcessKillIDBCleanup-1.html"; sourceTree = "<group>"; };
+                51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "WebProcessKillIDBCleanup-2.html"; sourceTree = "<group>"; };
+                51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessKillIDBCleanup.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
</span><span class="cx">                 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
</span><span class="cx">                 51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBPersistence.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -1043,9 +1051,12 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 A16F66B81C40E9E100BD4D24 /* Resources */,
</span><span class="cx">                                 7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */,
</span><ins>+                                A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */,
</ins><span class="cx">                                 2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */,
</span><span class="cx">                                 A13EBBAC1B87436F00097110 /* BundleParameters.mm */,
</span><span class="cx">                                 A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */,
</span><ins>+                                1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
+                                1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */,
</ins><span class="cx">                                 A18AA8CC1C3FA218009B2B97 /* ContentFiltering.h */,
</span><span class="cx">                                 A14FC5861B8991B600D107EB /* ContentFiltering.mm */,
</span><span class="cx">                                 A14FC5891B89927100D107EB /* ContentFilteringPlugIn.mm */,
</span><span class="lines">@@ -1059,7 +1070,6 @@
</span><span class="cx">                                 57901FAC1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm */,
</span><span class="cx">                                 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */,
</span><span class="cx">                                 1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
</span><del>-                                A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */,
</del><span class="cx">                                 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
</span><span class="cx">                                 C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
</span><span class="cx">                                 5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */,
</span><span class="lines">@@ -1070,15 +1080,14 @@
</span><span class="cx">                                 CD9E292B1C90A71F000BB800 /* RequiresUserActionForPlayback.mm */,
</span><span class="cx">                                 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */,
</span><span class="cx">                                 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */,
</span><del>-                                93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
</del><span class="cx">                                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
</span><span class="cx">                                 7C882E031C80C624006BF731 /* UserContentWorld.mm */,
</span><span class="cx">                                 7C882E041C80C624006BF731 /* UserContentWorldPlugIn.mm */,
</span><span class="cx">                                 7C882E051C80C624006BF731 /* UserContentWorldProtocol.h */,
</span><ins>+                                93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
</ins><span class="cx">                                 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
</span><span class="cx">                                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
</span><del>-                                1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
-                                1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */,
</del><ins>+                                51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = "WebKit2 Cocoa";
</span><span class="cx">                         path = WebKit2Cocoa;
</span><span class="lines">@@ -1161,6 +1170,8 @@
</span><span class="cx">                                 51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */,
</span><span class="cx">                                 51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */,
</span><span class="cx">                                 51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */,
</span><ins>+                                51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */,
+                                51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */,
</ins><span class="cx">                                 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */,
</span><span class="cx">                                 936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */,
</span><span class="cx">                                 936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */,
</span><span class="lines">@@ -1846,6 +1857,7 @@
</span><span class="cx">                                 536770341CC8022800D425B1 /* WebScriptObjectDescription.mm in Sources */,
</span><span class="cx">                                 7CCE7EE21A411A9A00447C4C /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */,
</span><span class="cx">                                 7CCE7F351A411B8E00447C4C /* HashMap.cpp in Sources */,
</span><ins>+                                51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */,
</ins><span class="cx">                                 7CCE7F361A411B8E00447C4C /* HashSet.cpp in Sources */,
</span><span class="cx">                                 7CCE7EFA1A411AE600447C4C /* HitTestResultNodeHandle.cpp in Sources */,
</span><span class="cx">                                 7CCE7EC11A411A7E00447C4C /* HTMLCollectionNamedItem.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWebProcessKillIDBCleanup1html"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html (0 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+<script>
+
+var request = window.indexedDB.deleteDatabase("WebProcessKillIDBCleanup");
+request.onsuccess = function(e)
+{
+ continueTest();
+}
+request.onerror = function(e)
+{
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Error deleting database');
+}
+
+var database;
+
+function continueTest()
+{
+ var request = window.indexedDB.open("WebProcessKillIDBCleanup");
+
+ request.onsuccess = function()
+ {
+ window.webkit.messageHandlers.testHandler.postMessage('Open success');
+ setTimeout(continueTest2, 0);
+ }
+
+ request.onerror = function()
+ {
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database');
+ }
+
+ request.onupgradeneeded = function(event)
+ {
+ window.webkit.messageHandlers.testHandler.postMessage('UpgradeNeeded');
+
+ database = event.target.result;
+ var store = database.createObjectStore("TestObjectStore");
+
+ event.target.transaction.oncomplete = function() {
+ window.webkit.messageHandlers.testHandler.postMessage('Transaction complete');
+ }
+
+ event.target.transaction.onerror = function() {
+ window.webkit.messageHandlers.testHandler.postMessage('Transaction errored!');
+ }
+
+ store.put("bar", "foo");
+ }
+}
+
+function continueTest2()
+{
+ var objectStore = database.transaction("TestObjectStore", "readonly").objectStore("TestObjectStore");
+
+ // Start a get-loop to keep this transaction active.
+ var shouldMessageClose = true;
+ function success() {
+ objectStore.get("foo").onsuccess = success;
+ if (shouldMessageClose) {
+ window.webkit.messageHandlers.testHandler.postMessage('Infinite Transaction Started');
+ shouldMessageClose = false;
+ }
+ }
+
+ objectStore.get("foo").onsuccess = success;
+}
+</script>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWebProcessKillIDBCleanup2html"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html (0 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<script>
+
+var request = window.indexedDB.open("WebProcessKillIDBCleanup");
+
+request.onsuccess = function(event)
+{
+ window.webkit.messageHandlers.testHandler.postMessage('Second open success');
+
+ event.target.result.transaction("TestObjectStore", "readonly").objectStore("TestObjectStore").get("foo").onsuccess = function() {
+ window.webkit.messageHandlers.testHandler.postMessage('Second WebView Transaction Started');
+ }
+}
+
+request.onerror = function()
+{
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database');
+}
+
+request.onupgradeneeded = function(event)
+{
+ // Unexpected error
+ window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded opening database');
+}
+</script>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWebProcessKillIDBCleanupmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm (0 => 201461)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm        2016-05-27 19:45:42 UTC (rev 201461)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import <WebKit/WebKit.h>
+
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKUserContentControllerPrivate.h>
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+#import <WebKit/_WKUserStyleSheet.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED
+
+static bool receivedScriptMessage;
+static RetainPtr<WKScriptMessage> lastScriptMessage;
+
+@interface IndexedDBWebProcessKillMessageHandler : NSObject <WKScriptMessageHandler>
+@end
+
+@implementation IndexedDBWebProcessKillMessageHandler
+
+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
+{
+ receivedScriptMessage = true;
+ lastScriptMessage = message;
+}
+
+@end
+
+TEST(IndexedDB, WebProcessKillIDBCleanup)
+{
+ RetainPtr<IndexedDBWebProcessKillMessageHandler> handler = adoptNS([[IndexedDBWebProcessKillMessageHandler alloc] init]);
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"];
+
+ // Allow file URLs to load non-file resources
+ [configuration _setAllowUniversalAccessFromFileURLs:YES];
+
+ [configuration.get().processPool _terminateDatabaseProcess];
+
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"WebProcessKillIDBCleanup-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];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string3 = (NSString *)[lastScriptMessage body];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string4 = (NSString *)[lastScriptMessage body];
+
+ // Kill that web process
+ webView = nil;
+
+ // Make a new web view with a new web process to finish the test
+ RetainPtr<WKWebView> webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"WebProcessKillIDBCleanup-2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView2 loadRequest:request];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string5 = (NSString *)[lastScriptMessage body];
+
+ TestWebKitAPI::Util::run(&receivedScriptMessage);
+ receivedScriptMessage = false;
+ RetainPtr<NSString> string6 = (NSString *)[lastScriptMessage body];
+
+ EXPECT_WK_STREQ(@"UpgradeNeeded", string1.get());
+ EXPECT_WK_STREQ(@"Transaction complete", string2.get());
+ EXPECT_WK_STREQ(@"Open success", string3.get());
+ EXPECT_WK_STREQ(@"Infinite Transaction Started", string4.get());
+ EXPECT_WK_STREQ(@"Second open success", string5.get());
+ EXPECT_WK_STREQ(@"Second WebView Transaction Started", string6.get());
+}
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>