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

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

Issue 2440803002: Filter out data urls in the preload scanner (Closed)
Patch Set: nits and test 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 /* 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 Resource::Type type; 235 Resource::Type type;
236 if (!resourceType(type)) 236 if (!resourceType(type))
237 return nullptr; 237 return nullptr;
238 238
239 // The element's 'referrerpolicy' attribute (if present) takes precedence 239 // The element's 'referrerpolicy' attribute (if present) takes precedence
240 // over the document's referrer policy. 240 // over the document's referrer policy.
241 ReferrerPolicy referrerPolicy = (m_referrerPolicy != ReferrerPolicyDefault) 241 ReferrerPolicy referrerPolicy = (m_referrerPolicy != ReferrerPolicyDefault)
242 ? m_referrerPolicy 242 ? m_referrerPolicy
243 : documentReferrerPolicy; 243 : documentReferrerPolicy;
244 std::unique_ptr<PreloadRequest> request = PreloadRequest::create( 244 auto request = PreloadRequest::createIfNeeded(
245 initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type, 245 initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, type,
246 referrerPolicy, resourceWidth, clientHintsPreferences, requestType); 246 referrerPolicy, resourceWidth, clientHintsPreferences, requestType);
247 if (!request)
248 return nullptr;
249
247 request->setCrossOrigin(m_crossOrigin); 250 request->setCrossOrigin(m_crossOrigin);
248 request->setNonce(m_nonce); 251 request->setNonce(m_nonce);
249 request->setCharset(charset()); 252 request->setCharset(charset());
250 request->setDefer(m_defer); 253 request->setDefer(m_defer);
251 request->setIntegrityMetadata(m_integrityMetadata); 254 request->setIntegrityMetadata(m_integrityMetadata);
252 255
253 // TODO(csharrison): Once this is deprecated, just abort the request here. 256 // TODO(csharrison): Once this is deprecated, just abort the request here.
254 if (match(m_tagImpl, scriptTag) && 257 if (match(m_tagImpl, scriptTag) &&
255 !ScriptLoader::isValidScriptTypeAndLanguage( 258 !ScriptLoader::isValidScriptTypeAndLanguage(
256 m_typeAttributeValue, m_languageAttributeValue, 259 m_typeAttributeValue, m_languageAttributeValue,
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 895 defaultViewportMinWidth = document->viewportDefaultMinWidth();
893 viewportMetaZeroValuesQuirk = 896 viewportMetaZeroValuesQuirk =
894 document->settings() && 897 document->settings() &&
895 document->settings()->viewportMetaZeroValuesQuirk(); 898 document->settings()->viewportMetaZeroValuesQuirk();
896 viewportMetaEnabled = 899 viewportMetaEnabled =
897 document->settings() && document->settings()->viewportMetaEnabled(); 900 document->settings() && document->settings()->viewportMetaEnabled();
898 referrerPolicy = document->getReferrerPolicy(); 901 referrerPolicy = document->getReferrerPolicy();
899 } 902 }
900 903
901 } // namespace blink 904 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698