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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document()); | 354 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document()); |
355 RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocum
ent().get(); | 355 RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocum
ent().get(); |
356 if (!contextDocument) | 356 if (!contextDocument) |
357 return true; | 357 return true; |
358 | 358 |
359 LocalFrame* frame = contextDocument->frame(); | 359 LocalFrame* frame = contextDocument->frame(); |
360 | 360 |
361 const ContentSecurityPolicy* csp = elementDocument->contentSecurityPolicy(); | 361 const ContentSecurityPolicy* csp = elementDocument->contentSecurityPolicy(); |
362 bool shouldBypassMainWorldCSP = (frame && frame->script().shouldBypassMainWo
rldCSP()) | 362 bool shouldBypassMainWorldCSP = (frame && frame->script().shouldBypassMainWo
rldCSP()) |
363 || csp->allowScriptWithNonce(m_element->fastGetAttribute(HTMLNames::nonc
eAttr)) | 363 || csp->allowScriptWithNonce(m_element->fastGetAttribute(HTMLNames::nonc
eAttr)) |
364 || csp->allowScriptWithHash(sourceCode.source()); | 364 || csp->allowScriptWithHash(sourceCode.source().toString()); |
365 | 365 |
366 if (!m_isExternalScript && (!shouldBypassMainWorldCSP && !csp->allowInlineSc
ript(elementDocument->url(), m_startLineNumber, sourceCode.source()))) { | 366 if (!m_isExternalScript && (!shouldBypassMainWorldCSP && !csp->allowInlineSc
ript(elementDocument->url(), m_startLineNumber, sourceCode.source().toString()))
) { |
367 return false; | 367 return false; |
368 } | 368 } |
369 | 369 |
370 if (m_isExternalScript) { | 370 if (m_isExternalScript) { |
371 ScriptResource* resource = m_resource ? m_resource.get() : sourceCode.re
source(); | 371 ScriptResource* resource = m_resource ? m_resource.get() : sourceCode.re
source(); |
372 if (resource) { | 372 if (resource) { |
373 if (!resource->mimeTypeAllowedByNosniff()) { | 373 if (!resource->mimeTypeAllowedByNosniff()) { |
374 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.")); | 374 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.")); |
375 return false; | 375 return false; |
376 } | 376 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 if (isHTMLScriptLoader(element)) | 513 if (isHTMLScriptLoader(element)) |
514 return toHTMLScriptElement(element)->loader(); | 514 return toHTMLScriptElement(element)->loader(); |
515 | 515 |
516 if (isSVGScriptLoader(element)) | 516 if (isSVGScriptLoader(element)) |
517 return toSVGScriptElement(element)->loader(); | 517 return toSVGScriptElement(element)->loader(); |
518 | 518 |
519 return 0; | 519 return 0; |
520 } | 520 } |
521 | 521 |
522 } // namespace blink | 522 } // namespace blink |
OLD | NEW |