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_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "content/browser/message_port_message_filter.h" | 10 #include "content/browser/message_port_message_filter.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 if (!provider_host->SetHostedVersionId(version_id)) | 563 if (!provider_host->SetHostedVersionId(version_id)) |
564 BadMessageReceived(); | 564 BadMessageReceived(); |
565 | 565 |
566 // Retrieve the registration associated with |version_id|. | 566 // Retrieve the registration associated with |version_id|. |
567 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); | 567 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); |
568 if (!version) | 568 if (!version) |
569 return; | 569 return; |
570 ServiceWorkerRegistration* registration = | 570 ServiceWorkerRegistration* registration = |
571 GetContext()->GetLiveRegistration(version->registration_id()); | 571 GetContext()->GetLiveRegistration(version->registration_id()); |
572 DCHECK(registration); | 572 DCHECK(registration); |
| 573 // TODO(ksakamoto): This is a quick fix for crbug.com/459916. |
| 574 if (!registration) |
| 575 return; |
573 | 576 |
574 // Set the document URL to the script url in order to allow | 577 // Set the document URL to the script url in order to allow |
575 // register/unregister/getRegistration on ServiceWorkerGlobalScope. | 578 // register/unregister/getRegistration on ServiceWorkerGlobalScope. |
576 provider_host->SetDocumentUrl(version->script_url()); | 579 provider_host->SetDocumentUrl(version->script_url()); |
577 | 580 |
578 ServiceWorkerRegistrationObjectInfo info; | 581 ServiceWorkerRegistrationObjectInfo info; |
579 ServiceWorkerVersionAttributes attrs; | 582 ServiceWorkerVersionAttributes attrs; |
580 GetRegistrationObjectInfoAndVersionAttributes( | 583 GetRegistrationObjectInfoAndVersionAttributes( |
581 provider_host->AsWeakPtr(), registration, &info, &attrs); | 584 provider_host->AsWeakPtr(), registration, &info, &attrs); |
582 | 585 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); | 959 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
957 if (!handle) { | 960 if (!handle) { |
958 BadMessageReceived(); | 961 BadMessageReceived(); |
959 return; | 962 return; |
960 } | 963 } |
961 handle->version()->StopWorker( | 964 handle->version()->StopWorker( |
962 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 965 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
963 } | 966 } |
964 | 967 |
965 } // namespace content | 968 } // namespace content |
OLD | NEW |