Skip to content
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

Multiple file delete end dev closewv2 #3114

Closed

Conversation

yunate
Copy link
Contributor

@yunate yunate commented Jan 9, 2023

Before, we have implemented profile's Delete API, but it has some bugs, so we should modify it.

At present, the relationship between profile and WebView is:

One profile can have multiple WebView, those WebView can be in same process or different process.
InPrivate profile share same local file with normal profile.
image

So, when Delete API is called, we should raise an event handle to tell every webview2 under this profile that the profile has called Delete API.

Local files delete logic of Delete API will follow Edge’s delete logic. And the Edge’s profile delete logic is:

  • The profile is marked as deleted, it not only in process memory, but also record in local file (%user-data-dir%/Local State). When the browser process exits, it will try to delete the marked profile, this may be failure for some file is occupied by some process or the browser process crashes, the truly delete action is not executed. Anyway, for some reason the local file may not be deleted successfully, in this case, when the browser run next time, it will check if %user-data-dir%/Local State file has recorded some profile is marked as deleted, if there is, it will try to delete again. If it still failure, next time the browser runs, it will check again until successful. When deleting local file successfully, it will remove the record from %user-data-dir%/Local State file. 

The Delete API new design is based on the above fact. When Delete API is called, the actions are: 

  1. Close the webview2 under the profile.
  2. Raise an event handle Profile.ProfileDeletionStarted to notify each profile. It is recommended to do some clean works and then close the webview2.
  3. Profile creation will fail with the HRESULT is ERROR_INVALID_STATE(0x8007139FL) if create a new profile with the same name as a profile that is marked as deleted.
  4. The local profile’s directory will be deleted on browser process exit or next start.
    image

@yunate yunate added the API Proposal Review WebView2 API Proposal for review. label Jan 9, 2023
@david-risney
Copy link
Contributor

david-risney commented Mar 30, 2023

I think this PR is out of date and the newer one we want is #3069, is that correct? If so, can you please close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment