chore: debug crash on DevTools SetOwnerWindow (#47243)
This commit is contained in:
parent
5e3b5ef04c
commit
c6f368acc6
3 changed files with 9 additions and 1 deletions
|
@ -2147,8 +2147,11 @@ void WebContents::DevToolsOpened() {
|
||||||
// Inherit owner window in devtools when it doesn't have one.
|
// Inherit owner window in devtools when it doesn't have one.
|
||||||
auto* devtools = inspectable_web_contents_->GetDevToolsWebContents();
|
auto* devtools = inspectable_web_contents_->GetDevToolsWebContents();
|
||||||
bool has_window = devtools->GetUserData(NativeWindowRelay::UserDataKey());
|
bool has_window = devtools->GetUserData(NativeWindowRelay::UserDataKey());
|
||||||
if (owner_window() && !has_window)
|
if (owner_window_ && !has_window) {
|
||||||
|
DCHECK(!owner_window_.WasInvalidated());
|
||||||
|
DCHECK_EQ(handle->owner_window(), nullptr);
|
||||||
handle->SetOwnerWindow(devtools, owner_window());
|
handle->SetOwnerWindow(devtools, owner_window());
|
||||||
|
}
|
||||||
|
|
||||||
Emit("devtools-opened");
|
Emit("devtools-opened");
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,6 +530,8 @@ void InspectableWebContents::CloseWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContents::LoadCompleted() {
|
void InspectableWebContents::LoadCompleted() {
|
||||||
|
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||||
|
|
||||||
frontend_loaded_ = true;
|
frontend_loaded_ = true;
|
||||||
if (managed_devtools_web_contents_)
|
if (managed_devtools_web_contents_)
|
||||||
view_->ShowDevTools(activate_);
|
view_->ShowDevTools(activate_);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "base/containers/unique_ptr_adapters.h"
|
#include "base/containers/unique_ptr_adapters.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
|
#include "base/sequence_checker.h"
|
||||||
#include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h"
|
#include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h"
|
||||||
#include "content/public/browser/devtools_agent_host.h"
|
#include "content/public/browser/devtools_agent_host.h"
|
||||||
#include "content/public/browser/devtools_frontend_host.h"
|
#include "content/public/browser/devtools_frontend_host.h"
|
||||||
|
@ -271,6 +272,8 @@ class InspectableWebContents
|
||||||
// use, which guarantees that this set must not be persisted.
|
// use, which guarantees that this set must not be persisted.
|
||||||
base::flat_set<std::string> synced_setting_names_;
|
base::flat_set<std::string> synced_setting_names_;
|
||||||
|
|
||||||
|
SEQUENCE_CHECKER(sequence_checker_);
|
||||||
|
|
||||||
base::WeakPtrFactory<InspectableWebContents> weak_factory_{this};
|
base::WeakPtrFactory<InspectableWebContents> weak_factory_{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue