fix: handle closing webContents in BrowserViews (#37420)

* fix: handle closing webContents in BrowserViews

* test: add window.close() test
This commit is contained in:
Shelley Vohr 2023-03-01 11:35:06 +01:00 committed by GitHub
parent 8fb0f43030
commit 5e25d23794
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 5 deletions

View file

@ -1223,9 +1223,7 @@ void WebContents::CloseContents(content::WebContents* source) {
for (ExtendedWebContentsObserver& observer : observers_)
observer.OnCloseContents();
// If there are observers, OnCloseContents will call Destroy()
if (observers_.empty())
Destroy();
Destroy();
}
void WebContents::ActivateContents(content::WebContents* source) {