diff --git a/content/browser/devtools/protocol/target_handler.cc b/content/browser/devtools/protocol/target_handler.cc
index 7568beca10c6c..4e4573c3ad32d 100644
--- a/content/browser/devtools/protocol/target_handler.cc
+++ b/content/browser/devtools/protocol/target_handler.cc
@@ -119,6 +119,19 @@ std::unique_ptr<Target::TargetInfo> BuildTargetInfo(
   if (!subtype.empty()) {
     target_info->SetSubtype(subtype);
   }
+  WebContents* web_contents = host->GetWebContents();
+  if (web_contents) {
+    DevToolsManagerDelegate* delegate =
+        DevToolsManager::GetInstance()->delegate();
+    int tab_id, window_id;
+    if (delegate &&
+        delegate->GetTargetTabId(web_contents, &tab_id, &window_id)) {
+      target_info->SetTabId(tab_id);
+      if (window_id >= 0) {
+        target_info->SetWindowId(window_id);
+      }
+    }
+  }
   return target_info;
 }
 
@@ -1416,11 +1429,11 @@ void TargetHandler::DevToolsAgentHostDestroyed(DevToolsAgentHost* host) {
 }
 
 void TargetHandler::DevToolsAgentHostAttached(DevToolsAgentHost* host) {
-  TargetInfoChanged(host);
+  // TargetInfoChanged(host);
 }
 
 void TargetHandler::DevToolsAgentHostDetached(DevToolsAgentHost* host) {
-  TargetInfoChanged(host);
+  // TargetInfoChanged(host);
 }
 
 void TargetHandler::DevToolsAgentHostCrashed(DevToolsAgentHost* host,
