| Index: content/browser/service_worker/service_worker_register_job.cc
|
| diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc
|
| index 6eba2e8ab82a714235f7a0b97f6822f8e3f089cd..153b80eadd62bd8e81c512847ef6da4b4dc4f908 100644
|
| --- a/content/browser/service_worker/service_worker_register_job.cc
|
| +++ b/content/browser/service_worker/service_worker_register_job.cc
|
| @@ -38,7 +38,8 @@ ServiceWorkerRegisterJob::ServiceWorkerRegisterJob(
|
| weak_factory_(this) {}
|
|
|
| ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob() {
|
| - DCHECK(!context_ || phase_ == INITIAL || phase_ == COMPLETE)
|
| + DCHECK(!context_ ||
|
| + phase_ == INITIAL || phase_ == COMPLETE || phase_ == ABORT)
|
| << "Jobs should only be interrupted during shutdown.";
|
| }
|
|
|
| @@ -64,6 +65,11 @@ void ServiceWorkerRegisterJob::Start() {
|
| weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| +void ServiceWorkerRegisterJob::Abort() {
|
| + SetPhase(ABORT);
|
| + Complete(SERVICE_WORKER_ERROR_ABORT);
|
| +}
|
| +
|
| bool ServiceWorkerRegisterJob::Equals(ServiceWorkerRegisterJobBase* job) {
|
| if (job->GetType() != GetType())
|
| return false;
|
| @@ -131,6 +137,8 @@ void ServiceWorkerRegisterJob::SetPhase(Phase phase) {
|
| case COMPLETE:
|
| DCHECK(phase_ != INITIAL && phase_ != COMPLETE) << phase_;
|
| break;
|
| + case ABORT:
|
| + break;
|
| }
|
| phase_ = phase;
|
| }
|
| @@ -359,7 +367,8 @@ void ServiceWorkerRegisterJob::OnActivateFinished(
|
| }
|
|
|
| void ServiceWorkerRegisterJob::Complete(ServiceWorkerStatusCode status) {
|
| - SetPhase(COMPLETE);
|
| + if (phase_ != ABORT)
|
| + SetPhase(COMPLETE);
|
| if (status != SERVICE_WORKER_OK) {
|
| if (registration() && registration()->waiting_version()) {
|
| DisassociateWaitingVersionFromDocuments(
|
| @@ -380,7 +389,9 @@ void ServiceWorkerRegisterJob::Complete(ServiceWorkerStatusCode status) {
|
| context_->storage()->NotifyDoneInstallingRegistration(
|
| registration(), pending_version(), status);
|
| }
|
| - context_->job_coordinator()->FinishJob(pattern_, this);
|
| + // The caller of Abort() takes care of removing the jobs from the queue.
|
| + if (phase_ != ABORT)
|
| + context_->job_coordinator()->FinishJob(pattern_, this);
|
| }
|
|
|
| void ServiceWorkerRegisterJob::ResolvePromise(
|
|
|