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

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

Issue 2473113002: Stop preloading scripts that have invalid type/language attributes (Closed)
Patch Set: 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 referrerPolicy, resourceWidth, clientHintsPreferences, requestType); 246 referrerPolicy, resourceWidth, clientHintsPreferences, requestType);
247 if (!request) 247 if (!request)
248 return nullptr; 248 return nullptr;
249 249
250 request->setCrossOrigin(m_crossOrigin); 250 request->setCrossOrigin(m_crossOrigin);
251 request->setNonce(m_nonce); 251 request->setNonce(m_nonce);
252 request->setCharset(charset()); 252 request->setCharset(charset());
253 request->setDefer(m_defer); 253 request->setDefer(m_defer);
254 request->setIntegrityMetadata(m_integrityMetadata); 254 request->setIntegrityMetadata(m_integrityMetadata);
255 255
256 // TODO(csharrison): Once this is deprecated, just abort the request here.
257 if (match(m_tagImpl, scriptTag) && 256 if (match(m_tagImpl, scriptTag) &&
Charlie Harrison 2016/11/03 21:00:40 Can this check be moved to shouldPreload()?
258 !ScriptLoader::isValidScriptTypeAndLanguage( 257 !ScriptLoader::isValidScriptTypeAndLanguage(
259 m_typeAttributeValue, m_languageAttributeValue, 258 m_typeAttributeValue, m_languageAttributeValue,
260 ScriptLoader::AllowLegacyTypeInTypeAttribute)) 259 ScriptLoader::AllowLegacyTypeInTypeAttribute))
261 request->setScriptHasInvalidTypeOrLanguage(); 260 return nullptr;
262 return request; 261 return request;
263 } 262 }
264 263
265 private: 264 private:
266 template <typename NameType> 265 template <typename NameType>
267 void processScriptAttribute(const NameType& attributeName, 266 void processScriptAttribute(const NameType& attributeName,
268 const String& attributeValue) { 267 const String& attributeValue) {
269 // FIXME - Don't set crossorigin multiple times. 268 // FIXME - Don't set crossorigin multiple times.
270 if (match(attributeName, srcAttr)) 269 if (match(attributeName, srcAttr))
271 setUrlToLoad(attributeValue, DisallowURLReplacement); 270 setUrlToLoad(attributeValue, DisallowURLReplacement);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 defaultViewportMinWidth = document->viewportDefaultMinWidth(); 894 defaultViewportMinWidth = document->viewportDefaultMinWidth();
896 viewportMetaZeroValuesQuirk = 895 viewportMetaZeroValuesQuirk =
897 document->settings() && 896 document->settings() &&
898 document->settings()->viewportMetaZeroValuesQuirk(); 897 document->settings()->viewportMetaZeroValuesQuirk();
899 viewportMetaEnabled = 898 viewportMetaEnabled =
900 document->settings() && document->settings()->viewportMetaEnabled(); 899 document->settings() && document->settings()->viewportMetaEnabled();
901 referrerPolicy = document->getReferrerPolicy(); 900 referrerPolicy = document->getReferrerPolicy();
902 } 901 }
903 902
904 } // namespace blink 903 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698