Bug 178316 - Implement Cache API support for WPE/GTK
Summary: Implement Cache API support for WPE/GTK
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: darshan
URL:
Keywords: InRadar
: 190912 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-14 16:05 PDT by youenn fablet
Modified: 2018-11-12 23:41 PST (History)
9 users (show)

See Also:


Attachments
Patch (5.47 KB, patch)
2017-10-14 16:08 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (5.46 KB, patch)
2017-10-14 16:29 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
fixed cache quota test for wpe (4.92 KB, patch)
2018-10-29 10:58 PDT, darshan
fred.wang: review-
Details | Formatted Diff | Diff
fixed cache quota test for gkt (5.11 KB, patch)
2018-11-01 10:42 PDT, darshan
no flags Details | Formatted Diff | Diff
fixed cache quota test for gkt/wpe (6.68 KB, patch)
2018-11-02 11:14 PDT, darshan
fred.wang: review+
fred.wang: commit-queue-
Details | Formatted Diff | Diff
fixed cache quota test with all the platform having same storage (6.72 KB, patch)
2018-11-02 11:53 PDT, darshan
fred.wang: review-
fred.wang: commit-queue-
Details | Formatted Diff | Diff
fixed cache quota test for gkt/wpe (7.11 KB, patch)
2018-11-03 07:20 PDT, darshan
no flags Details | Formatted Diff | Diff
fixed cache quota test with all the platform having same storage (7.19 KB, patch)
2018-11-03 09:38 PDT, darshan
no flags Details | Formatted Diff | Diff
fixed cache quota test with all the platform having same storage (8.12 KB, patch)
2018-11-03 10:57 PDT, darshan
no flags Details | Formatted Diff | Diff
fixed cache quota test with all the platform having same storage (9.29 KB, patch)
2018-11-03 11:49 PDT, darshan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2 (9.72 MB, application/zip)
2018-11-03 13:51 PDT, EWS Watchlist
no flags Details
fixed cache quota test with all the platform having same storage (9.30 KB, patch)
2018-11-03 23:23 PDT, darshan
youennf: review+
Details | Formatted Diff | Diff
fixed cache quota test with all the platform having same storage-- with c api not removed (7.21 KB, patch)
2018-11-09 10:01 PST, darshan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2017-10-14 16:05:32 PDT
In the meantime, related tests should be skipped.
Comment 1 youenn fablet 2017-10-14 16:08:48 PDT
Created attachment 323828 [details]
Patch
Comment 2 WebKit Commit Bot 2017-10-14 16:09:55 PDT
Comment on attachment 323828 [details]
Patch

Rejecting attachment 323828 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'validate-changelog', '--check-oops', '--non-interactive', 323828, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.

Full output: http://webkit-queues.webkit.org/results/4858971
Comment 3 youenn fablet 2017-10-14 16:29:25 PDT
Created attachment 323833 [details]
Patch
Comment 4 WebKit Commit Bot 2017-10-14 16:57:23 PDT
Comment on attachment 323833 [details]
Patch

Clearing flags on attachment: 323833

