| Index: third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp
|
| diff --git a/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp b/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp
|
| index 54aa2d77664fc6c48fd1727554b2efdd190ef581..1f21f76a84344d2a4adcb9e50466ece377093ddc 100644
|
| --- a/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp
|
| @@ -65,7 +65,6 @@ ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* document_loader)
|
| : dom_application_cache_(nullptr),
|
| document_loader_(document_loader),
|
| defers_events_(true) {
|
| - DCHECK(document_loader_);
|
| }
|
|
|
| ApplicationCacheHost::~ApplicationCacheHost() {
|
| @@ -93,26 +92,32 @@ void ApplicationCacheHost::WillStartLoadingMainResource(
|
|
|
| DCHECK(IsApplicationCacheEnabled());
|
|
|
| - DCHECK(document_loader_->GetFrame());
|
| - LocalFrame& frame = *document_loader_->GetFrame();
|
| - host_ = frame.Loader().Client()->CreateApplicationCacheHost(this);
|
| - if (!host_)
|
| - return;
|
| + if (!host_) {
|
| + DCHECK(document_loader_->GetFrame());
|
| + LocalFrame& frame = *document_loader_->GetFrame();
|
| + host_ = frame.Loader().Client()->CreateApplicationCacheHost(this);
|
| + if (!host_)
|
| + return;
|
| + }
|
|
|
| WrappedResourceRequest wrapped(request);
|
|
|
| const WebApplicationCacheHost* spawning_host = nullptr;
|
| - Frame* spawning_frame = frame.Tree().Parent();
|
| - if (!spawning_frame || !spawning_frame->IsLocalFrame())
|
| - spawning_frame = frame.Loader().Opener();
|
| - if (!spawning_frame || !spawning_frame->IsLocalFrame())
|
| - spawning_frame = &frame;
|
| - if (DocumentLoader* spawning_doc_loader =
|
| - ToLocalFrame(spawning_frame)->Loader().GetDocumentLoader()) {
|
| - spawning_host =
|
| - spawning_doc_loader->GetApplicationCacheHost()
|
| - ? spawning_doc_loader->GetApplicationCacheHost()->host_.get()
|
| - : nullptr;
|
| + if (document_loader_) {
|
| + DCHECK(document_loader_->GetFrame());
|
| + LocalFrame& frame = *document_loader_->GetFrame();
|
| + Frame* spawning_frame = frame.Tree().Parent();
|
| + if (!spawning_frame || !spawning_frame->IsLocalFrame())
|
| + spawning_frame = frame.Loader().Opener();
|
| + if (!spawning_frame || !spawning_frame->IsLocalFrame())
|
| + spawning_frame = &frame;
|
| + if (DocumentLoader* spawning_doc_loader =
|
| + ToLocalFrame(spawning_frame)->Loader().GetDocumentLoader()) {
|
| + spawning_host =
|
| + spawning_doc_loader->GetApplicationCacheHost()
|
| + ? spawning_doc_loader->GetApplicationCacheHost()->host_.get()
|
| + : nullptr;
|
| + }
|
| }
|
|
|
| host_->WillStartMainResourceRequest(wrapped, spawning_host);
|
| @@ -318,7 +323,9 @@ void ApplicationCacheHost::Abort() {
|
| }
|
|
|
| bool ApplicationCacheHost::IsApplicationCacheEnabled() {
|
| - DCHECK(document_loader_->GetFrame());
|
| + DCHECK(host_ || document_loader_->GetFrame());
|
| + if (host_)
|
| + return true;
|
| return document_loader_->GetFrame()->GetSettings() &&
|
| document_loader_->GetFrame()
|
| ->GetSettings()
|
|
|