فهرست منبع

[WebProfilerBundle] Make toolbar loading non-blocking

Jordi Boggiano 14 سال پیش
والد
کامیت
406c8d81ef
1فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 7 3
      src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

+ 7 - 3
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

@@ -8,10 +8,14 @@
         } else {
             xhr = new ActiveXObject('Microsoft.XMLHTTP');
         }
-        xhr.open('GET', '{{ path("_wdt", { "token": token }) }}', false);
+        xhr.open('GET', '{{ path("_wdt", { "token": token }) }}', true);
         xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+        xhr.onreadystatechange = function(state) {
+            if (4 === xhr.readyState && 200 === xhr.status) {
+                wdt.innerHTML = xhr.responseText;
+                wdt.style.display = 'block';
+            }
+        };
         xhr.send('');
-        wdt.innerHTML = xhr.responseText;
-        wdt.style.display = 'block';
     })();
 /*]]>*/</script>