[Pkg-javascript-commits] [sockjs-client] 106/350: Don't need environment logic for list of transports now
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:03:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.
commit 48bf3f39b542c85d07b6ab509e6bdb0381ea424c
Author: Bryce Kahle <bkahle at gmail.com>
Date: Fri Oct 10 12:15:03 2014 -0400
Don't need environment logic for list of transports now
---
lib/entry.js | 9 +--------
lib/iframe-bootstrap.js | 4 ++--
lib/polyfills/location.js | 1 +
lib/transport/jsonp-polling.js | 2 +-
4 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/lib/entry.js b/lib/entry.js
index 9e188c8..c2fa15a 100644
--- a/lib/entry.js
+++ b/lib/entry.js
@@ -1,6 +1,6 @@
'use strict';
-var browserTransports = [
+var transports = [
// streaming transports
require('./transport/websocket')
, require('./transport/xdr-streaming')
@@ -15,11 +15,4 @@ var browserTransports = [
, require('./transport/jsonp-polling')
];
-var nodeTransports = [
- require('./transport/websocket')
-, require('./transport/xhr-streaming')
-, require('./transport/xhr-polling')
-];
-
-var transports = typeof window !== 'undefined' ? browserTransports : nodeTransports;
module.exports = require('./main')(transports);
diff --git a/lib/iframe-bootstrap.js b/lib/iframe-bootstrap.js
index e289f44..b38ebf2 100644
--- a/lib/iframe-bootstrap.js
+++ b/lib/iframe-bootstrap.js
@@ -23,7 +23,7 @@ module.exports = function (SockJS, facadeTransports) {
SockJS.bootstrap_iframe = function() {
/* eslint-enable camelcase */
var facade;
- iframeUtils.currentWindowId = global.location.hash.slice(1);
+ iframeUtils.currentWindowId = loc.hash.slice(1);
var onMessage = function(e) {
if (e.source !== parent) {
return;
@@ -58,7 +58,7 @@ module.exports = function (SockJS, facadeTransports) {
if (!originUtils.isSameOriginUrl(transUrl, loc.href) ||
!originUtils.isSameOriginUrl(baseUrl, loc.href)) {
throw new Error('Can\'t connect to different domain from within an ' +
- 'iframe. (' + JSON3.stringify([global.location.href, transUrl, baseUrl]) +
+ 'iframe. (' + JSON3.stringify([loc.href, transUrl, baseUrl]) +
')');
}
facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl));
diff --git a/lib/polyfills/location.js b/lib/polyfills/location.js
index 935f4b1..79a9a9f 100644
--- a/lib/polyfills/location.js
+++ b/lib/polyfills/location.js
@@ -6,4 +6,5 @@ module.exports = global.location || {
, host: 'localhost'
, port: 80
, href: 'http://localhost/'
+, hash: ''
};
diff --git a/lib/transport/jsonp-polling.js b/lib/transport/jsonp-polling.js
index 06c0e27..2e55479 100644
--- a/lib/transport/jsonp-polling.js
+++ b/lib/transport/jsonp-polling.js
@@ -37,7 +37,7 @@ JsonPTransport.prototype.close = function() {
};
JsonPTransport.enabled = function() {
- return true;
+ return !!global.document;
};
JsonPTransport.transportName = 'jsonp-polling';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list