Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar not supporting IE11 (realXHR.responseURL) #1905

Closed
Martin-4Spaces opened this issue Apr 1, 2019 · 0 comments · Fixed by #1931
Closed

Toolbar not supporting IE11 (realXHR.responseURL) #1905

Martin-4Spaces opened this issue Apr 1, 2019 · 0 comments · Fixed by #1931

Comments

@Martin-4Spaces
Copy link

This fine piece of code

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

function newXHR() {
	var realXHR = new oldXHR();
	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;

Located here assumes responseURL exists on realXHR. This is not true for IE11. https://stackoverflow.com/questions/8056277/how-to-get-response-url-in-xmlhttprequest
Instead it results in an error "Unable to get property 'indexOf' of undefined or null reference".

@lonnieezell lonnieezell added this to the 4.0.0-beta.3 milestone Apr 3, 2019
@REJack REJack mentioned this issue Apr 10, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants