Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47ef65f

Browse filesBrowse files
committed
only load Sfjs if it is not present
Plus, avoid loading the toolbar if it is no longer on the page
1 parent 9c9e645 commit 47ef65f
Copy full SHA for 47ef65f

File tree

1 file changed

+6
-1
lines changed
Filter options

1 file changed

+6
-1
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
them as JavaScript source code. Always use '/*' comments instead
66
of '//' comments to avoid impossible-to-debug side-effects #}
77
8+
if (typeof Sfjs === 'undefined') {
89
Sfjs = (function() {
910
"use strict";
1011
@@ -424,6 +425,10 @@
424425
'sfwdt' + token,
425426
'{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
426427
function(xhr, el) {
428+
/* Do nothing in the edge case where the toolbar has already been replaced with a new one */
429+
if (!document.getElementById('sfToolbarMainContent-' + newToken)) {
430+
return;
431+
}
427432
428433
/* Evaluate in global scope scripts embedded inside the toolbar */
429434
var i, scripts = [].slice.call(el.querySelectorAll('script'));
@@ -799,5 +804,5 @@
799804
Sfjs.createTabs();
800805
Sfjs.createToggles();
801806
});
802-
807+
}
803808
/*]]>*/</script>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.