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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 1561903002: Fix double resource request for script resources with integrity attr. (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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (crossOrigin != CrossOriginAttributeNotSet) 294 if (crossOrigin != CrossOriginAttributeNotSet)
295 request.setCrossOriginAccessControl(elementDocument->securityOrigin( ), crossOrigin); 295 request.setCrossOriginAccessControl(elementDocument->securityOrigin( ), crossOrigin);
296 request.setCharset(scriptCharset()); 296 request.setCharset(scriptCharset());
297 297
298 bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowSc riptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)); 298 bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowSc riptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
299 if (scriptPassesCSP) 299 if (scriptPassesCSP)
300 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); 300 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
301 request.setDefer(defer); 301 request.setDefer(defer);
302 302
303 String integrityAttr = m_element->fastGetAttribute(HTMLNames::integrityA ttr); 303 String integrityAttr = m_element->fastGetAttribute(HTMLNames::integrityA ttr);
304 IntegrityMetadataSet metadataSet; 304 IntegrityMetadataSet metadataSet;
sof 2016/01/06 07:38:13 Looks like you can push this local variable into t
jww 2016/01/06 18:37:53 Done.
305 if (!integrityAttr.isEmpty()) { 305 if (!integrityAttr.isEmpty()) {
306 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadat aSet, elementDocument.get()); 306 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadat aSet, elementDocument.get());
307 request.setIntegrityMetadata(metadataSet); 307 request.setIntegrityMetadata(metadataSet);
308 } 308 }
309 309
310 m_resource = ScriptResource::fetch(request, elementDocument->fetcher()); 310 m_resource = ScriptResource::fetch(request, elementDocument->fetcher());
311 if (m_resource && !integrityAttr.isEmpty())
312 m_resource->setIntegrityMetadata(metadataSet);
313 311
314 m_isExternalScript = true; 312 m_isExternalScript = true;
315 } 313 }
316 314
317 if (m_resource) 315 if (m_resource)
318 return true; 316 return true;
319 317
320 dispatchErrorEvent(); 318 dispatchErrorEvent();
321 return false; 319 return false;
322 } 320 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (isHTMLScriptLoader(element)) 513 if (isHTMLScriptLoader(element))
516 return toHTMLScriptElement(element)->loader(); 514 return toHTMLScriptElement(element)->loader();
517 515
518 if (isSVGScriptLoader(element)) 516 if (isSVGScriptLoader(element))
519 return toSVGScriptElement(element)->loader(); 517 return toSVGScriptElement(element)->loader();
520 518
521 return 0; 519 return 0;
522 } 520 }
523 521
524 } // namespace blink 522 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698