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

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

Issue 2506263005: Prevent a service worker from keeping itself alive by self postMessage. (Closed)
Patch Set: fix unit test Created 4 years, 1 month 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_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index d63e0e8f6e40010d74954cf174db2e3342c7301f..ce69b9ba9a8be80a5672fff4bfc324808259516f 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -57,9 +57,6 @@ using StatusCallback = ServiceWorkerVersion::StatusCallback;
namespace {
-// Time to wait until stopping an idle worker.
-const int kIdleWorkerTimeoutSeconds = 30;
-
// Default delay for scheduled update.
const int kUpdateDelaySeconds = 1;
@@ -186,6 +183,7 @@ const int ServiceWorkerVersion::kStartInstalledWorkerTimeoutSeconds = 60;
const int ServiceWorkerVersion::kStartNewWorkerTimeoutMinutes = 5;
const int ServiceWorkerVersion::kRequestTimeoutMinutes = 5;
const int ServiceWorkerVersion::kStopWorkerTimeoutSeconds = 5;
+const int ServiceWorkerVersion::kIdleWorkerTimeoutSeconds = 30;
void ServiceWorkerVersion::RestartTick(base::TimeTicks* time) const {
*time = tick_clock_->NowTicks();
@@ -572,6 +570,8 @@ int ServiceWorkerVersion::StartRequestWithCustomTimeout(
base::TimeTicks expiration_time = tick_clock_->NowTicks() + timeout;
timeout_queue_.push(
RequestInfo(request_id, event_type, expiration_time, timeout_behavior));
+ if (expiration_time > max_request_expiration_time_)
+ max_request_expiration_time_ = expiration_time;
falken 2016/11/21 08:01:48 It seems we never reset max to an earlier time (e.
return request_id;
}

Powered by Google App Engine
This is Rietveld 408576698