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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 2154663002: service worker: Relax the BadMessageReceived call in OnSetHostedVersionId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: newl Created 4 years, 5 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/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index c557be4c0497c838b5a7f0fe62d885cdc3c7c0be..08936fd0744a4edbdbe094a3277e8ab74643c749 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -852,7 +852,8 @@ void ServiceWorkerDispatcherHost::OnProviderDestroyed(int provider_id) {
}
void ServiceWorkerDispatcherHost::OnSetHostedVersionId(int provider_id,
- int64_t version_id) {
+ int64_t version_id,
+ int embedded_worker_id) {
TRACE_EVENT0("ServiceWorker",
"ServiceWorkerDispatcherHost::OnSetHostedVersionId");
if (!GetContext())
@@ -883,6 +884,11 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId(int provider_id,
if (!version || version->running_status() != EmbeddedWorkerStatus::STARTING)
return;
+ // If the version has a different embedded worker, assume the message is about
+ // a detached worker and ignore.
+ if (version->embedded_worker()->embedded_worker_id() != embedded_worker_id)
+ return;
+
// A process for the worker must be equal to a process for the provider host.
if (version->embedded_worker()->process_id() != provider_host->process_id()) {
bad_message::ReceivedBadMessage(

Powered by Google App Engine
This is Rietveld 408576698