remove activex fallback for internet explorer (#16453)

* remove IE6 XHR support

IE7 and later support XMLHttpRequest natively, and most of the rest of
the code base uses fetch() which may not work in any version of IE

Drop the conditional here in the assumption that this would only be
the first of many problems for a user with an unsupported browser.
This commit is contained in:
Daniel Uber 2022-02-08 08:36:04 -06:00 committed by GitHub
parent 097298a5e6
commit 39c5bcd518
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 30 deletions

View file

@ -21,11 +21,7 @@ function markNotificationsAsRead() {
10,
);
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {};
var csrfToken = document.querySelector("meta[name='csrf-token']").content;

View file

@ -132,11 +132,7 @@ function setCollectionFunctionality() {
function requestReactionCounts(articleId) {
var ajaxReq;
if (window.XMLHttpRequest) {
ajaxReq = new XMLHttpRequest();
} else {
ajaxReq = new ActiveXObject('Microsoft.XMLHTTP');
}
ajaxReq = new XMLHttpRequest();
ajaxReq.onreadystatechange = () => {
if (ajaxReq.readyState === XMLHttpRequest.DONE) {
var json = JSON.parse(ajaxReq.response);

View file

@ -9,13 +9,10 @@ function removeExistingCSRF() {
}
}
/* TODO: prefer fetch() to XMLHttpRequest */
function fetchBaseData() {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = () => {
if (xmlhttp.readyState === XMLHttpRequest.DONE) {
// Assigning CSRF

View file

@ -28,11 +28,7 @@ function initializeCommentsPage() {
for (var i = 0; i < commentableIdList.length; i++) {
(function(i){
var ajaxReq;
if (window.XMLHttpRequest) {
ajaxReq = new XMLHttpRequest();
} else {
ajaxReq = new ActiveXObject('Microsoft.XMLHTTP');
}
ajaxReq = new XMLHttpRequest();
ajaxReq.onreadystatechange = function () {
if (ajaxReq.readyState === XMLHttpRequest.DONE) {
var responseObj = JSON.parse(ajaxReq.response);

View file

@ -21,11 +21,7 @@
}
function createAjaxReq() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else {
return new ActiveXObject("Microsoft.XMLHTTP");
}
return new XMLHttpRequest();
}
});
</script>

View file

@ -80,11 +80,8 @@
window.location.pathname !== '/notifications'
) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
var count = xmlhttp.response;