Skip to content

Toolbar not supporting IE11 (realXHR.responseURL) #1905

Description

@Martin-4Spaces

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".

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