Add devtools API to inspect shared worker. (#16615)

This commit is contained in:
michtsu 2019-02-01 10:44:24 -08:00 committed by Shelley Vohr
parent efe52f66e4
commit 392458b252
6 changed files with 31 additions and 0 deletions

View file

@ -1416,6 +1416,23 @@ void WebContents::InspectElement(int x, int y) {
managed_web_contents()->InspectElement(x, y);
}
void WebContents::InspectSharedWorker() {
if (type_ == REMOTE)
return;
if (!enable_devtools_)
return;
for (const auto& agent_host : content::DevToolsAgentHost::GetOrCreateAll()) {
if (agent_host->GetType() ==
content::DevToolsAgentHost::kTypeSharedWorker) {
OpenDevTools(nullptr);
managed_web_contents()->AttachTo(agent_host);
break;
}
}
}
void WebContents::InspectServiceWorker() {
if (type_ == REMOTE)
return;
@ -2178,6 +2195,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("unregisterServiceWorker",
&WebContents::UnregisterServiceWorker)
.SetMethod("inspectServiceWorker", &WebContents::InspectServiceWorker)
.SetMethod("inspectSharedWorker", &WebContents::InspectSharedWorker)
#if BUILDFLAG(ENABLE_PRINTING)
.SetMethod("_print", &WebContents::Print)
.SetMethod("_getPrinters", &WebContents::GetPrinterList)