WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

Support clearing browsing data for a specific domain only with `ClearBrowsingDataAsync`

Open q71114 opened this issue 3 years ago • 10 comments

Is your feature request related to a problem? Please describe. Add support to CoreWebView2Profile.ClearBrowsingDataAsync to be able to clear browsing data only for specific domain / website. Currently CoreWebView2Profile.ClearBrowsingDataAsync only support clearing data per data kind and between a time range. However we want to be able to clear cache data for some domains only and leave the other data intact.

Describe the solution you'd like and alternatives you've considered Possible solutions

  1. ClearBrowsingDataAsync() should have a new overload that accepts a string to delete all data for a specific domain.
  2. Add support for InPrivate mode where no browsing data is persisted, so we can manage all data clearing on our side.

AB#41245729

q71114 avatar Sep 07 '22 07:09 q71114

I would like to use this feature too.

darbid avatar Sep 08 '22 04:09 darbid

Thanks for the feature request, we've added this to our backlog!

nishitha-burman avatar Sep 08 '22 16:09 nishitha-burman

Hi @q71114,

Can you describe the scenarios you are trying to build with this feature?

Thank you, Nishitha

nishitha-burman avatar Oct 19 '22 14:10 nishitha-burman

Hi @nishitha-burman,

This will be the exact scenario describe in Feature request: Permissions API: We offer option to clear all data for specific domains. When selected all user data will be cleared for those domains including any browsing data or cache.

q71114 avatar Oct 19 '22 17:10 q71114

Hi @q71114,

Can you use the Permission Management APIs to reset the state per domain using SetPermissionState?

nishitha-burman avatar Mar 28 '23 21:03 nishitha-burman

Hi @nishitha-burman ,

That will only clear the permission state but not the browsing data or cache. Also with the new Permission Management APIs and the SavesInProfile property the permission states are not even necessarily stored in WebView2 anymore.

q71114 avatar Mar 29 '23 10:03 q71114

Hey @nishitha-burman,

I gathered a two scenarios below which might help with your feature design.

Scenario 1 - clearing browsing data of specific domains only

  • User wants to clear all browsing data for bing.com and microsoft.com but wants to keep everything else intact.
  • For example:
    • User visited websites under github.com, bing.com, microsoft.com and various other hosts.
    • User was logged in to github.com and microsoft.com
    • After calling the new API:
      • they should still have all the cookies / caches from github.com and are still logged in to github.com
      • but all cookies / caches from microsoft.com and bing.com are deleted and they should not be logged in to microsoft.com anymore

Scenario 2 - clearing all browsing data except for specific domains

  • User wants to clear all browsing data of all websites except the ones for bing.com and microsoft.com.
  • For example:
    • User visited websites under github.com, bing.com, microsoft.com and various other hosts.
    • User was logged in to github.com and microsoft.com.
    • After calling the new API:
      • they should still have all the cookies / caches from microsoft.com / bing.com and are still logged in to microsoft.com
      • all cookies / caches for all other hosts including github.com are deleted and they should not be logged in to github.com anymore
  • In theory this can be solved by using Scenario 1 and clearing every visited hosts one by one except bing.com / microsoft.com but having a separate API for it would make things easier.

Hope this helps, otherwise I can clarify further if needed.

q71114 avatar Apr 06 '23 15:04 q71114

Hi @q71114,

Thank you for the context. Can you see if using CDP's storage domain addresses your scenario? https://chromedevtools.github.io/devtools-protocol/tot/Storage/

Thanks!

nishitha-burman avatar Apr 24 '23 22:04 nishitha-burman

Hi @nishitha-burman ,

I'm afraid there's a number of stores that the WebView2's ClearBrowsingDataAsync method cleans up but the CDP's Storage.clearDataForOrigin misses:

  • \EBWebView\Default\Favicons
  • \EBWebView\Default\History
  • \EBWebView\Default\Top Sites
  • \EBWebView\Default\Cache\Cache_Data
  • \EBWebView\Default\Code Cache
  • \EBWebView\Default\Network\Network Persistent State
  • \EBWebView\Default\Network\Reporting and NEL

(There might be others, but these are the ones discovered through our first pass). These stores might have been added by Edge, thus CDP misses them when doing cleanup.

As such, we can't purely rely on the CDP methods.

RendijsSmukulis avatar May 03 '23 16:05 RendijsSmukulis

Hi, it's been over a year since the last update. Any updates on the feature request?

MarkIngramUK avatar Jun 20 '24 14:06 MarkIngramUK