Index: content/browser/devtools/protocol/service_worker_handler.cc |
diff --git a/content/browser/devtools/protocol/service_worker_handler.cc b/content/browser/devtools/protocol/service_worker_handler.cc |
index 242d33e6d9beb955a9e7f113594da5a9daf7bf02..7a1972a2abca87e1f7a26f8e130ee981ac40a3c4 100644 |
--- a/content/browser/devtools/protocol/service_worker_handler.cc |
+++ b/content/browser/devtools/protocol/service_worker_handler.cc |
@@ -371,10 +371,16 @@ void ServiceWorkerHandler::OnWorkerVersionUpdated( |
protocol::Array<std::string>::create(); |
for (const auto& client : version.clients) { |
if (client.second.type == SERVICE_WORKER_PROVIDER_FOR_WINDOW) { |
- RenderFrameHostImpl* render_frame_host = RenderFrameHostImpl::FromID( |
- client.second.process_id, client.second.route_id); |
+ // PlzNavigate: a navigation may not yet be associated with a |
+ // RenderFrameHost. The |web_contents_getter| has been introduced for |
+ // getting the WebContents with PlzNavigate without using the |
+ // RenderFrameHost. |
+ // See https://crbug.com/725818. |
WebContents* web_contents = |
- WebContents::FromRenderFrameHost(render_frame_host); |
+ client.second.web_contents_getter |
+ ? client.second.web_contents_getter.Run() |
+ : WebContents::FromRenderFrameHost(RenderFrameHostImpl::FromID( |
+ client.second.process_id, client.second.route_id)); |
// There is a possibility that the frame is already deleted |
// because of the thread hopping. |
if (!web_contents) |