[WebProfilerBundle] Fix content-security-policy compatibility

This fixes the compatibility of the bundle in case of a `style-src 'self'` policy.
This commit is contained in:
Romain Neutron 2017-03-21 11:08:09 +01:00
parent 48e90e3124
commit 4acec8973f
No known key found for this signature in database
GPG Key ID: 201FC7CF9F0CA3ED
3 changed files with 5 additions and 5 deletions

View File

@ -4,9 +4,6 @@
{{ include('@WebProfiler/Icon/symfony.svg') }}
</a>
</div>
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
{{ include('@WebProfiler/Profiler/toolbar.css.twig', { 'position': position, 'floatable': true }) }}
</style>
<div id="sfToolbarClearer-{{ token }}" class="sf-toolbar-clearer"></div>
<div id="sfToolbarMainContent-{{ token }}" class="sf-toolbarreset clear-fix" data-no-turbolink>

View File

@ -1,5 +1,8 @@
<div id="sfwdt{{ token }}" class="sf-toolbar sf-display-none"></div>
{{ include('@WebProfiler/Profiler/base_js.html.twig') }}
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
{{ include('@WebProfiler/Profiler/toolbar.css.twig', { 'position': position, 'floatable': true }) }}
</style>
<script{% if csp_script_nonce %} nonce={{ csp_script_nonce }}{% endif %}>/*<![CDATA[*/
(function () {
{% if 'top' == position %}

View File

@ -157,9 +157,9 @@ class ProfilerControllerTest extends TestCase
if ($withCSP) {
$nonceGenerator = $this->getMockBuilder('Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator')->getMock();
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'normal', new ContentSecurityPolicyHandler($nonceGenerator));
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'bottom', new ContentSecurityPolicyHandler($nonceGenerator));
}
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'normal');
return new ProfilerController($urlGenerator, $profiler, $twig, array());
}
}