Last change
on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
984 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var inherits = require('inherits')
|
---|
4 | , AjaxBasedTransport = require('./lib/ajax-based')
|
---|
5 | , XhrReceiver = require('./receiver/xhr')
|
---|
6 | , XDRObject = require('./sender/xdr')
|
---|
7 | ;
|
---|
8 |
|
---|
9 | // According to:
|
---|
10 | // http://stackoverflow.com/questions/1641507/detect-browser-support-for-cross-domain-xmlhttprequests
|
---|
11 | // http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
|
---|
12 |
|
---|
13 | function XdrStreamingTransport(transUrl) {
|
---|
14 | if (!XDRObject.enabled) {
|
---|
15 | throw new Error('Transport created when disabled');
|
---|
16 | }
|
---|
17 | AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XDRObject);
|
---|
18 | }
|
---|
19 |
|
---|
20 | inherits(XdrStreamingTransport, AjaxBasedTransport);
|
---|
21 |
|
---|
22 | XdrStreamingTransport.enabled = function(info) {
|
---|
23 | if (info.cookie_needed || info.nullOrigin) {
|
---|
24 | return false;
|
---|
25 | }
|
---|
26 | return XDRObject.enabled && info.sameScheme;
|
---|
27 | };
|
---|
28 |
|
---|
29 | XdrStreamingTransport.transportName = 'xdr-streaming';
|
---|
30 | XdrStreamingTransport.roundTrips = 2; // preflight, ajax
|
---|
31 |
|
---|
32 | module.exports = XdrStreamingTransport;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.