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

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

Issue 1569623002: Fix-up some code relating to SRI double-requesting scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 11 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. 4 * Copyright (C) 2010 Google Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 { 214 {
215 // FIXME - Don't set crossorigin multiple times. 215 // FIXME - Don't set crossorigin multiple times.
216 if (match(attributeName, srcAttr)) 216 if (match(attributeName, srcAttr))
217 setUrlToLoad(attributeValue, DisallowURLReplacement); 217 setUrlToLoad(attributeValue, DisallowURLReplacement);
218 else if (match(attributeName, crossoriginAttr)) 218 else if (match(attributeName, crossoriginAttr))
219 setCrossOrigin(attributeValue); 219 setCrossOrigin(attributeValue);
220 else if (match(attributeName, asyncAttr)) 220 else if (match(attributeName, asyncAttr))
221 setDefer(FetchRequest::LazyLoad); 221 setDefer(FetchRequest::LazyLoad);
222 else if (match(attributeName, deferAttr)) 222 else if (match(attributeName, deferAttr))
223 setDefer(FetchRequest::LazyLoad); 223 setDefer(FetchRequest::LazyLoad);
224 // Note that only scripts need to have the integrity metadata set on
225 // preloads. This is because script resources fetches, and only script
226 // resource fetches, need to re-request resources if a cached version
227 // has different metadata (including empty) from the metadata on the
228 // request. See the comment before the call to
229 // mustRefetchDueToIntegrityMismatch() in
230 // Source/core/fetch/ResourceFetcher.cpp for a more complete
231 // explanation.
224 else if (match(attributeName, integrityAttr)) 232 else if (match(attributeName, integrityAttr))
225 SubresourceIntegrity::parseIntegrityAttribute(attributeValue, m_inte grityMetadata); 233 SubresourceIntegrity::parseIntegrityAttribute(attributeValue, m_inte grityMetadata);
226 } 234 }
227 235
228 template<typename NameType> 236 template<typename NameType>
229 void processImgAttribute(const NameType& attributeName, const String& attrib uteValue) 237 void processImgAttribute(const NameType& attributeName, const String& attrib uteValue)
230 { 238 {
231 if (match(attributeName, srcAttr) && m_imgSrcUrl.isNull()) { 239 if (match(attributeName, srcAttr) && m_imgSrcUrl.isNull()) {
232 m_imgSrcUrl = attributeValue; 240 m_imgSrcUrl = attributeValue;
233 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi xelRatio(), m_sourceSize, attributeValue, m_srcsetImageCandidate), AllowURLRepla cement); 241 setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePi xelRatio(), m_sourceSize, attributeValue, m_srcsetImageCandidate), AllowURLRepla cement);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 return true; 383 return true;
376 } 384 }
377 void setCrossOrigin(const String& corsSetting) 385 void setCrossOrigin(const String& corsSetting)
378 { 386 {
379 m_crossOrigin = crossOriginAttributeValue(corsSetting); 387 m_crossOrigin = crossOriginAttributeValue(corsSetting);
380 } 388 }
381 389
382 void setDefer(FetchRequest::DeferOption defer) 390 void setDefer(FetchRequest::DeferOption defer)
383 { 391 {
384 m_defer = defer; 392 m_defer = defer;
385
386 } 393 }
387 394
388 bool defer() const 395 bool defer() const
389 { 396 {
390 return m_defer; 397 return m_defer;
391 } 398 }
392 399
393 const StringImpl* m_tagImpl; 400 const StringImpl* m_tagImpl;
394 String m_urlToLoad; 401 String m_urlToLoad;
395 ImageCandidate m_srcsetImageCandidate; 402 ImageCandidate m_srcsetImageCandidate;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 else 666 else
660 mediaValues = MediaValuesCached::create(*document); 667 mediaValues = MediaValuesCached::create(*document);
661 ASSERT(mediaValues->isSafeToSendToAnotherThread()); 668 ASSERT(mediaValues->isSafeToSendToAnotherThread());
662 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 669 defaultViewportMinWidth = document->viewportDefaultMinWidth();
663 viewportMetaZeroValuesQuirk = document->settings() && document->settings()-> viewportMetaZeroValuesQuirk(); 670 viewportMetaZeroValuesQuirk = document->settings() && document->settings()-> viewportMetaZeroValuesQuirk();
664 viewportMetaEnabled = document->settings() && document->settings()->viewport MetaEnabled(); 671 viewportMetaEnabled = document->settings() && document->settings()->viewport MetaEnabled();
665 referrerPolicy = ReferrerPolicyDefault; 672 referrerPolicy = ReferrerPolicyDefault;
666 } 673 }
667 674
668 } 675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698