mirror of
https://github.com/electron/electron.git
synced 2026-01-31 02:08:34 -05:00
fix: crash when navigating from a page with webview that has inherited zoom level (#24757)
* fix: cleanup webview zoom level observers on navigation * add spec * webview should be on same partition * wait for webview to finish loading
This commit is contained in:
@@ -1413,6 +1413,11 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||
// we need to make sure the api::WebContents is also deleted.
|
||||
// For #4, the WebContents will be destroyed by embedder.
|
||||
void WebContents::WebContentsDestroyed() {
|
||||
// Give chance for guest delegate to cleanup its observers
|
||||
// since the native class is only destroyed in the next tick.
|
||||
if (guest_delegate_)
|
||||
guest_delegate_->WillDestroy();
|
||||
|
||||
// Cleanup relationships with other parts.
|
||||
RemoveFromWeakMap();
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ void WebViewGuestDelegate::AttachToIframe(
|
||||
api_web_contents_->Emit("did-attach");
|
||||
}
|
||||
|
||||
void WebViewGuestDelegate::WillDestroy() {
|
||||
ResetZoomController();
|
||||
}
|
||||
|
||||
void WebViewGuestDelegate::DidDetach() {
|
||||
ResetZoomController();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
|
||||
// Attach to the iframe.
|
||||
void AttachToIframe(content::WebContents* embedder_web_contents,
|
||||
int embedder_frame_id);
|
||||
void WillDestroy();
|
||||
|
||||
protected:
|
||||
// content::BrowserPluginGuestDelegate:
|
||||
|
||||
Reference in New Issue
Block a user