Skip to content

Commit 4acec89

Browse files
committed
[WebProfilerBundle] Fix content-security-policy compatibility
This fixes the compatibility of the bundle in case of a `style-src 'self'` policy.
1 parent 48e90e3 commit 4acec89

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
{{ include('@WebProfiler/Icon/symfony.svg') }}
55
</a>
66
</div>
7-
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
8-
{{ include('@WebProfiler/Profiler/toolbar.css.twig', { 'position': position, 'floatable': true }) }}
9-
</style>
107
<div id="sfToolbarClearer-{{ token }}" class="sf-toolbar-clearer"></div>
118

129
<div id="sfToolbarMainContent-{{ token }}" class="sf-toolbarreset clear-fix" data-no-turbolink>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<div id="sfwdt{{ token }}" class="sf-toolbar sf-display-none"></div>
22
{{ include('@WebProfiler/Profiler/base_js.html.twig') }}
3+
<style{% if csp_style_nonce %} nonce="{{ csp_style_nonce }}"{% endif %}>
4+
{{ include('@WebProfiler/Profiler/toolbar.css.twig', { 'position': position, 'floatable': true }) }}
5+
</style>
36
<script{% if csp_script_nonce %} nonce={{ csp_script_nonce }}{% endif %}>/*<![CDATA[*/
47
(function () {
58
{% if 'top' == position %}

src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ private function createController($profiler, $twig, $withCSP)
157157
if ($withCSP) {
158158
$nonceGenerator = $this->getMockBuilder('Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator')->getMock();
159159

160-
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'normal', new ContentSecurityPolicyHandler($nonceGenerator));
160+
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'bottom', new ContentSecurityPolicyHandler($nonceGenerator));
161161
}
162162

163-
return new ProfilerController($urlGenerator, $profiler, $twig, array(), 'normal');
163+
return new ProfilerController($urlGenerator, $profiler, $twig, array());
164164
}
165165
}

0 commit comments

Comments
 (0)