Committed r223325: <https://trac.webkit.org/changeset/223325>
Comment 5 WebKit Commit Bot 2017-10-14 16:57:24 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2017-10-14 16:58:28 PDT
<rdar://problem/34995899>
Comment 7 Michael Catanzaro 2017-10-14 17:05:06 PDT
Reopening
Comment 8 Frédéric Wang (:fredw) 2018-10-02 09:01:26 PDT
The remaining failure is http/wpt/cache-storage/cache-quota.any.html
Comment 9 Frédéric Wang (:fredw) 2018-10-07 23:47:07 PDT
(In reply to Frédéric Wang (:fredw) from comment #8)
> The remaining failure is http/wpt/cache-storage/cache-quota.any.html

@Youenn: Can you please write down details regarding what we discussed during the hackfest about how this is supposed to be fixed (reducing max cache size for test runner)?
Comment 10 youenn fablet 2018-10-08 08:43:03 PDT
(In reply to Frédéric Wang (:fredw) from comment #9)
> (In reply to Frédéric Wang (:fredw) from comment #8)
> > The remaining failure is http/wpt/cache-storage/cache-quota.any.html
> 
> @Youenn: Can you please write down details regarding what we discussed
> during the hackfest about how this is supposed to be fixed (reducing max
> cache size for test runner)?

Quota in WebKitTestRunner is set to 400 * 1024 in TestControllerCocoa.mm.
GTK WTR should be set up the same.
Comment 11 Frédéric Wang (:fredw) 2018-10-25 12:14:05 PDT
*** Bug 190912 has been marked as a duplicate of this bug. ***
Comment 12 darshan 2018-10-29 10:58:42 PDT
Created attachment 353300 [details]
fixed cache quota test for wpe
Comment 13 Frédéric Wang (:fredw) 2018-10-29 11:12:51 PDT
Comment on attachment 353300 [details]
fixed cache quota test for wpe

View in context: https://bugs.webkit.org/attachment.cgi?id=353300&action=review

> LayoutTests/ChangeLog:3
> +        Implement Cache API support for WPE/GTK

Can you please unskip the test on WPE too?

> LayoutTests/platform/gtk/TestExpectations:1143
> +webkit.org/b/178316 http/wpt/cache-storage/cache-quota.any.html [ Pass ]

Please update your tree. In the latest revision, only http/wpt/cache-storage/cache-quota.any.html is marked as failing and you need to remove this expectation.
Comment 14 Frédéric Wang (:fredw) 2018-10-29 11:21:41 PDT
Comment on attachment 353300 [details]
fixed cache quota test for wpe

View in context: https://bugs.webkit.org/attachment.cgi?id=353300&action=review

> Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp:117
> +    WKWebsiteDataStoreSetCacheStoragePerOriginQuota(websiteDataStore, 400 * 1024);

We want the same on WPE too. I'm willing to see what the result of EWS is. if that works, we can try to move everything to the main TestController class as Michael suggested on another bug.
Comment 15 darshan 2018-11-01 10:42:01 PDT
Created attachment 353616 [details]
fixed cache quota test for gkt
Comment 16 darshan 2018-11-02 11:14:04 PDT
Created attachment 353717 [details]
fixed cache quota test for gkt/wpe

Implemented the cache quota limit for wpt/gtk
Comment 17 darshan 2018-11-02 11:53:13 PDT
Created attachment 353720 [details]
fixed cache quota test with all the platform having same storage
Comment 18 Frédéric Wang (:fredw) 2018-11-03 04:34:42 PDT
Comment on attachment 353720 [details]
fixed cache quota test with all the platform having same storage

View in context: https://bugs.webkit.org/attachment.cgi?id=353720&action=review

> LayoutTests/ChangeLog:10
> +

The three ChangeLogs should be updated and completed with explanations in the final patch.

> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h:116
> +WK_EXPORT void WKWebsiteDataStoreSetCacheStoragePerOriginQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota);

It seems this new line was on purpose (to separate ServiceWorkerRegistrationDirectory) so you should not remove it

> Tools/WebKitTestRunner/TestController.cpp:479
> +    initializeCacheStoragePerOriginQuota();

I think you can just call WKWebsiteDataStoreSetCacheStoragePerOriginQuota here and remove Cocoa-specific stuff.

> Tools/WebKitTestRunner/TestController.cpp:527
> +{

I don't think you need this function if it's only called in TestController::generatePageConfiguration()
Comment 19 Frédéric Wang (:fredw) 2018-11-03 04:39:38 PDT
Comment on attachment 353717 [details]
fixed cache quota test for gkt/wpe

View in context: https://bugs.webkit.org/attachment.cgi?id=353717&action=review

OK, this patch looks good to me. Great that the tests are passing on WPE/GTK now! I'm marked r+ but I see you already started to do the refactoring suggested by Michael, so let's just finish that refactoring in this bug then. It is probably not be hard enough to justify a follow-up bug.

> LayoutTests/ChangeLog:10
> +

As I said for the other patch, you should give details of the changes in the ChangeLog.

> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h:-116
> -

As I said for the other patch, you probably don't want to remove that new line.
Comment 20 Michael Catanzaro 2018-11-03 07:08:19 PDT
Comment on attachment 353720 [details]
fixed cache quota test with all the platform having same storage

View in context: https://bugs.webkit.org/attachment.cgi?id=353720&action=review

> Tools/WebKitTestRunner/TestController.cpp:529
> +    WKWebsiteDataStoreSetCacheStoragePerOriginQuota(websiteDataStore, 400 * 1024);

Yes, the Cocoa call really needs to be removed from TestControllerCocoa.cpp, because it's redundant with this call. Doesn't make sense to do the same thing twice. And then remove the Cocoa SPI, since you'd be removing its only use. And then this will be good IMO!
Comment 21 darshan 2018-11-03 07:20:50 PDT
Created attachment 353771 [details]
fixed cache quota test for gkt/wpe
Comment 22 darshan 2018-11-03 09:38:46 PDT
Created attachment 353775 [details]
fixed cache quota test with all the platform having same storage
Comment 23 Frédéric Wang (:fredw) 2018-11-03 10:19:30 PDT
Comment on attachment 353771 [details]
fixed cache quota test for gkt/wpe

Let's focus on the platform independent way, now that you already started it, okay?
Comment 24 Frédéric Wang (:fredw) 2018-11-03 10:22:41 PDT
Comment on attachment 353775 [details]
fixed cache quota test with all the platform having same storage

View in context: https://bugs.webkit.org/attachment.cgi?id=353775&action=review

> Source/WebKit/ChangeLog:8
> +        Added a new API function WKWebsiteDataStoreSetCacheStoragePerOriginQuota which set the 

sets

> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h:116
> +WK_EXPORT void WKWebsiteDataStoreSetCacheStoragePerOriginQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota);

nit: you should probably still add a new line to separate WKWebsiteDataStoreSetCacheStoragePerOriginQuota from the ServiceWorker API functions.

> Tools/ChangeLog:8
> +        Called WKWebsiteDataStoreSetCacheStoragePerOriginQuota funtion to set the cache limit to 400 * 1200

s/funtion/function/

> Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm:-72
> -    [poolWebsiteDataStore _setCacheStoragePerOriginQuota: 400 * 1024];

As Michael mentioned in comment 20, you can now probably remove the _setCacheStoragePerOriginQuota function and all the related logic.
Comment 25 darshan 2018-11-03 10:57:23 PDT
Created attachment 353778 [details]
fixed cache quota test with all the platform having same storage
Comment 26 Frédéric Wang (:fredw) 2018-11-03 11:20:57 PDT
Comment on attachment 353778 [details]
fixed cache quota test with all the platform having same storage

View in context: https://bugs.webkit.org/attachment.cgi?id=353778&action=review

> Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm:-271
> -

I believe it should be removed from Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h too.
Comment 27 darshan 2018-11-03 11:49:13 PDT
Created attachment 353779 [details]
fixed cache quota test with all the platform having same storage
Comment 28 EWS Watchlist 2018-11-03 13:51:38 PDT
Comment on attachment 353779 [details]
fixed cache quota test with all the platform having same storage

Attachment 353779 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/9847208

New failing tests:
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setRemoteDescription-tracks.https.html
Comment 29 EWS Watchlist 2018-11-03 13:51:40 PDT
Created attachment 353782 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 30 Frédéric Wang (:fredw) 2018-11-03 15:19:15 PDT
Comment on attachment 353779 [details]
fixed cache quota test with all the platform having same storage

Thanks, this looks good to me now! The test failure seemed unrelated.

@Youenn: Can you please review this? (as this patch removes the _setCacheStoragePerOriginQuota function from WKWebsiteDataStorePrivate.h)
Comment 31 Michael Catanzaro 2018-11-03 17:44:09 PDT
Comment on attachment 353779 [details]
fixed cache quota test with all the platform having same storage

View in context: https://bugs.webkit.org/attachment.cgi?id=353779&action=review

I agree this version is much better. LGTM now.

> Tools/WebKitTestRunner/TestController.cpp:481
> +    WKWebsiteDataStoreSetCacheStoragePerOriginQuota(websiteDataStore, 400 * 1024);
>      platformInitializeContext();

Leave a blank line there, because this code is not closely-related to the call to platformInitializeContext().
Comment 32 darshan 2018-11-03 23:23:41 PDT
Created attachment 353797 [details]
fixed cache quota test with all the platform having same storage
Comment 33 darshan 2018-11-03 23:24:29 PDT
> Leave a blank line there, because this code is not closely-related to the
> call to platformInitializeContext().

Donee
Comment 34 Frédéric Wang (:fredw) 2018-11-04 05:09:33 PST
@dkadu: You should not close this bug before the fix actually lands.
Comment 35 youenn fablet 2018-11-04 20:00:49 PST
Comment on attachment 353797 [details]
fixed cache quota test with all the platform having same storage

View in context: https://bugs.webkit.org/attachment.cgi?id=353797&action=review

> Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:-51
> -@property (nonatomic, setter=_setCacheStoragePerOriginQuota:) NSUInteger _cacheStoragePerOriginQuota WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));

