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 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 Document* elementDocument = &(m_element->document()); | 364 Document* elementDocument = &(m_element->document()); |
365 Document* contextDocument = elementDocument->contextDocument(); | 365 Document* contextDocument = elementDocument->contextDocument(); |
366 if (!contextDocument) | 366 if (!contextDocument) |
367 return true; | 367 return true; |
368 | 368 |
369 LocalFrame* frame = contextDocument->frame(); | 369 LocalFrame* frame = contextDocument->frame(); |
370 | 370 |
371 const ContentSecurityPolicy* csp = elementDocument->contentSecurityPolicy(); | 371 const ContentSecurityPolicy* csp = elementDocument->contentSecurityPolicy(); |
372 bool shouldBypassMainWorldCSP = (frame && frame->script().shouldBypassMainWo
rldCSP()) | 372 bool shouldBypassMainWorldCSP = (frame && frame->script().shouldBypassMainWo
rldCSP()) |
373 || csp->allowScriptWithHash(sourceCode.source().toString(), ContentSecur
ityPolicy::InlineType::Block) | 373 || csp->allowScriptWithHash(sourceCode.source(), ContentSecurityPolicy::
InlineType::Block) |
374 || (!isParserInserted() && csp->allowDynamic()); | 374 || (!isParserInserted() && csp->allowDynamic()); |
375 | 375 |
376 if (!m_isExternalScript && (!shouldBypassMainWorldCSP && !csp->allowInlineSc
ript(elementDocument->url(), m_element->fastGetAttribute(HTMLNames::nonceAttr),
m_startLineNumber, sourceCode.source().toString()))) { | 376 if (!m_isExternalScript && (!shouldBypassMainWorldCSP && !csp->allowInlineSc
ript(elementDocument->url(), m_element->fastGetAttribute(HTMLNames::nonceAttr),
m_startLineNumber, sourceCode.source()))) { |
377 return false; | 377 return false; |
378 } | 378 } |
379 | 379 |
380 if (m_isExternalScript) { | 380 if (m_isExternalScript) { |
381 ScriptResource* resource = m_resource ? m_resource.get() : sourceCode.re
source(); | 381 ScriptResource* resource = m_resource ? m_resource.get() : sourceCode.re
source(); |
382 if (resource) { | 382 if (resource) { |
383 if (!resource->mimeTypeAllowedByNosniff()) { | 383 if (!resource->mimeTypeAllowedByNosniff()) { |
384 contextDocument->addConsoleMessage(ConsoleMessage::create(Securi
tyMessageSource, ErrorMessageLevel, "Refused to execute script from '" + resourc
e->url().elidedString() + "' because its MIME type ('" + resource->httpContentTy
pe() + "') is not executable, and strict MIME type checking is enabled.")); | 384 contextDocument->addConsoleMessage(ConsoleMessage::create(Securi
tyMessageSource, ErrorMessageLevel, "Refused to execute script from '" + resourc
e->url().elidedString() + "' because its MIME type ('" + resource->httpContentTy
pe() + "') is not executable, and strict MIME type checking is enabled.")); |
385 return false; | 385 return false; |
386 } | 386 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (isHTMLScriptLoader(element)) | 519 if (isHTMLScriptLoader(element)) |
520 return toHTMLScriptElement(element)->loader(); | 520 return toHTMLScriptElement(element)->loader(); |
521 | 521 |
522 if (isSVGScriptLoader(element)) | 522 if (isSVGScriptLoader(element)) |
523 return toSVGScriptElement(element)->loader(); | 523 return toSVGScriptElement(element)->loader(); |
524 | 524 |
525 return 0; | 525 return 0; |
526 } | 526 } |
527 | 527 |
528 } // namespace blink | 528 } // namespace blink |
OLD | NEW |