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,
'templates' => $this->getTemplateManager()->getTemplates($profile),
'is_ajax' => $request->isXmlHttpRequest(),
'excluded_ajax_paths' => null,
)), 200, array('Content-Type' => 'text/html'));
}

View File

@ -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,