Title: [244364] trunk
Revision
244364
Author
[email protected]
Date
2019-04-16 17:18:11 -0700 (Tue, 16 Apr 2019)

Log Message

REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
https://bugs.webkit.org/show_bug.cgi?id=196995

Patch by Alex Christensen <[email protected]> on 2019-04-16
Reviewed by Brady Eidson.

Source/WebKit:

Always call CompletionHandlers.  Otherwise things hang or assert.
I added an API test that asserts without this change so we don't regress this again.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::clearAllCaches):
(WebKit::CacheStorage::Engine::clearCachesForOrigin):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244363 => 244364)


--- trunk/Source/WebKit/ChangeLog	2019-04-16 23:44:07 UTC (rev 244363)
+++ trunk/Source/WebKit/ChangeLog	2019-04-17 00:18:11 UTC (rev 244364)
@@ -1,3 +1,17 @@
+2019-04-16  Alex Christensen  <[email protected]>
+
+        REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
+        https://bugs.webkit.org/show_bug.cgi?id=196995
+
+        Reviewed by Brady Eidson.
+
+        Always call CompletionHandlers.  Otherwise things hang or assert.
+        I added an API test that asserts without this change so we don't regress this again.
+
+        * NetworkProcess/cache/CacheStorageEngine.cpp:
+        (WebKit::CacheStorage::Engine::clearAllCaches):
+        (WebKit::CacheStorage::Engine::clearCachesForOrigin):
+
 2019-04-16  Chris Dumez  <[email protected]>
 
         URL set by document.open() is not communicated to the UIProcess

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (244363 => 244364)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2019-04-16 23:44:07 UTC (rev 244363)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2019-04-17 00:18:11 UTC (rev 244364)
@@ -525,7 +525,7 @@
 
     auto callbackAggregator = CallbackAggregator::create([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)]() mutable {
         if (!this->shouldPersist())
-            return;
+            return completionHandler();
         
         this->clearAllCachesFromDisk(WTFMove(completionHandler));
     });
@@ -553,7 +553,7 @@
 
     auto callbackAggregator = CallbackAggregator::create([this, protectedThis = makeRef(*this), origin, completionHandler = WTFMove(completionHandler)]() mutable {
         if (!this->shouldPersist())
-            return;
+            return completionHandler();
 
         this->clearCachesForOriginFromDisk(origin, [completionHandler = WTFMove(completionHandler)]() mutable {
             completionHandler();

Modified: trunk/Tools/ChangeLog (244363 => 244364)


--- trunk/Tools/ChangeLog	2019-04-16 23:44:07 UTC (rev 244363)
+++ trunk/Tools/ChangeLog	2019-04-17 00:18:11 UTC (rev 244364)
@@ -1,3 +1,13 @@
+2019-04-16  Alex Christensen  <[email protected]>
+
+        REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
+        https://bugs.webkit.org/show_bug.cgi?id=196995
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
+        (TEST):
+
 2019-04-16  Chris Dumez  <[email protected]>
 
         URL set by document.open() is not communicated to the UIProcess

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm (244363 => 244364)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm	2019-04-16 23:44:07 UTC (rev 244363)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm	2019-04-17 00:18:11 UTC (rev 244364)
@@ -27,6 +27,7 @@
 
 #import "PlatformUtilities.h"
 #import "Test.h"
+#import "TestWKWebView.h"
 #import <WebKit/WKWebsiteDataStorePrivate.h>
 #import <WebKit/WebKit.h>
 #import <wtf/text/WTFString.h>
@@ -48,3 +49,16 @@
     }];
     TestWebKitAPI::Util::run(&readyToContinue);
 }
+
+TEST(WKWebsiteDataStore, RemoveEphemeralData)
+{
+    auto configuration = adoptNS([WKWebViewConfiguration new]);
+    [configuration setWebsiteDataStore:[WKWebsiteDataStore nonPersistentDataStore]];
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
+    __block bool done = false;
+    [[configuration websiteDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler: ^{
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to