Commit 62e1127b authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Show clients in the internal page

To investigate invalid states where a redundant service worker
is controlling clients.

DevTools' application tab shows clients nicely but it doesn't
show redundant service workers.

Bug: 1015692
Change-Id: I6102f5d897e8e91a49d8502d8876cac809a2c181
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890516Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712371}
parent 769978c9
......@@ -35,6 +35,11 @@
padding-left: 10px;
}
.serviceworker-client {
padding-bottom: 3px;
padding-left: 10px;
}
.controls a {
-webkit-margin-end: 16px;
color: #777;
......
......@@ -43,6 +43,10 @@
<span>DevTools agent route ID:</span>
<span jscontent="$this.devtools_agent_route_id"></span>
</div>
<div class="serviceworker-clients" jsselect="$this.clients">
<div>Client: </div>
<div transclude="serviceworker-client-template"></div>
</div>
<div>
<div>Log:</div>
<textarea class="serviceworker-log"
......@@ -135,7 +139,15 @@
</label>
</div>
</div>
</div>
<div id="serviceworker-client-template" class="serviceworker-client">
<div>
<span>ID: </span><span jscontent="$this.client_id"></span>
</div>
<div>
<span>URL: </span><span jscontent="$this.url"></span>
</div>
</div>
</div> <!-- templates end -->
<h1>ServiceWorker</h1>
<div class="content">
<div id="serviceworker-options"></div>
......
......@@ -153,6 +153,19 @@ void UpdateVersionInfo(const ServiceWorkerVersionInfo& version,
info->SetInteger("process_host_id", version.process_id);
info->SetInteger("thread_id", version.thread_id);
info->SetInteger("devtools_agent_route_id", version.devtools_agent_route_id);
auto clients = ListValue();
for (auto& it : version.clients) {
auto client = DictionaryValue();
client.SetStringPath("client_id", it.first);
if (it.second.web_contents_getter) {
WebContents* web_contents = it.second.web_contents_getter.Run();
if (web_contents)
client.SetStringPath("url", web_contents->GetURL().spec());
}
clients.Append(std::move(client));
}
info->SetPath("clients", std::move(clients));
}
std::unique_ptr<ListValue> GetRegistrationListValue(
......
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