RIP ActiveXObject · forwardemail/superagent@c1ea82b

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -220,9 +220,6 @@

220220

"rules": {

221221

"unicorn/prevent-abbreviations": "off",

222222

"node/no-unsupported-features/es-syntax": "off"

223-

},

224-

"globals": [

225-

"ActiveXObject"

226-

]

223+

}

227224

}

228225

}

Original file line numberDiff line numberDiff line change

@@ -60,31 +60,10 @@ exports.Request = Request;

6060

*/

6161
6262

request.getXHR = () => {

63-

if (

64-

root.XMLHttpRequest &&

65-

(!root.location ||

66-

root.location.protocol !== 'file:' ||

67-

!root.ActiveXObject)

68-

) {

63+

if (root.XMLHttpRequest) {

6964

return new XMLHttpRequest();

7065

}

7166
72-

try {

73-

return new ActiveXObject('Microsoft.XMLHTTP');

74-

} catch {}

75-
76-

try {

77-

return new ActiveXObject('Msxml2.XMLHTTP.6.0');

78-

} catch {}

79-
80-

try {

81-

return new ActiveXObject('Msxml2.XMLHTTP.3.0');

82-

} catch {}

83-
84-

try {

85-

return new ActiveXObject('Msxml2.XMLHTTP');

86-

} catch {}

87-
8867

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

8968

};

9069