diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index aa9cb0fdd4a2..65c4610855f9 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -914,6 +914,7 @@ WebContents::~WebContents() { return; } + inspectable_web_contents_->GetView()->SetDelegate(nullptr); if (guest_delegate_) guest_delegate_->WillDestroy(); @@ -1760,6 +1761,7 @@ void WebContents::DevToolsOpened() { v8::Locker locker(isolate); v8::HandleScope handle_scope(isolate); DCHECK(inspectable_web_contents_); + DCHECK(inspectable_web_contents_->GetDevToolsWebContents()); auto handle = FromOrCreate( isolate, inspectable_web_contents_->GetDevToolsWebContents()); devtools_web_contents_.Reset(isolate, handle.ToV8()); diff --git a/shell/browser/ui/inspectable_web_contents.h b/shell/browser/ui/inspectable_web_contents.h index f49179815859..e59976a73738 100644 --- a/shell/browser/ui/inspectable_web_contents.h +++ b/shell/browser/ui/inspectable_web_contents.h @@ -201,12 +201,6 @@ class InspectableWebContents void AddDevToolsExtensionsToClient(); #endif - bool frontend_loaded_ = false; - scoped_refptr agent_host_; - std::unique_ptr frontend_host_; - std::unique_ptr - embedder_message_dispatcher_; - DevToolsContentsResizingStrategy contents_resizing_strategy_; gfx::Rect devtools_bounds_; bool can_dock_ = true; @@ -228,6 +222,12 @@ class InspectableWebContents bool is_guest_; std::unique_ptr view_; + bool frontend_loaded_ = false; + scoped_refptr agent_host_; + std::unique_ptr frontend_host_; + std::unique_ptr + embedder_message_dispatcher_; + class NetworkResourceLoader; std::set, base::UniquePtrComparator> loaders_;