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

Side by Side Diff: Source/core/html/parser/HTMLResourcePreloader.cpp

Issue 1235563004: Apply meta tag referrer policy for preloaded requests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix conflicting policies test Created 5 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All Rights Reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> HTMLResourcePreloader::create(Docu ment& document) 43 PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> HTMLResourcePreloader::create(Docu ment& document)
44 { 44 {
45 return adoptPtrWillBeNoop(new HTMLResourcePreloader(document)); 45 return adoptPtrWillBeNoop(new HTMLResourcePreloader(document));
46 } 46 }
47 47
48 DEFINE_TRACE(HTMLResourcePreloader) 48 DEFINE_TRACE(HTMLResourcePreloader)
49 { 49 {
50 visitor->trace(m_document); 50 visitor->trace(m_document);
51 } 51 }
52 52
53 void HTMLResourcePreloader::preloadReferrerPolicy(const String& policy)
54 {
55 m_document->processReferrerPolicy(policy);
56 }
57
53 static void preconnectHost(PreloadRequest* request) 58 static void preconnectHost(PreloadRequest* request)
54 { 59 {
55 ASSERT(request); 60 ASSERT(request);
56 ASSERT(request->isPreconnect()); 61 ASSERT(request->isPreconnect());
57 KURL host(request->baseURL(), request->resourceURL()); 62 KURL host(request->baseURL(), request->resourceURL());
58 if (!host.isValid() || !host.protocolIsInHTTPFamily()) 63 if (!host.isValid() || !host.protocolIsInHTTPFamily())
59 return; 64 return;
60 CrossOriginAttributeValue crossOrigin = CrossOriginAttributeNotSet; 65 CrossOriginAttributeValue crossOrigin = CrossOriginAttributeNotSet;
61 if (request->isCORS()) { 66 if (request->isCORS()) {
62 if (request->isAllowCredentials()) 67 if (request->isAllowCredentials())
(...skipping 19 matching lines...) Expand all
82 if (request.url().protocolIsData()) 87 if (request.url().protocolIsData())
83 return; 88 return;
84 if (preload->resourceType() == Resource::Script || preload->resourceType() = = Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource ) 89 if (preload->resourceType() == Resource::Script || preload->resourceType() = = Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource )
85 request.setCharset(preload->charset().isEmpty() ? m_document->charset(). string() : preload->charset()); 90 request.setCharset(preload->charset().isEmpty() ? m_document->charset(). string() : preload->charset());
86 request.setForPreload(true); 91 request.setForPreload(true);
87 Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_ cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20); 92 Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_ cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20);
88 m_document->loader()->startPreload(preload->resourceType(), request); 93 m_document->loader()->startPreload(preload->resourceType(), request);
89 } 94 }
90 95
91 } // namespace blink 96 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698