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

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

Issue 2703153002: ServiceWorker: ignore AddMessageToConsole before process allocation (Closed)
Patch Set: remove unnecessary if Created 3 years, 10 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/embedded_worker_instance_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/embedded_worker_instance.cc
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc
index 4aed03ff82a51cd65a2e7578bda5e9b24fe9a98b..78c68563c696f612e64992892f5a512bedf3673b 100644
--- a/content/browser/service_worker/embedded_worker_instance.cc
+++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -871,9 +871,17 @@ base::TimeDelta EmbeddedWorkerInstance::UpdateStepTime() {
void EmbeddedWorkerInstance::AddMessageToConsole(
blink::WebConsoleMessage::Level level,
const std::string& message) {
- if (status_ != EmbeddedWorkerStatus::RUNNING &&
- status_ != EmbeddedWorkerStatus::STARTING) {
- return;
+ // Return if EmbeddedWorkerInstance does not have a valid process.
+ switch (status()) {
+ case EmbeddedWorkerStatus::STOPPING:
+ case EmbeddedWorkerStatus::STOPPED:
+ return;
+ case EmbeddedWorkerStatus::STARTING:
+ if (!HasSentStartWorker(starting_phase()))
+ return;
+ break;
+ case EmbeddedWorkerStatus::RUNNING:
+ break;
falken 2017/02/21 04:03:30 Sorry for keeping suggesting things. Would if (pro
shimazu 2017/02/21 04:39:51 process_id() != kInvalidUniqueID seems much better
}
DCHECK(client_.is_bound());
client_->AddMessageToConsole(level, message);
« no previous file with comments | « no previous file | content/browser/service_worker/embedded_worker_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698