diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index fc178a837c..2efb84a14d 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -108,7 +108,6 @@ class ProfilerController 'request' => $request, 'templates' => $this->getTemplateManager()->getTemplates($profile), 'is_ajax' => $request->isXmlHttpRequest(), - 'excluded_ajax_paths' => null, )), 200, array('Content-Type' => 'text/html')); } 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 f664d9a8e3..f5af3a9964 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 @@ -171,40 +171,42 @@ requestCounter[0].className = className; }; - var proxied = XMLHttpRequest.prototype.open; + {% if (excluded_ajax_paths is defined) %} + var proxied = XMLHttpRequest.prototype.open; - XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { - var self = this; + XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { + var self = this; - /* prevent logging AJAX calls to static and inline files, like templates */ - if (url.substr(0, 1) === '/' && !url.match(new RegExp("{{ excluded_ajax_paths }}"))) { - var stackElement = { - loading: true, - error: false, - url: url, - method: method, - start: new Date() - }; + /* prevent logging AJAX calls to static and inline files, like templates */ + if (url.substr(0, 1) === '/' && !url.match(new RegExp("{{ excluded_ajax_paths }}"))) { + var stackElement = { + loading: true, + error: false, + url: url, + method: method, + start: new Date() + }; - requestStack.push(stackElement); + requestStack.push(stackElement); - this.addEventListener("readystatechange", function() { - if (self.readyState == 4) { - stackElement.duration = new Date() - stackElement.start; - stackElement.loading = false; - stackElement.error = self.status < 200 || self.status >= 400; - stackElement.profile = self.getResponseHeader("X-Debug-Token"); - stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link"); + this.addEventListener("readystatechange", function() { + if (self.readyState == 4) { + stackElement.duration = new Date() - stackElement.start; + stackElement.loading = false; + stackElement.error = self.status < 200 || self.status >= 400; + stackElement.profile = self.getResponseHeader("X-Debug-Token"); + stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link"); - Sfjs.renderAjaxRequests(); - } - }, false); + Sfjs.renderAjaxRequests(); + } + }, false); - Sfjs.renderAjaxRequests(); - } + Sfjs.renderAjaxRequests(); + } - proxied.apply(this, Array.prototype.slice.call(arguments)); - }; + proxied.apply(this, Array.prototype.slice.call(arguments)); + }; + {% endif %} return { hasClass: hasClass,