From 0cd51ae26728872f51b62ee1efe9e4a873d3e4c3 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Mon, 7 May 2018 21:26:27 +0200 Subject: [PATCH] [Profiler] Fix dump makes toolbar disappear --- .../Resources/views/Profiler/base_js.html.twig | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index 1553f304dabe4..7088cd87835e9 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -418,12 +418,10 @@ '{{ path("_wdt", { "token": "xxxxxx" }) }}'.replace(/xxxxxx/, newToken), function(xhr, el) { - /* Evaluate embedded scripts inside the toolbar */ - var i, scripts = [].slice.call(el.querySelectorAll('script')); - - for (i = 0; i < scripts.length; ++i) { - eval(scripts[i].firstChild.nodeValue); - } + /* Evaluate in global scope scripts embedded inside the toolbar */ + eval.call({}, ([].slice.call(el.querySelectorAll('script')).map(function (script) { + return script.firstChild.nodeValue; + }).join('\n'))); el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none'; @@ -442,7 +440,7 @@ } /* Handle toolbar-info position */ - var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block')); + var i, toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block')); for (i = 0; i < toolbarBlocks.length; ++i) { toolbarBlocks[i].onmouseover = function () { var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];