I do not think we should remove the ObjC API.
When adding a C API, we want to have a corresponding ObjC API as well.
Other parts of the patch looks ok.
Comment 36 Frédéric Wang (:fredw) 2018-11-05 04:52:59 PST
(In reply to youenn fablet from comment #35)
> Comment on attachment 353797 [details]
> fixed cache quota test with all the platform having same storage
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=353797&action=review
> 
> > Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:-51
> > -@property (nonatomic, setter=_setCacheStoragePerOriginQuota:) NSUInteger _cacheStoragePerOriginQuota WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
> 
> I do not think we should remove the ObjC API.
> When adding a C API, we want to have a corresponding ObjC API as well.
> Other parts of the patch looks ok.

OK, thanks!

@Darshan: Can you please do this final change? I think the patch is ready to land after that!
Comment 37 Michael Catanzaro 2018-11-05 08:21:26 PST
(In reply to youenn fablet from comment #35)
> I do not think we should remove the ObjC API.
> When adding a C API, we want to have a corresponding ObjC API as well.
> Other parts of the patch looks ok.

Removing the ObjC API is what I've done in the past. What's the point of having an internal API that is no longer used anywhere?
Comment 38 Michael Catanzaro 2018-11-07 12:26:09 PST
Youenn, what do you think?
Comment 39 youenn fablet 2018-11-07 16:48:28 PST
(In reply to Michael Catanzaro from comment #37)
> (In reply to youenn fablet from comment #35)
> > I do not think we should remove the ObjC API.
> > When adding a C API, we want to have a corresponding ObjC API as well.
> > Other parts of the patch looks ok.
> 
> Removing the ObjC API is what I've done in the past. What's the point of
> having an internal API that is no longer used anywhere?

These APIs can be used not only by WebKitTestRunner but by other apps as well for which ObjC is the preferred approach. There is of course a tension between keeping parity between the two and having APIs that do not get tested. An API test for the ObjC API might be good (not in this patch though).
Comment 40 youenn fablet 2018-11-07 16:49:50 PST
Comment on attachment 353797 [details]
fixed cache quota test with all the platform having same storage

Please do not remove the ObjC API.
Comment 41 Michael Catanzaro 2018-11-07 17:00:54 PST
(In reply to youenn fablet from comment #39)
> These APIs can be used not only by WebKitTestRunner but by other apps as
> well for which ObjC is the preferred approach.

But it's in the Private.h header, so it shouldn't be accessible outside WebKit?
Comment 42 Michael Catanzaro 2018-11-07 17:01:30 PST
I mean, it's in WKWebsiteDataStorePrivate.h. Surely it should move to a public header if it's intended to be public?
Comment 43 youenn fablet 2018-11-07 17:24:46 PST
(In reply to Michael Catanzaro from comment #42)
> I mean, it's in WKWebsiteDataStorePrivate.h. Surely it should move to a
> public header if it's intended to be public?

Indeed, it might move to public at some point.
Comment 44 darshan 2018-11-09 10:01:21 PST
Created attachment 354355 [details]
fixed cache quota test with all the platform having same storage-- with c api not removed
Comment 45 Wenson Hsieh 2018-11-11 15:21:01 PST
(In reply to Michael Catanzaro from comment #41)
> (In reply to youenn fablet from comment #39)
> > These APIs can be used not only by WebKitTestRunner but by other apps as
> > well for which ObjC is the preferred approach.
> 
> But it's in the Private.h header, so it shouldn't be accessible outside
> WebKit?

FYI — WebKit headers that are marked private still appear in the Apple internal SDK, and as such, are generally accessible to Apple-internal clients such as Mail and Safari.
Comment 46 WebKit Commit Bot 2018-11-12 23:41:37 PST
Comment on attachment 354355 [details]
fixed cache quota test with all the platform having same storage-- with c api not removed

Clearing flags on attachment: 354355

Committed r238125: <https://trac.webkit.org/changeset/238125>