static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document) { if (relAttribute.isPreconnect() && href.isValid()) { ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled()); if (document.settings()->logDnsPrefetchAndPreconnect()) document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preconnect triggered for " + href.host()))); preconnect(href); } }
static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const CrossOriginAttributeValue crossOrigin) { if (relAttribute.isPreconnect() && href.isValid()) { ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled()); Settings* settings = document.settings(); if (settings && settings->logDnsPrefetchAndPreconnect()) { document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preconnect triggered for " + href.host()))); if (crossOrigin != CrossOriginAttributeNotSet) { document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials"))); } } preconnect(href, crossOrigin); } }
static void preconnectHost(PreloadRequest* request) { ASSERT(request); ASSERT(request->isPreconnect()); KURL host(request->baseURL(), request->resourceURL()); if (!host.isValid() || !host.protocolIsInHTTPFamily()) return; CrossOriginAttributeValue crossOrigin = CrossOriginAttributeNotSet; if (request->isCORS()) { if (request->isAllowCredentials()) crossOrigin = CrossOriginAttributeUseCredentials; else crossOrigin = CrossOriginAttributeAnonymous; } preconnect(host, crossOrigin); }