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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2844913002: Drop GetFrame()->GetDocument() usage in FrameFetchContext (Closed)
Patch Set: Add comment in SendMessageToConsoleForPossiblyNullDocument Created 3 years, 8 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/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 4bb8a5d83c4b477c87e1f9328a307daefcf20c12..1982fb63d2f93c4a8e37de3a8fc15de84aa4edff 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -353,9 +353,9 @@ void FrameFetchContext::DispatchDidReceiveResponse(
resource_loading_policy = LinkLoader::kDoNotLoadResources;
}
LinkLoader::LoadLinksFromHeader(
- response.HttpHeaderField(HTTPNames::Link), response.Url(),
- GetFrame()->GetDocument(), NetworkHintsInterfaceImpl(),
- resource_loading_policy, LinkLoader::kLoadAll, nullptr);
+ response.HttpHeaderField(HTTPNames::Link), response.Url(), *GetFrame(),
+ GetDocument(), NetworkHintsInterfaceImpl(), resource_loading_policy,
+ LinkLoader::kLoadAll, nullptr);
if (response.HasMajorCertificateErrors()) {
MixedContentChecker::HandleCertificateError(GetFrame(), response,
@@ -571,10 +571,15 @@ void FrameFetchContext::AddConsoleMessage(const String& message,
LogMessageType message_type) const {
MessageLevel level = message_type == kLogWarningMessage ? kWarningMessageLevel
: kErrorMessageLevel;
- if (GetFrame()->GetDocument()) {
- GetFrame()->GetDocument()->AddConsoleMessage(
- ConsoleMessage::Create(kJSMessageSource, level, message));
- }
+ ConsoleMessage* console_message =
+ ConsoleMessage::Create(kJSMessageSource, level, message);
+ // Route the console message through Document if it's attached, so
+ // that script line numbers can be included. Otherwise, route directly to the
+ // FrameConsole, to ensure we never drop a message.
+ if (GetDocument() && GetDocument()->GetFrame())
+ GetDocument()->AddConsoleMessage(console_message);
+ else
+ GetFrame()->Console().AddMessage(console_message);
}
void FrameFetchContext::ModifyRequestForCSP(ResourceRequest& resource_request) {
@@ -704,9 +709,10 @@ SubresourceFilter* FrameFetchContext::GetSubresourceFilter() const {
return document_loader ? document_loader->GetSubresourceFilter() : nullptr;
}
-SecurityContext* FrameFetchContext::GetMainResourceSecurityContext() const {
- DCHECK(GetFrame()->GetDocument());
- return GetFrame()->GetDocument();
+SecurityContext* FrameFetchContext::GetParentSecurityContext() const {
+ if (Frame* parent = GetFrame()->Tree().Parent())
+ return parent->GetSecurityContext();
+ return nullptr;
}
bool FrameFetchContext::ShouldBlockRequestByInspector(
@@ -738,11 +744,11 @@ bool FrameFetchContext::IsSVGImageChromeClient() const {
}
void FrameFetchContext::CountUsage(UseCounter::Feature feature) const {
- UseCounter::Count(GetFrame()->GetDocument(), feature);
+ UseCounter::Count(GetFrame(), feature);
}
void FrameFetchContext::CountDeprecation(UseCounter::Feature feature) const {
- Deprecation::CountDeprecation(GetFrame()->GetDocument(), feature);
+ Deprecation::CountDeprecation(GetFrame(), feature);
}
bool FrameFetchContext::ShouldBlockFetchByMixedContentCheck(
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | third_party/WebKit/Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698