Title: [230389] trunk
Revision
230389
Author
zandober...@gmail.com
Date
2018-04-08 23:31:05 -0700 (Sun, 08 Apr 2018)

Log Message

Non-Cocoa ports use default directory for ServiceWorker data during testing
https://bugs.webkit.org/show_bug.cgi?id=183784

Reviewed by Youenn Fablet.

Source/WebKit:

Add API to WKWebsiteDataStore that enables setting and retrieving the
service worker registration directory for a given data store object.
This enables setting the temporary directory for testing purposes in
WebKitTestRunner.

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
(WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::platformAdjustContext): Set the service worker registration
directory through the new WKWebsiteDataStore API for non-Cocoa ports.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (230388 => 230389)


--- trunk/Source/WebKit/ChangeLog	2018-04-09 04:55:23 UTC (rev 230388)
+++ trunk/Source/WebKit/ChangeLog	2018-04-09 06:31:05 UTC (rev 230389)
@@ -1,3 +1,20 @@
+2018-04-08  Zan Dobersek  <zdober...@igalia.com>
+
+        Non-Cocoa ports use default directory for ServiceWorker data during testing
+        https://bugs.webkit.org/show_bug.cgi?id=183784
+
+        Reviewed by Youenn Fablet.
+
+        Add API to WKWebsiteDataStore that enables setting and retrieving the
+        service worker registration directory for a given data store object.
+        This enables setting the temporary directory for testing purposes in
+        WebKitTestRunner.
+
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
+        (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+
 2018-04-08  Fujii Hironori  <hironori.fu...@sony.com>
 
         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library

Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (230388 => 230389)


--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp	2018-04-09 04:55:23 UTC (rev 230388)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp	2018-04-09 06:31:05 UTC (rev 230389)
@@ -493,3 +493,13 @@
         callback(0, context);
     });
 }
+
+WKStringRef WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef)
+{
+    return WebKit::toCopiedAPI(WebKit::toImpl(dataStoreRef)->websiteDataStore().serviceWorkerRegistrationDirectory());
+}
+
+void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef, WKStringRef serviceWorkerRegistrationDirectory)
+{
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().setServiceWorkerRegistrationDirectory(WebKit::toImpl(serviceWorkerRegistrationDirectory)->string());
+}

Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (230388 => 230389)


--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h	2018-04-09 04:55:23 UTC (rev 230388)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h	2018-04-09 06:31:05 UTC (rev 230389)
@@ -101,6 +101,9 @@
 typedef void (*WKWebsiteDataStoreGetFetchCacheSizeForOriginFunction)(uint64_t, void*);
 WK_EXPORT void WKWebsiteDataStoreGetFetchCacheSizeForOrigin(WKWebsiteDataStoreRef dataStoreRef, WKStringRef origin, void* context, WKWebsiteDataStoreGetFetchCacheSizeForOriginFunction function);
 
+WK_EXPORT WKStringRef WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef);
+WK_EXPORT void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef, WKStringRef serviceWorkerRegistrationDirectory);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Tools/ChangeLog (230388 => 230389)


--- trunk/Tools/ChangeLog	2018-04-09 04:55:23 UTC (rev 230388)
+++ trunk/Tools/ChangeLog	2018-04-09 06:31:05 UTC (rev 230389)
@@ -1,3 +1,14 @@
+2018-04-08  Zan Dobersek  <zdober...@igalia.com>
+
+        Non-Cocoa ports use default directory for ServiceWorker data during testing
+        https://bugs.webkit.org/show_bug.cgi?id=183784
+
+        Reviewed by Youenn Fablet.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::platformAdjustContext): Set the service worker registration
+        directory through the new WKWebsiteDataStore API for non-Cocoa ports.
+
 2018-04-08  Zalan Bujtas  <za...@apple.com>
 
         [LayoutReloaded] Adjust line with inline container's margin border and padding

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (230388 => 230389)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2018-04-09 04:55:23 UTC (rev 230388)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2018-04-09 06:31:05 UTC (rev 230389)
@@ -2396,6 +2396,14 @@
 {
     auto* dataStore = WKContextGetWebsiteDataStore(context);
     WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(dataStore, true);
+
+    if (const char* dumpRenderTreeTemp = libraryPathForTesting()) {
+        String temporaryFolder = String::fromUTF8(dumpRenderTreeTemp);
+        const char separator = '/';
+
+        WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(dataStore, toWK(temporaryFolder + separator + "ServiceWorkerRegistration").get());
+    }
+
     return context;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to