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