WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
175995
[Cache API] Support cache names persistency
https://bugs.webkit.org/show_bug.cgi?id=175995
Summary
[Cache API] Support cache names persistency
youenn fablet
Reported
2017-08-25 14:10:19 PDT
Add support for cache names persistency
Attachments
Patch
(56.33 KB, patch)
2017-08-25 15:43 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(56.91 KB, patch)
2017-08-25 15:58 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(56.97 KB, patch)
2017-08-25 16:28 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(58.30 KB, patch)
2017-08-25 17:03 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(58.06 KB, patch)
2017-08-28 13:36 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(69.10 KB, patch)
2017-08-28 17:05 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(70.53 KB, patch)
2017-08-28 17:38 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(55.02 KB, patch)
2017-08-29 16:36 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(54.88 KB, patch)
2017-08-30 14:54 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2017-08-25 15:43:57 PDT
Created
attachment 319106
[details]
Patch
Build Bot
Comment 2
2017-08-25 15:46:28 PDT
Attachment 319106
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] Total errors found: 3 in 22 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 3
2017-08-25 15:58:40 PDT
Created
attachment 319107
[details]
Patch
Build Bot
Comment 4
2017-08-25 15:59:41 PDT
Attachment 319107
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] Total errors found: 3 in 23 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 5
2017-08-25 16:28:50 PDT
Created
attachment 319114
[details]
Patch
Build Bot
Comment 6
2017-08-25 16:31:20 PDT
Attachment 319114
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:123: More than one command on the same line [whitespace/newline] [4] Total errors found: 4 in 23 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 7
2017-08-25 17:03:52 PDT
Created
attachment 319119
[details]
Patch
Build Bot
Comment 8
2017-08-25 17:06:32 PDT
Attachment 319119
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:123: More than one command on the same line [whitespace/newline] [4] Total errors found: 4 in 25 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 9
2017-08-28 12:15:01 PDT
Comment on
attachment 319119
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=319119&action=review
> Source/WebCore/Modules/cache/CacheStorageConnection.h:49 > + // Used only for testing purposes. > + virtual void setPersistency(const String& /* origin */, bool /* isPersistent */, DOMCache::CompletionCallback&& callback) { callback(DOMCache::Error::NotImplemented); }
Maybe we should call this setPersistencyForTesting, and I think we should do something similar to setPrivateBrowsingEnabled instead and use SessionID to determine whether a cache should touch the disk or not.
youenn fablet
Comment 10
2017-08-28 13:36:47 PDT
Created
attachment 319201
[details]
Patch
Build Bot
Comment 11
2017-08-28 13:39:00 PDT
Attachment 319201
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:122: More than one command on the same line [whitespace/newline] [4] Total errors found: 4 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 12
2017-08-28 13:41:22 PDT
(In reply to Alex Christensen from
comment #9
)
> Comment on
attachment 319119
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=319119&action=review
> > > Source/WebCore/Modules/cache/CacheStorageConnection.h:49 > > + // Used only for testing purposes. > > + virtual void setPersistency(const String& /* origin */, bool /* isPersistent */, DOMCache::CompletionCallback&& callback) { callback(DOMCache::Error::NotImplemented); } > > Maybe we should call this setPersistencyForTesting, and I think we should do > something similar to setPrivateBrowsingEnabled instead and use SessionID to > determine whether a cache should touch the disk or not.
I was not sure whether we wanted to implement cache API in private browsing with in-memory-only caches. Let's do it then. This will probably end up having a much smaller quota for private browsing than for regular sessions. I removed setPersistencyForTesting and used setPrivateBrowsingEnabled in the test.
Sam Weinig
Comment 13
2017-08-28 14:13:05 PDT
Comment on
attachment 319201
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=319201&action=review
> Source/WebCore/Modules/cache/DOMCache.cpp:44 > + return Exception { TypeError, ASCIILiteral("Failed reading data from disk") };
I'm not sure 'disk' is the best name here, as many machines don't have hard-disks anymore. I like 'FileSystem' as a modifier, but I am sure we could come up with others.
Alex Christensen
Comment 14
2017-08-28 14:54:34 PDT
Comment on
attachment 319201
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=319201&action=review
> Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:47 > + String sessionSubdirectory = ASCIILiteral("session") + String::number(sessionID.sessionID()); > + return WebCore::pathByAppendingComponent(NetworkProcess::singleton().cacheStorageDirectory(), sessionSubdirectory);
This should be a String from the WebsiteDataStore.
youenn fablet
Comment 15
2017-08-28 17:05:40 PDT
Created
attachment 319219
[details]
Patch
Build Bot
Comment 16
2017-08-28 17:07:31 PDT
Attachment 319219
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:117: More than one command on the same line [whitespace/newline] [4] Total errors found: 4 in 38 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 17
2017-08-28 17:08:57 PDT
(In reply to Sam Weinig from
comment #13
)
> Comment on
attachment 319201
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=319201&action=review
> > > Source/WebCore/Modules/cache/DOMCache.cpp:44 > > + return Exception { TypeError, ASCIILiteral("Failed reading data from disk") }; > > I'm not sure 'disk' is the best name here, as many machines don't have > hard-disks anymore. I like 'FileSystem' as a modifier, but I am sure we > could come up with others.
Changed to "file system". (In reply to Alex Christensen from
comment #14
)
> Comment on
attachment 319201
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=319201&action=review
> > > Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:47 > > + String sessionSubdirectory = ASCIILiteral("session") + String::number(sessionID.sessionID()); > > + return WebCore::pathByAppendingComponent(NetworkProcess::singleton().cacheStorageDirectory(), sessionSubdirectory); > > This should be a String from the WebsiteDataStore.
I added a new parameter to WebsiteDataStoreParameters to pass the sub folder name. This enforces one main folder for cache storage and one subfolder for each cache storage engine.
youenn fablet
Comment 18
2017-08-28 17:38:06 PDT
Created
attachment 319221
[details]
Patch
Build Bot
Comment 19
2017-08-28 17:41:12 PDT
Attachment 319221
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:125: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:118: More than one command on the same line [whitespace/newline] [4] Total errors found: 4 in 39 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 20
2017-08-29 16:36:51 PDT
Created
attachment 319303
[details]
Patch
Build Bot
Comment 21
2017-08-29 16:38:55 PDT
Attachment 319303
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:105: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:129: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:111: More than one command on the same line [whitespace/newline] [4] Total errors found: 5 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 22
2017-08-30 13:41:54 PDT
Comment on
attachment 319303
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=319303&action=review
> Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:246 > + if (!shouldPersist()) { > + m_salt = makeSalt();
I don't think we should need a salt of it's not persistent.
> Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:361 > + callback(std::nullopt);
Let's put an ASSERT(RunLoop::isMain()); here.
> Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:384 > + callback(data, error);
Same here. It might be worth having a bunch of such assertions.
> Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:163 > + Vector<String> names; > + names.reserveInitialCapacity(count);
We should use the VectorCoders and put the reserveInitialCapacity optimization in them.
youenn fablet
Comment 23
2017-08-30 14:54:09 PDT
Created
attachment 319409
[details]
Patch for landing
Build Bot
Comment 24
2017-08-30 14:56:51 PDT
Attachment 319409
[details]
did not pass style-queue: ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:105: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:128: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:111: More than one command on the same line [whitespace/newline] [4] Total errors found: 5 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 25
2017-08-30 15:22:16 PDT
(In reply to Alex Christensen from
comment #22
)
> Comment on
attachment 319303
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=319303&action=review
> > > Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:246 > > + if (!shouldPersist()) { > > + m_salt = makeSalt(); > > I don't think we should need a salt of it's not persistent.
Will do as a follow-up
> > Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:361 > > + callback(std::nullopt); > > Let's put an ASSERT(RunLoop::isMain()); here.
OK
> > > Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:384 > > + callback(data, error); > > Same here. It might be worth having a bunch of such assertions.
OK
> > > Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp:163 > > + Vector<String> names; > > + names.reserveInitialCapacity(count); > > We should use the VectorCoders and put the reserveInitialCapacity > optimization in them.
I sticked with the current decoder since the encoder side is not using the Vector encoder either as it would need to create a vector of string for that.
WebKit Commit Bot
Comment 26
2017-08-30 15:50:26 PDT
Comment on
attachment 319409
[details]
Patch for landing Clearing flags on attachment: 319409 Committed
r221403
: <
http://trac.webkit.org/changeset/221403
>
WebKit Commit Bot
Comment 27
2017-08-30 15:50:28 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 28
2017-08-30 15:51:41 PDT
<
rdar://problem/34174534
>
Ryan Haddad
Comment 29
2017-08-31 09:04:30 PDT
The LayoutTest added with this change (http/tests/cache-storage/cache-persistency.https.html) is failing an assertion on El Capitan: ASSERTION FAILED: position != notFound /Volumes/Data/slave/elcapitan-debug/build/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp(130) : void WebKit::CacheStorage::Caches::remove(uint64_t, CompletionCallback &&)
https://build.webkit.org/results/Apple%20El%20Capitan%20Debug%20WK2%20(Tests)/r221417%20(2811)/results.html
youenn fablet
Comment 30
2017-08-31 09:31:42 PDT
(In reply to Ryan Haddad from
comment #29
)
> The LayoutTest added with this change > (http/tests/cache-storage/cache-persistency.https.html) is failing an > assertion on El Capitan: > > ASSERTION FAILED: position != notFound > /Volumes/Data/slave/elcapitan-debug/build/Source/WebKit/NetworkProcess/cache/ > CacheStorageEngineCaches.cpp(130) : void > WebKit::CacheStorage::Caches::remove(uint64_t, CompletionCallback &&) > >
https://build.webkit.org/results/
> Apple%20El%20Capitan%20Debug%20WK2%20(Tests)/r221417%20(2811)/results.html
Will have a look at it. Thanks!
Matt Lewis
Comment 31
2017-08-31 13:06:23 PDT
This change also caused several imported tests to fail intermittently and some to start timing out intermittently: Text diff:
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=imported%2Fw3c%2Fweb-platform-tests%2Fservice-workers%2Fcache-storage%2Fwindow%2Fcache-storage-keys.https.html
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=imported%2Fw3c%2Fweb-platform-tests%2Fservice-workers%2Fcache-storage%2Fworker%2Fcache-storage-keys.https.html
Timeout:
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=imported%2Fw3c%2Fweb-platform-tests%2Fservice-workers%2Fcache-storage%2Fcommon.https.html
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug