OLD | NEW |
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 | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 ResourceRequest(elementDocument->completeURL(sourceUrl)), | 338 ResourceRequest(elementDocument->completeURL(sourceUrl)), |
339 m_element->localName()); | 339 m_element->localName()); |
340 | 340 |
341 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue( | 341 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue( |
342 m_element->fastGetAttribute(HTMLNames::crossoriginAttr)); | 342 m_element->fastGetAttribute(HTMLNames::crossoriginAttr)); |
343 if (crossOrigin != CrossOriginAttributeNotSet) | 343 if (crossOrigin != CrossOriginAttributeNotSet) |
344 request.setCrossOriginAccessControl(elementDocument->getSecurityOrigin(), | 344 request.setCrossOriginAccessControl(elementDocument->getSecurityOrigin(), |
345 crossOrigin); | 345 crossOrigin); |
346 request.setCharset(scriptCharset()); | 346 request.setCharset(scriptCharset()); |
347 | 347 |
348 // Skip fetch-related CSP checks if dynamically injected script is | 348 if (ContentSecurityPolicy::isNonceableElement(m_element.get())) { |
349 // whitelisted and this script is not parser-inserted. | |
350 bool scriptPassesCSPDynamic = | |
351 (!isParserInserted() && | |
352 elementDocument->contentSecurityPolicy()->allowDynamic()); | |
353 | |
354 if (ContentSecurityPolicy::isNonceableElement(m_element.get())) | |
355 request.setContentSecurityPolicyNonce( | 349 request.setContentSecurityPolicyNonce( |
356 m_element->fastGetAttribute(HTMLNames::nonceAttr)); | 350 m_element->fastGetAttribute(HTMLNames::nonceAttr)); |
| 351 } |
357 | 352 |
358 if (scriptPassesCSPDynamic) { | 353 request.setParserDisposition(isParserInserted() ? ParserInserted |
359 UseCounter::count(elementDocument->frame(), | 354 : NotParserInserted); |
360 UseCounter::ScriptPassesCSPDynamic); | 355 |
361 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); | |
362 } | |
363 request.setDefer(defer); | 356 request.setDefer(defer); |
364 | 357 |
365 String integrityAttr = | 358 String integrityAttr = |
366 m_element->fastGetAttribute(HTMLNames::integrityAttr); | 359 m_element->fastGetAttribute(HTMLNames::integrityAttr); |
367 if (!integrityAttr.isEmpty()) { | 360 if (!integrityAttr.isEmpty()) { |
368 IntegrityMetadataSet metadataSet; | 361 IntegrityMetadataSet metadataSet; |
369 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadataSet, | 362 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadataSet, |
370 elementDocument); | 363 elementDocument); |
371 request.setIntegrityMetadata(metadataSet); | 364 request.setIntegrityMetadata(metadataSet); |
372 } | 365 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 if (isHTMLScriptLoader(element)) | 646 if (isHTMLScriptLoader(element)) |
654 return toHTMLScriptElement(element)->loader(); | 647 return toHTMLScriptElement(element)->loader(); |
655 | 648 |
656 if (isSVGScriptLoader(element)) | 649 if (isSVGScriptLoader(element)) |
657 return toSVGScriptElement(element)->loader(); | 650 return toSVGScriptElement(element)->loader(); |
658 | 651 |
659 return 0; | 652 return 0; |
660 } | 653 } |
661 | 654 |
662 } // namespace blink | 655 } // namespace blink |
OLD | NEW |