mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: correctly notify WebViewGuestDelegate when webview is detached (#31350)
This commit is contained in:
@@ -939,8 +939,6 @@ WebContents::~WebContents() {
|
||||
}
|
||||
|
||||
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
|
||||
if (guest_delegate_)
|
||||
guest_delegate_->WillDestroy();
|
||||
|
||||
// This event is only for internal use, which is emitted when WebContents is
|
||||
// being destroyed.
|
||||
@@ -1957,6 +1955,10 @@ void WebContents::WebContentsDestroyed() {
|
||||
return;
|
||||
wrapper->SetAlignedPointerInInternalField(0, nullptr);
|
||||
|
||||
// Tell WebViewGuestDelegate that the WebContents has been destroyed.
|
||||
if (guest_delegate_)
|
||||
guest_delegate_->WillDestroy();
|
||||
|
||||
Observe(nullptr);
|
||||
Emit("destroyed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user