Commit fe6b1c49 authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

DevTools: don't retain inspected agent_host while reloading front-end.

This change also does not force extension popup close upon inspect session
termination.

Bug: 795403
Change-Id: I9ab3e8f0f6b5360f1475f302ab34d18b5b53939f
Reviewed-on: https://chromium-review.googlesource.com/830983Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524563}
parent eed54aca
......@@ -636,7 +636,7 @@ void DevToolsUIBindings::HandleMessageFromDevToolsFrontend(
void DevToolsUIBindings::DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host, const std::string& message) {
DCHECK(agent_host == agent_host_.get());
if (!frontend_host_)
if (!frontend_host_ || reloading_)
return;
if (message.length() < kMaxMessageChunkSize) {
......@@ -1070,7 +1070,7 @@ void DevToolsUIBindings::ReadyForTest() {
void DevToolsUIBindings::DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) {
if (agent_host_.get())
if (agent_host_.get() && !reloading_)
agent_host_->DispatchProtocolMessage(this, message);
}
......@@ -1322,8 +1322,6 @@ void DevToolsUIBindings::AttachTo(
void DevToolsUIBindings::Reload() {
reloading_ = true;
if (agent_host_)
agent_host_->DetachClient(this);
web_contents_->GetController().Reload(content::ReloadType::NORMAL, false);
}
......@@ -1406,8 +1404,10 @@ void DevToolsUIBindings::DocumentAvailableInMainFrame() {
if (!reloading_)
return;
reloading_ = false;
if (agent_host_.get())
if (agent_host_.get()) {
agent_host_->DetachClient(this);
InnerAttach();
}
}
void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() {
......
......@@ -128,9 +128,7 @@ void ExtensionPopup::DevToolsAgentHostDetached(
content::DevToolsAgentHost* agent_host) {
if (host()->host_contents() != agent_host->GetWebContents())
return;
// Widget::Close posts a task, which should give the devtools window a
// chance to finish detaching from the inspected RenderViewHost.
GetWidget()->Close();
inspect_with_devtools_ = false;
}
void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) {
......
......@@ -1232,6 +1232,8 @@ std::string RenderFrameDevToolsAgentHost::GetParentId() {
}
std::string RenderFrameDevToolsAgentHost::GetOpenerId() {
if (!frame_tree_node_)
return std::string();
FrameTreeNode* opener = frame_tree_node_->original_opener();
return opener ? opener->devtools_frame_token().ToString() : std::string();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment