OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/service_worker/service_worker_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 451 |
452 void ServiceWorkerRegisterJob::CompleteInternal( | 452 void ServiceWorkerRegisterJob::CompleteInternal( |
453 ServiceWorkerStatusCode status, | 453 ServiceWorkerStatusCode status, |
454 const std::string& status_message) { | 454 const std::string& status_message) { |
455 SetPhase(COMPLETE); | 455 SetPhase(COMPLETE); |
456 if (status != SERVICE_WORKER_OK) { | 456 if (status != SERVICE_WORKER_OK) { |
457 if (registration()) { | 457 if (registration()) { |
458 if (should_uninstall_on_failure_) | 458 if (should_uninstall_on_failure_) |
459 registration()->ClearWhenReady(); | 459 registration()->ClearWhenReady(); |
460 if (new_version()) { | 460 if (new_version()) { |
| 461 if (status != SERVICE_WORKER_ERROR_EXISTS) |
| 462 new_version()->ReportError(status, status_message); |
461 registration()->UnsetVersion(new_version()); | 463 registration()->UnsetVersion(new_version()); |
462 new_version()->Doom(); | 464 new_version()->Doom(); |
463 } | 465 } |
464 if (!registration()->waiting_version() && | 466 if (!registration()->waiting_version() && |
465 !registration()->active_version()) { | 467 !registration()->active_version()) { |
466 registration()->NotifyRegistrationFailed(); | 468 registration()->NotifyRegistrationFailed(); |
467 context_->storage()->DeleteRegistration( | 469 context_->storage()->DeleteRegistration( |
468 registration()->id(), | 470 registration()->id(), |
469 registration()->pattern().GetOrigin(), | 471 registration()->pattern().GetOrigin(), |
470 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 472 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 if (host->IsHostToRunningServiceWorker()) | 560 if (host->IsHostToRunningServiceWorker()) |
559 continue; | 561 continue; |
560 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 562 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
561 host->document_url())) | 563 host->document_url())) |
562 continue; | 564 continue; |
563 host->AddMatchingRegistration(registration); | 565 host->AddMatchingRegistration(registration); |
564 } | 566 } |
565 } | 567 } |
566 | 568 |
567 } // namespace content | 569 } // namespace content |
OLD | NEW |