-
Notifications
You must be signed in to change notification settings - Fork 272
/
cors.patch
25 lines (25 loc) · 951 Bytes
/
cors.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
diff --git a/transformers/sockjs/library.js b/transformers/sockjs/library.js
index 7666a55..095fa29 100644
--- a/transformers/sockjs/library.js
+++ b/transformers/sockjs/library.js
@@ -922,12 +922,14 @@ XDRObject.prototype.close = function() {
// 3. Nope, but postMessage is there so it should work via the Iframe.
// 4. Nope, sorry.
utils.isXHRCorsCapable = function() {
- if (_window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()) {
- return 1;
- }
- // XDomainRequest doesn't work if page is served from file://
- if (_window.XDomainRequest && _document.domain) {
- return 2;
+ // CORS doesn't work if page is served from file://
+ if (_document.domain) {
+ if (_window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()) {
+ return 1;
+ }
+ if (_window.XDomainRequest) {
+ return 2;
+ }
}
if (IframeTransport.enabled()) {
return 3;