Skip to content

Commit

Permalink
RIP ActiveXObject
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmywarting committed May 24, 2021
1 parent 3c9c0f7 commit c1ea82b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
5 changes: 1 addition & 4 deletions package.json
Expand Up @@ -220,9 +220,6 @@
"rules": {
"unicorn/prevent-abbreviations": "off",
"node/no-unsupported-features/es-syntax": "off"
},
"globals": [
"ActiveXObject"
]
}
}
}
23 changes: 1 addition & 22 deletions src/client.js
Expand Up @@ -60,31 +60,10 @@ exports.Request = Request;
*/

request.getXHR = () => {
if (
root.XMLHttpRequest &&
(!root.location ||
root.location.protocol !== 'file:' ||
!root.ActiveXObject)
) {
if (root.XMLHttpRequest) {
return new XMLHttpRequest();
}

try {
return new ActiveXObject('Microsoft.XMLHTTP');
} catch {}

try {
return new ActiveXObject('Msxml2.XMLHTTP.6.0');
} catch {}

try {
return new ActiveXObject('Msxml2.XMLHTTP.3.0');
} catch {}

try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch {}

throw new Error('Browser-only version of superagent could not find XHR');
};

Expand Down

0 comments on commit c1ea82b

Please sign in to comment.