callback);
}
+void WebContents::InspectServiceWorker() {
+ for (const auto& agent_host : content::DevToolsAgentHost::GetOrCreateAll()) {
+ if (agent_host->GetType() ==
+ content::DevToolsAgentHost::TYPE_SERVICE_WORKER) {
+ OpenDevTools();
+ storage_->AttachTo(agent_host);
+ break;
+ }
+ }
+}
+
mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
if (template_.IsEmpty())
.SetMethod("hasServiceWorker", &WebContents::HasServiceWorker)
.SetMethod("unregisterServiceWorker",
&WebContents::UnregisterServiceWorker)
+ .SetMethod("inspectServiceWorker", &WebContents::InspectServiceWorker)
.Build());
return mate::ObjectTemplateBuilder(
void InspectElement(int x, int y);
void HasServiceWorker(const base::Callback<void(bool)>&);
void UnregisterServiceWorker(const base::Callback<void(bool)>&);
+ void InspectServiceWorker();
// Editing commands.
void Undo();
Starts inspecting element at position (`x`, `y`) of guest page.
+### `<webview>`.inspectServiceWorker()
+
+Opens the devtools for the service worker context present in the guest page.
+
### `<webview>`.undo()
Executes editing command `undo` in page.