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

Side by Side Diff: third_party/WebKit/Source/core/html/LinkStyle.cpp

Issue 2424943002: Add ReferrerPolicy support to preload (Closed)
Patch Set: Fix test. Again Created 4 years, 1 month 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/LinkStyle.h" 5 #include "core/html/LinkStyle.h"
6 6
7 #include "core/css/StyleSheetContents.h" 7 #include "core/css/StyleSheetContents.h"
8 #include "core/fetch/CSSStyleSheetResource.h" 8 #include "core/fetch/CSSStyleSheetResource.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/SubresourceIntegrity.h" 10 #include "core/frame/SubresourceIntegrity.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 m_owner->document().getSecurityOrigin()); 281 m_owner->document().getSecurityOrigin());
282 } 282 }
283 m_fetchFollowingCORS = false; 283 m_fetchFollowingCORS = false;
284 } 284 }
285 285
286 void LinkStyle::process() { 286 void LinkStyle::process() {
287 DCHECK(m_owner->shouldProcessStyle()); 287 DCHECK(m_owner->shouldProcessStyle());
288 String type = m_owner->typeValue().lower(); 288 String type = m_owner->typeValue().lower();
289 String as = m_owner->asValue().lower(); 289 String as = m_owner->asValue().lower();
290 String media = m_owner->media().lower(); 290 String media = m_owner->media().lower();
291 String referrerPolicy = m_owner->referrerPolicy().lower();
291 LinkRequestBuilder builder(m_owner); 292 LinkRequestBuilder builder(m_owner);
292 293
293 if (m_owner->relAttribute().getIconType() != InvalidIcon && 294 if (m_owner->relAttribute().getIconType() != InvalidIcon &&
294 builder.url().isValid() && !builder.url().isEmpty()) { 295 builder.url().isValid() && !builder.url().isEmpty()) {
295 if (!m_owner->shouldLoadLink()) 296 if (!m_owner->shouldLoadLink())
296 return; 297 return;
297 if (!document().getSecurityOrigin()->canDisplay(builder.url())) 298 if (!document().getSecurityOrigin()->canDisplay(builder.url()))
298 return; 299 return;
299 if (!document().contentSecurityPolicy()->allowImageFromSource( 300 if (!document().contentSecurityPolicy()->allowImageFromSource(
300 builder.url())) 301 builder.url()))
301 return; 302 return;
302 if (document().frame() && document().frame()->loader().client()) { 303 if (document().frame() && document().frame()->loader().client()) {
303 document().frame()->loader().client()->dispatchDidChangeIcons( 304 document().frame()->loader().client()->dispatchDidChangeIcons(
304 m_owner->relAttribute().getIconType()); 305 m_owner->relAttribute().getIconType());
305 } 306 }
306 } 307 }
307 308
308 if (!m_owner->loadLink(type, as, media, builder.url())) 309 if (!m_owner->loadLink(type, as, media, referrerPolicy, builder.url()))
309 return; 310 return;
310 311
311 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() && 312 if (m_disabledState != Disabled && m_owner->relAttribute().isStyleSheet() &&
312 styleSheetTypeIsSupported(type) && shouldLoadResource() && 313 styleSheetTypeIsSupported(type) && shouldLoadResource() &&
313 builder.url().isValid()) { 314 builder.url().isValid()) {
314 if (resource()) { 315 if (resource()) {
315 removePendingSheet(); 316 removePendingSheet();
316 clearResource(); 317 clearResource();
317 clearFetchFollowingCORS(); 318 clearFetchFollowingCORS();
318 } 319 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 removePendingSheet(); 412 removePendingSheet();
412 } 413 }
413 414
414 DEFINE_TRACE(LinkStyle) { 415 DEFINE_TRACE(LinkStyle) {
415 visitor->trace(m_sheet); 416 visitor->trace(m_sheet);
416 LinkResource::trace(visitor); 417 LinkResource::trace(visitor);
417 ResourceOwner<StyleSheetResource>::trace(visitor); 418 ResourceOwner<StyleSheetResource>::trace(visitor);
418 } 419 }
419 420
420 } // namespace blink 421 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698