File tree Expand file tree Collapse file tree 5 files changed +31
-5
lines changed Expand file tree Collapse file tree 5 files changed +31
-5
lines changed Original file line number Diff line number Diff line change 1
1
/* global attachEvent */
2
2
3
- import * as XMLHttpRequestModule from "xmlhttprequest-ssl " ;
3
+ import XMLHttpRequest from "./ xmlhttprequest.js " ;
4
4
import debugModule from "debug" ; // debug()
5
5
import globalThis from "../globalThis.js" ;
6
6
import { installTimerFunctions , pick } from "../util.js" ;
@@ -10,8 +10,6 @@ import { SocketOptions } from "../socket.js";
10
10
11
11
const debug = debugModule ( "engine.io-client:polling-xhr" ) ; // debug()
12
12
13
- const XMLHttpRequest = XMLHttpRequestModule . default || XMLHttpRequestModule ;
14
-
15
13
/**
16
14
* Empty function
17
15
*/
Original file line number Diff line number Diff line change
1
+ // browser shim for xmlhttprequest module
2
+
3
+ import hasCORS from "has-cors" ;
4
+ import globalThis from "../globalThis.js" ;
5
+
6
+ export default function ( opts ) {
7
+ const xdomain = opts . xdomain ;
8
+
9
+ // XMLHttpRequest can be disabled on IE
10
+ try {
11
+ if ( "undefined" !== typeof XMLHttpRequest && ( ! xdomain || hasCORS ) ) {
12
+ return new XMLHttpRequest ( ) ;
13
+ }
14
+ } catch ( e ) { }
15
+
16
+ if ( ! xdomain ) {
17
+ try {
18
+ return new globalThis [ [ "Active" ] . concat ( "Object" ) . join ( "X" ) ] (
19
+ "Microsoft.XMLHTTP"
20
+ ) ;
21
+ } catch ( e ) { }
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ import * as XMLHttpRequestModule from "xmlhttprequest-ssl" ;
2
+
3
+ const XMLHttpRequest = XMLHttpRequestModule . default || XMLHttpRequestModule ;
4
+
5
+ export default XMLHttpRequest ;
Original file line number Diff line number Diff line change 2
2
"type" : " commonjs" ,
3
3
"browser" : {
4
4
"ws" : false ,
5
- "xmlhttprequest-ssl " : " ./xmlhttprequest.js" ,
5
+ "./transports/ xmlhttprequest.js " : " ./transports/ xmlhttprequest.browser .js" ,
6
6
"./transports/websocket-constructor.js" : " ./transports/websocket-constructor.browser.js" ,
7
7
"./globalThis.js" : " ./globalThis.browser.js"
8
8
}
Original file line number Diff line number Diff line change 2
2
"type" : " module" ,
3
3
"browser" : {
4
4
"ws" : false ,
5
- "xmlhttprequest-ssl " : " ./xmlhttprequest.js" ,
5
+ "./transports/ xmlhttprequest.js " : " ./transports/ xmlhttprequest.browser .js" ,
6
6
"./transports/websocket-constructor.js" : " ./transports/websocket-constructor.browser.js" ,
7
7
"./globalThis.js" : " ./globalThis.browser.js"
8
8
}
You can’t perform that action at this time.
0 commit comments