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

Side by Side Diff: Source/core/loader/LinkLoader.cpp

Issue 1157443004: Limit <link rel=preconnect> to the HTTP family (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved test Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/dom/HTMLLinkElement/link-preconnect-nonhttp-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && ! href.isEmpty()) { 124 if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && ! href.isEmpty()) {
125 if (settings->logDnsPrefetchAndPreconnect()) 125 if (settings->logDnsPrefetchAndPreconnect())
126 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel, String("DNS prefetch triggered for " + href.host()))); 126 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel, String("DNS prefetch triggered for " + href.host())));
127 prefetchDNS(href.host()); 127 prefetchDNS(href.host());
128 } 128 }
129 } 129 }
130 } 130 }
131 131
132 static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin) 132 static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin)
133 { 133 {
134 if (relAttribute.isPreconnect() && href.isValid()) { 134 if (relAttribute.isPreconnect() && href.isValid() && href.protocolIsInHTTPFa mily()) {
135 ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled()); 135 ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled());
136 Settings* settings = document.settings(); 136 Settings* settings = document.settings();
137 if (settings && settings->logDnsPrefetchAndPreconnect()) { 137 if (settings && settings->logDnsPrefetchAndPreconnect()) {
138 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource , DebugMessageLevel, String("Preconnect triggered for " + href.host()))); 138 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource , DebugMessageLevel, String("Preconnect triggered for " + href.host())));
139 if (crossOrigin != CrossOriginAttributeNotSet) { 139 if (crossOrigin != CrossOriginAttributeNotSet) {
140 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel, 140 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSo urce, DebugMessageLevel,
141 String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials"))); 141 String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials")));
142 } 142 }
143 } 143 }
144 preconnect(href, crossOrigin); 144 preconnect(href, crossOrigin);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 m_prerender.clear(); 254 m_prerender.clear();
255 } 255 }
256 } 256 }
257 257
258 DEFINE_TRACE(LinkLoader) 258 DEFINE_TRACE(LinkLoader)
259 { 259 {
260 visitor->trace(m_prerender); 260 visitor->trace(m_prerender);
261 } 261 }
262 262
263 } 263 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/HTMLLinkElement/link-preconnect-nonhttp-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698