Rename to allowEval

This commit is contained in:
Lukas Reschke 2015-02-16 12:30:21 +01:00
parent b20174bdad
commit a9d1a01440
2 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ class ContentSecurityPolicy {
* @param bool $state * @param bool $state
* @return $this * @return $this
*/ */
public function evalScriptState($state = true) { public function allowEvalScript($state = true) {
$this->evalScriptAllowed= $state; $this->evalScriptAllowed= $state;
return $this; return $this;
} }

View File

@ -66,7 +66,7 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$expectedPolicy = "default-src 'none';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self';font-src 'self';connect-src 'self';media-src 'self'"; $expectedPolicy = "default-src 'none';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self';font-src 'self';connect-src 'self';media-src 'self'";
$this->contentSecurityPolicy->allowInlineScript(false); $this->contentSecurityPolicy->allowInlineScript(false);
$this->contentSecurityPolicy->evalScriptState(false); $this->contentSecurityPolicy->allowEvalScript(false);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy()); $this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
} }
@ -201,7 +201,7 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$expectedPolicy = "default-src 'none';script-src 'self' script.owncloud.org;style-src 'self' style.owncloud.org;img-src 'self' img.owncloud.org;font-src 'self' font.owncloud.org;connect-src 'self' connect.owncloud.org;media-src 'self' media.owncloud.org;object-src objects.owncloud.org;frame-src frame.owncloud.org"; $expectedPolicy = "default-src 'none';script-src 'self' script.owncloud.org;style-src 'self' style.owncloud.org;img-src 'self' img.owncloud.org;font-src 'self' font.owncloud.org;connect-src 'self' connect.owncloud.org;media-src 'self' media.owncloud.org;object-src objects.owncloud.org;frame-src frame.owncloud.org";
$this->contentSecurityPolicy->allowInlineStyle(false) $this->contentSecurityPolicy->allowInlineStyle(false)
->evalScriptState(false) ->allowEvalScript(false)
->addAllowedScriptDomain('script.owncloud.org') ->addAllowedScriptDomain('script.owncloud.org')
->addAllowedStyleDomain('style.owncloud.org') ->addAllowedStyleDomain('style.owncloud.org')
->addAllowedFontDomain('font.owncloud.org') ->addAllowedFontDomain('font.owncloud.org')