Skip to content

Commit 95ae6b3

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: [Yaml] fix exception contexts People - person singularization [Yaml] properly handle unindented collections [Serializer] Add test for ignored attributes during denormalization chomp newlines only at the end of YAML documents Fixed server status command when port has been omitted Update UPGRADE FROM 2.x to 3.0 fix removed commands wording in upgrade file Catch \Throwable Catch \Throwable Use levenshtein level for better Bundle matching [WebProfilerBundle] Fix CORS ajax security issues [DX][DI] Make Autowiring exceptions more future friendly
2 parents f2d8006 + dbd9930 commit 95ae6b3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Resources/views/Profiler/base_js.html.twig

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@
8282
8383
requestStack = [],
8484
85+
extractHeaders = function(xhr, stackElement) {
86+
// Here we avoid to call xhr.getResponseHeader in order to
87+
// prevent polluting the console with CORS security errors
88+
var allHeaders = xhr.getAllResponseHeaders();
89+
var ret;
90+
91+
if (ret = allHeaders.match(/^x-debug-token:\s+(.*)$/im)) {
92+
stackElement.profile = ret[1];
93+
}
94+
if (ret = allHeaders.match(/^x-debug-token-link:\s+(.*)$/im)) {
95+
stackElement.profilerUrl = ret[1];
96+
}
97+
},
98+
8599
renderAjaxRequests = function() {
86100
var requestCounter = document.querySelectorAll('.sf-toolbar-ajax-requests');
87101
if (!requestCounter.length) {
@@ -241,8 +255,8 @@
241255
stackElement.duration = new Date() - stackElement.start;
242256
stackElement.loading = false;
243257
stackElement.error = self.status < 200 || self.status >= 400;
244-
stackElement.profile = self.getResponseHeader("X-Debug-Token");
245-
stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link");
258+
259+
extractHeaders(self, stackElement);
246260
247261
Sfjs.renderAjaxRequests();
248262
}

0 commit comments

Comments
 (0)