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

Unified Diff: Source/core/loader/LinkLoader.cpp

Issue 1107003002: Check the nullable Document::settings() before accessing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « LayoutTests/fast/dom/HTMLLinkElement/link-preload-settings-no-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/LinkLoader.cpp
diff --git a/Source/core/loader/LinkLoader.cpp b/Source/core/loader/LinkLoader.cpp
index 054b982c7e637049f7476408e64f4e41ebccfb3f..1a5a0f671428bf788c04d96e15a823bf888efea3 100644
--- a/Source/core/loader/LinkLoader.cpp
+++ b/Source/core/loader/LinkLoader.cpp
@@ -132,7 +132,8 @@ static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL&
{
if (relAttribute.isPreconnect() && href.isValid()) {
ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled());
- if (document.settings()->logDnsPrefetchAndPreconnect())
+ Settings* settings = document.settings();
+ if (settings && settings->logDnsPrefetchAndPreconnect())
document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preconnect triggered for " + href.host())));
preconnect(href);
}
@@ -163,7 +164,8 @@ void LinkLoader::preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR
return;
}
FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), FetchInitiatorTypeNames::link);
- if (document.settings()->logPreload())
+ Settings* settings = document.settings();
+ if (settings && settings->logPreload())
document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preload triggered for " + href.host() + href.path())));
setResource(document.fetcher()->fetchLinkPreloadResource(type, linkRequest));
}
« no previous file with comments | « LayoutTests/fast/dom/HTMLLinkElement/link-preload-settings-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698