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

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

Issue 1583263002: Experimental CompressibleString UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adopt lazy-initializing way 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698