Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: content/browser/devtools/protocol/service_worker_handler.cc

Issue 2917643002: PlzNavigate: Fix ServiceWorkerHandler not finding WebContents. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698