removed hack

This commit is contained in:
Fabien Potencier 2014-09-23 15:47:39 +02:00
parent 9c74fccacf
commit b66f39ab2d
2 changed files with 29 additions and 28 deletions

View File

@ -108,7 +108,6 @@ class ProfilerController
'request' => $request, 'request' => $request,
'templates' => $this->getTemplateManager()->getTemplates($profile), 'templates' => $this->getTemplateManager()->getTemplates($profile),
'is_ajax' => $request->isXmlHttpRequest(), 'is_ajax' => $request->isXmlHttpRequest(),
'excluded_ajax_paths' => null,
)), 200, array('Content-Type' => 'text/html')); )), 200, array('Content-Type' => 'text/html'));
} }

View File

@ -171,40 +171,42 @@
requestCounter[0].className = className; 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) { XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
var self = this; var self = this;
/* prevent logging AJAX calls to static and inline files, like templates */ /* prevent logging AJAX calls to static and inline files, like templates */
if (url.substr(0, 1) === '/' && !url.match(new RegExp("{{ excluded_ajax_paths }}"))) { if (url.substr(0, 1) === '/' && !url.match(new RegExp("{{ excluded_ajax_paths }}"))) {
var stackElement = { var stackElement = {
loading: true, loading: true,
error: false, error: false,
url: url, url: url,
method: method, method: method,
start: new Date() start: new Date()
}; };
requestStack.push(stackElement); requestStack.push(stackElement);
this.addEventListener("readystatechange", function() { this.addEventListener("readystatechange", function() {
if (self.readyState == 4) { if (self.readyState == 4) {
stackElement.duration = new Date() - stackElement.start; stackElement.duration = new Date() - stackElement.start;
stackElement.loading = false; stackElement.loading = false;
stackElement.error = self.status < 200 || self.status >= 400; stackElement.error = self.status < 200 || self.status >= 400;
stackElement.profile = self.getResponseHeader("X-Debug-Token"); stackElement.profile = self.getResponseHeader("X-Debug-Token");
stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link"); stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link");
Sfjs.renderAjaxRequests(); Sfjs.renderAjaxRequests();
} }
}, false); }, false);
Sfjs.renderAjaxRequests(); Sfjs.renderAjaxRequests();
} }
proxied.apply(this, Array.prototype.slice.call(arguments)); proxied.apply(this, Array.prototype.slice.call(arguments));
}; };
{% endif %}
return { return {
hasClass: hasClass, hasClass: hasClass,