Skip to content

DebugToolbar - too much recursion #1650

Description

@nowackipawel

I've noticed on some pages that there is no Debug Toolbar icon... i thought it is because of my CSP settings... but I think it is because:

I've noticed on some pages that there is no Debug Toolbar icon... i thought it is because of my CSP settings... but I think it is because:

FF:

dev.my-host.com:66:6
newXHR
https://dev.my-host.com/:66:6
newXHR
https://dev.my-host.com/:66:16
newXHR
https://dev.my-host.com/:66:16
newXHR
https://dev.my-host.com/:66:16
newXHR
https://dev.my-host.com/:66:16
newXHR
(... about 60 times X 2)

Irudium@Chromium:

2?debugbar:1 Uncaught RangeError: Maximum call stack size exceeded
    at new newXHR (?debugbar:1)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)
    at new newXHR (?debugbar:66)

I think my code is up to date:


// Track all AJAX requests           - LINE 62
var oldXHR = window.XMLHttpRequest;

function newXHR() {
	var realXHR = new oldXHR();    - LINE 66
	realXHR.addEventListener("readystatechange", function() {
		// Only success responses and URLs that do not contains "debugbar_time" are tracked
		if (realXHR.readyState === 4 && realXHR.status.toString()[0] === '2' && realXHR.responseURL.indexOf('debugbar_time') === -1) {
			var debugbarTime = realXHR.getResponseHeader('Debugbar-Time');
			if (debugbarTime) {
				var h2 = document.querySelector('#ci-history > h2');
				h2.innerHTML = 'History <small>You have new debug data.</small> <button onclick="loadDoc(' + debugbarTime + ')">Update</button>';
				var badge = document.querySelector('a[data-tab="ci-history"] > span > .badge');
				badge.className += ' active';
			}
		}
	}, false);
	return realXHR;
}

window.XMLHttpRequest = newXHR;        - LINE 82

in this case I don't use d() or anything like that, just wanna to see Debug Toolbar. There is some complex data passed to the view but nothing big :/.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions