Plugin processes are repeatedly spun up to do nothing
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Dec 2017 17:57:09 +0000 (17:57 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Dec 2017 17:57:09 +0000 (17:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180885
<rdar://problem/36082564>

Reviewed by Geoffrey Garen.

Source/WebKit:

Tested by TestWebKitAPI.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData): Don't ask plugins to remove data when no websites are
passed to the function.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:
(runTestWithWebsiteDataStore): Check that deleting website data did not
trigger any plugin processes to start up.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225999 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm

index d560c64..8b5f00f 100644 (file)
@@ -1,3 +1,17 @@
+2017-12-16  Brent Fulgham  <bfulgham@apple.com>
+
+        Plugin processes are repeatedly spun up to do nothing
+        https://bugs.webkit.org/show_bug.cgi?id=180885
+        <rdar://problem/36082564>
+
+        Reviewed by Geoffrey Garen.
+
+        Tested by TestWebKitAPI.
+
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::removeData): Don't ask plugins to remove data when no websites are
+        passed to the function.
+
 2017-12-15  Chris Dumez  <cdumez@apple.com>
 
         Support updating a service worker registration's updateViaCache flag
index fbbc4b4..fcbd222 100644 (file)
@@ -1125,7 +1125,8 @@ void WebsiteDataStore::removeData(OptionSet<WebsiteDataType> dataTypes, const Ve
             Vector<String> m_hostNames;
         };
 
-        State::deleteData(*callbackAggregator, plugins(), WTFMove(hostNames));
+        if (!hostNames.isEmpty())
+            State::deleteData(*callbackAggregator, plugins(), WTFMove(hostNames));
     }
 #endif
 
index 439f27a..d3578f1 100644 (file)
@@ -1,3 +1,15 @@
+2017-12-16  Brent Fulgham  <bfulgham@apple.com>
+
+        Plugin processes are repeatedly spun up to do nothing
+        https://bugs.webkit.org/show_bug.cgi?id=180885
+        <rdar://problem/36082564>
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:
+        (runTestWithWebsiteDataStore): Check that deleting website data did not
+        trigger any plugin processes to start up.
+
 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Remove unnecessary boolean result of start() functions
index 5b394e4..a875332 100644 (file)
@@ -29,6 +29,7 @@
 #import "TestNavigationDelegate.h"
 #import <WebKit/WKFoundation.h>
 #import <WebKit/WKHTTPCookieStore.h>
+#import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WKWebsiteDataStorePrivate.h>
 #import <WebKit/_WKWebsiteDataStoreConfiguration.h>
 #import <wtf/RetainPtr.h>
@@ -71,6 +72,10 @@ static void runTestWithWebsiteDataStore(WKWebsiteDataStore* dataStore)
     TestWebKitAPI::Util::run(&gotFlag);
     gotFlag = false;
 
+    // Triggering removeData when we don't have plugin data to remove should not trigger the plugin process to launch.
+    id pool = [WKProcessPool _sharedProcessPool];
+    EXPECT_EQ([pool _pluginProcessCount], static_cast<size_t>(0));
+
     globalCookieStore = dataStore.httpCookieStore;
     RetainPtr<CookieObserver> observer1 = adoptNS([[CookieObserver alloc] init]);
     RetainPtr<CookieObserver> observer2 = adoptNS([[CookieObserver alloc] init]);