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

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

Issue 2917643002: PlzNavigate: Fix ServiceWorkerHandler not finding WebContents. (Closed)
Patch Set: Shorter comment. 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_core.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..31abe59123ef756bb78ebc6a46301d09ec6a0fa9 100644
--- a/content/browser/devtools/protocol/service_worker_handler.cc
+++ b/content/browser/devtools/protocol/service_worker_handler.cc
@@ -371,10 +371,13 @@ 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. Use the |web_contents_getter| instead.
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)
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698