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

Unified Diff: third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp

Issue 2842123002: WorkerShadowFetchContext
Patch Set: . Created 3 years, 7 months 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: 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()
« no previous file with comments | « third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.h ('k') | third_party/WebKit/Source/core/workers/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698