Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68b6c32

Browse files
[WebProfilerBundle] Fix infinite loop in JS
1 parent ec9cbab commit 68b6c32

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
function(xhr, el) {
1717
1818
/* Evaluate embedded scripts inside the toolbar */
19-
var rx=/<script>(.*?)<\/script>/g, s;
20-
while (s = rx.exec(el.innerHTML)) {eval(s[1]);};
19+
var i, scripts = [].slice.call(el.querySelectorAll('script'));
20+
21+
for (i = 0; i < scripts.length; ++i) {
22+
eval(scripts[i].firstChild.nodeValue);
23+
}
2124
2225
el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none';
2326
@@ -38,8 +41,8 @@
3841
Sfjs.renderAjaxRequests();
3942
4043
/* Handle toolbar-info position */
41-
var toolbarBlocks = document.querySelectorAll('.sf-toolbar-block');
42-
for (var i = 0; i < toolbarBlocks.length; i += 1) {
44+
var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block'));
45+
for (i = 0; i < toolbarBlocks.length; ++i) {
4346
toolbarBlocks[i].onmouseover = function () {
4447
var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
4548
var pageWidth = document.body.clientWidth;

0 commit comments

Comments
 (0)