Refactor ContentSecurityPolicy::allow* methods
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2016 08:28:37 +0000 (08:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2016 08:28:37 +0000 (08:28 +0000)
commit69d639d1277967b018c8a4001414f6742ac0d6fa
tree97c33640f083d4c99622d8cfc4b4e265bc5f0ea1
parent4f45684947b2144f8701669f93222de8994dadf2
Refactor ContentSecurityPolicy::allow* methods
https://bugs.webkit.org/show_bug.cgi?id=162335

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-22
Reviewed by Darin Adler.

No change of behavior.

Removing the second parameter of ContentSecurityPolicy::allow* methods.
When true, this parameter makes the methods return true.
This patch updates the callers of allow* methods to check for the parameter before making the call.

Made some refactoring to share more code between the various allow* methods.

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::connect):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isSafeToLoadURL):
(WebCore::HTMLMediaElement::outOfBandTrackSources):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::allowedToLoadPluginContent):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::canLoadURL):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
(WebCore::DocumentThreadableLoader::redirectReceived):
(WebCore::DocumentThreadableLoader::loadRequest):
(WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):
* loader/DocumentThreadableLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkIfFormActionAllowedByCSP):
* loader/PolicyChecker.cpp:
(WebCore::isAllowedByContentSecurityPolicy):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::createJavaAppletWidget):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
* page/EventSource.cpp:
(WebCore::EventSource::create):
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allowObjectFromSource):
(WebCore::ContentSecurityPolicy::allowChildFrameFromSource):
(WebCore::ContentSecurityPolicy::allowResourceFromSource):
(WebCore::ContentSecurityPolicy::allowChildContextFromSource):
(WebCore::ContentSecurityPolicy::allowScriptFromSource):
(WebCore::ContentSecurityPolicy::allowImageFromSource):
(WebCore::ContentSecurityPolicy::allowStyleFromSource):
(WebCore::ContentSecurityPolicy::allowFontFromSource):
(WebCore::ContentSecurityPolicy::allowMediaFromSource):
(WebCore::ContentSecurityPolicy::allowConnectToSource):
(WebCore::ContentSecurityPolicy::allowFormAction):
* page/csp/ContentSecurityPolicy.h:
* workers/AbstractWorker.cpp:
(WebCore::AbstractWorker::resolveURL):
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::importScripts):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::initSend):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchLoader.cpp
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/PolicyChecker.cpp
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.h
Source/WebCore/workers/AbstractWorker.cpp
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebCore/xml/XMLHttpRequest.cpp