-
Notifications
You must be signed in to change notification settings - Fork 16.8k
feat: Options parameter for Session.clearData API
#41355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Options parameter for Session.clearData API
#41355
Conversation
Session.clearBrowsingData APISession.clearData API
172271f to
2a7614b
Compare
cfd34fc to
ccb1696
Compare
ccb1696 to
3ad52b7
Compare
zcbenz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
samuelmaddock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
Love the docs and options validation 👍
|
@clavin is there any more work to be done here or can this be merged? |
|
@codebytere No more work, please do merge! 😄 |
|
Release Notes Persisted
|
Description of Change
Adds an options parameter to the recent
Session.clearDataAPI (#40983) to configure what types of data are cleared and scope the behavior to include or exclude specific origins.Checklist
npm testpassesRelease Notes
Notes: Added options parameter to
Session.clearDataAPI.Proposed API (Docs)
ses.clearData([options])optionsObject (optional)dataTypesString[] (optional) - The types of data to clear. If undefined, will clear all types of data. See method details for possible values.originsString[] (optional) - Clear data for only these origins. Cannot be used withexcludeOrigins.excludeOriginsString[] (optional) - Clear data for all origins except these ones. Cannot be used withorigins.avoidClosingConnectionsboolean (optional) - Skips deleting cookies that would close current network connections.originMatchingModeString (optional) - The behavior for matching data to origins. Valid values are"third-parties-included"and"origin-in-all-contexts".Returns
Promise<void>- resolves when all data has been cleared.Clears various different types of data.
dataTypesmay include the following case-sensitive string values:backgroundFetchcachecookiesdownloadsfileSystemsindexedDBlocalStorageserviceWorkerswebSQLThis method clears more types of data and is more thourough than the
clearStorageDatamethod.Note: Cookies are stored at a broader scope than origins. When removing cookies and filtering by
origins(orexcludeOrigins), the cookies will be removed at the registrable domain level. For example, clearing cookies for the originhttps://really.specific.origin.example.com/will end up clearing all cookies forexample.com. Clearing cookies for the originhttps://my.website.example.co.uk/will end up clearing all cookies forexample.co.uk.For more information, refer to Chromium's
BrowsingDataRemoverinterface.Future Work
This may allow us to deprecate some other data clearing APIs we have:
clearCachecan be deprecated/reimplemented on top of this API.clearStorageDatacan be equivalently deprecated/reimplemented on top of this API.quotasoption, which there is no equivalent for in this proposed API; however, the"syncable"option is now deprecated and open to be cleaned up/removed in the future, and it is treated as the same as the other option. So, put short, this option no longer has a purpose and can be ignored. (To be clear: the other options ofclearStorageDatahave equivalents in this API.)shadercacheoption would no longer be specifiable on its own, but would be part ofcache. All other currentstoragesoptions have direct mappings in this API.clearStorageDatamethod, but I suspect these side effects are generally intended when calling a method to clear data.clearHostResolverCachecannot be deprecated or replaced by this API. The underlying Chromium API is not called as part of this API.clearAuthCachecannot be easily replaced by this API, but is called as part of this API. While the underlying Chromium API powering this method is called by this API as part of clearingcookies, this API cannot be narrowed down to just calling only this method since clearing cookies has many other effects beyond clearing the auth cache.clearCodeCachescannot be easily replaced by this API, but is called as part of this API. While the underlying Chromium API powering this method is called by this API as part of clearingcache, this API cannot be narrowed down to just calling only this method since clearing cache has many other effects beyond clearing the code cache.