Commit 9aa4f6fb authored by Han Leon's avatar Han Leon Committed by Commit Bot

[ServiceWorker] Avoid using null thread local pointer while exiting worker thread

ServiceWorkerGlobalScope#registration (WebServiceWorkerRegistrationImpl)
can still be alive and handle incoming messages even the thread local
pointer ServiceWorkerContextClient::ThreadSpecificInstance() has already
been reset to nullptr by
ServiceWorkerContextClient::WillDestroyWorkerContext(), thus, we need to
add a guard logic into WebServiceWorkerRegistrationImpl to avoid
accessing nullptr.

BUG=852195

Change-Id: Ia07b88f40d195293db8690216bd46d1a22bd687a
Reviewed-on: https://chromium-review.googlesource.com/1098563Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Han Leon <leon.han@intel.com>
Cr-Commit-Position: refs/heads/master@{#567178}
parent c14930db
......@@ -314,7 +314,7 @@ WebServiceWorkerRegistrationImpl::GetOrCreateServiceWorkerObject(
provider_context_for_client_->GetOrCreateServiceWorkerObject(
std::move(info));
}
} else {
} else if (ServiceWorkerContextClient::ThreadSpecificInstance()) {
service_worker = ServiceWorkerContextClient::ThreadSpecificInstance()
->GetOrCreateServiceWorkerObject(std::move(info));
}
......
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