Title: [201461] trunk
Revision
201461
Author
beid...@apple.com
Date
2016-05-27 12:45:42 -0700 (Fri, 27 May 2016)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201460 => 201461)


--- 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)
@@ -1,3 +1,20 @@
+2016-05-27  Brady Eidson  <beid...@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):
+
 2016-05-27  Adam Bergkvist  <adam.bergkv...@ericsson.com>
 
         WebRTC: Update RTCPeerConnection overloaded legacy operations to return a Promise

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (201460 => 201461)


--- 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)
@@ -328,7 +328,7 @@
 
 void IDBTransaction::stop()
 {
-    LOG(IndexedDB, "IDBTransaction::stop");
+    LOG(IndexedDB, "IDBTransaction::stop - %s", m_info.loggingString().utf8().data());
     ASSERT(currentThread() == m_database->originThreadID());
 
     // IDBDatabase::stop() calls IDBTransaction::stop() for each of its active transactions.

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (201460 => 201461)


--- 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)
@@ -1241,6 +1241,15 @@
     if (!pendingTransactions.isEmpty())
         m_pendingTransactions.swap(pendingTransactions);
 
+    Deque<RefPtr<UniqueIDBDatabaseTransaction>> transactionsToAbort;
+    for (auto& transaction : m_inProgressTransactions.values()) {
+        if (&transaction->databaseConnection() == &connection)
+            transactionsToAbort.append(transaction);
+    }
+
+    for (auto& transaction : transactionsToAbort)
+        transaction->abortWithoutCallback();
+
     if (m_currentOpenDBRequest)
         notifyCurrentRequestConnectionClosedOrFiredVersionChangeEvent(connection.identifier());
 
@@ -1404,6 +1413,10 @@
 RefPtr<UniqueIDBDatabaseTransaction> UniqueIDBDatabase::takeNextRunnableTransaction(bool& hadDeferredTransactions)
 {
     hadDeferredTransactions = false;
+
+    if (m_pendingTransactions.isEmpty())
+        return nullptr;
+
     if (!m_backingStoreSupportsSimultaneousTransactions && hasUnfinishedTransactions()) {
         LOG(IndexedDB, "UniqueIDBDatabase::takeNextRunnableTransaction - Backing store only supports 1 transaction, and we already have 1");
         return nullptr;

Modified: trunk/Tools/ChangeLog (201460 => 201461)


--- trunk/Tools/ChangeLog	2016-05-27 19:22:09 UTC (rev 201460)
+++ trunk/Tools/ChangeLog	2016-05-27 19:45:42 UTC (rev 201461)
@@ -1,3 +1,15 @@
+2016-05-27  Brady Eidson  <beid...@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.
+
 2016-05-27  Joanmarie Diggs  <jdi...@igalia.com>
 
         AX: [ATK] accessibility/gtk/no-notification-for-unrendered-iframe-children.html began failing after r201416

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201460 => 201461)


--- 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)
@@ -68,6 +68,9 @@
 		4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
 		51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */; };
 		5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
+		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 */; };
 		517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
 		51B1EE8E1C80F5880064FB98 /* IndexedDBPersistence.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */; };
 		51B1EE961C80FAEF0064FB98 /* IndexedDBPersistence-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */; };
@@ -424,6 +427,8 @@
 			dstPath = TestWebKitAPI.resources;
 			dstSubfolderSpec = 7;
 			files = (
+				51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */,
+				51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */,
 				93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */,
 				93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
 				936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
@@ -641,6 +646,9 @@
 		51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic.cpp; sourceTree = "<group>"; };
 		5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuCanCopyURL.mm; sourceTree = "<group>"; };
 		5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContextMenuCanCopyURL.html; sourceTree = "<group>"; };
+		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>"; };
 		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>"; };
 		51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBPersistence.mm; sourceTree = "<group>"; };
@@ -1043,9 +1051,12 @@
 			children = (
 				A16F66B81C40E9E100BD4D24 /* Resources */,
 				7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */,
+				A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */,
 				2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */,
 				A13EBBAC1B87436F00097110 /* BundleParameters.mm */,
 				A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */,
+				1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
+				1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */,
 				A18AA8CC1C3FA218009B2B97 /* ContentFiltering.h */,
 				A14FC5861B8991B600D107EB /* ContentFiltering.mm */,
 				A14FC5891B89927100D107EB /* ContentFilteringPlugIn.mm */,
@@ -1059,7 +1070,6 @@
 				57901FAC1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm */,
 				51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */,
 				1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
-				A1DF74301C41B65800A2F4D0 /* AlwaysRevalidatedURLSchemes.mm */,
 				CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
 				C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
 				5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */,
@@ -1070,15 +1080,14 @@
 				CD9E292B1C90A71F000BB800 /* RequiresUserActionForPlayback.mm */,
 				37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */,
 				2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */,
-				93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
 				7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
 				7C882E031C80C624006BF731 /* UserContentWorld.mm */,
 				7C882E041C80C624006BF731 /* UserContentWorldPlugIn.mm */,
 				7C882E051C80C624006BF731 /* UserContentWorldProtocol.h */,
+				93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
 				2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
 				0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
-				1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
-				1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */,
+				51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */,
 			);
 			name = "WebKit2 Cocoa";
 			path = WebKit2Cocoa;
@@ -1161,6 +1170,8 @@
 				51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */,
 				51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */,
 				51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */,
+				51714EB21CF8C761004723C4 /* WebProcessKillIDBCleanup-1.html */,
+				51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */,
 				93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */,
 				936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */,
 				936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */,
@@ -1846,6 +1857,7 @@
 				536770341CC8022800D425B1 /* WebScriptObjectDescription.mm in Sources */,
 				7CCE7EE21A411A9A00447C4C /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */,
 				7CCE7F351A411B8E00447C4C /* HashMap.cpp in Sources */,
+				51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */,
 				7CCE7F361A411B8E00447C4C /* HashSet.cpp in Sources */,
 				7CCE7EFA1A411AE600447C4C /* HitTestResultNodeHandle.cpp in Sources */,
 				7CCE7EC11A411A7E00447C4C /* HTMLCollectionNamedItem.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html (0 => 201461)


--- 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)
@@ -0,0 +1,67 @@
+<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>

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html (0 => 201461)


--- 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)
@@ -0,0 +1,25 @@
+<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>

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup.mm (0 => 201461)


--- 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)
@@ -0,0 +1,114 @@
+/*
+ * 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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to