[Pkg-javascript-commits] [sockjs-client] 214/350: Add enabled checks to transport constructors
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:04:23 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 9f2d41d04e9a9fb20dcd4fe6684ba8ae31118a1f
Author: Bryce Kahle <bkahle at gmail.com>
Date: Tue Oct 21 12:50:50 2014 -0400
Add enabled checks to transport constructors
---
lib/transport/eventsource.js | 4 ++++
lib/transport/htmlfile.js | 3 +++
lib/transport/iframe.js | 3 +++
lib/transport/jsonp-polling.js | 3 +++
lib/transport/websocket.js | 4 ++++
lib/transport/xdr-polling.js | 3 +++
lib/transport/xdr-streaming.js | 3 +++
lib/transport/xhr-polling.js | 3 +++
lib/transport/xhr-streaming.js | 3 +++
9 files changed, 29 insertions(+)
diff --git a/lib/transport/eventsource.js b/lib/transport/eventsource.js
index 9fab98c..62685cf 100644
--- a/lib/transport/eventsource.js
+++ b/lib/transport/eventsource.js
@@ -8,6 +8,10 @@ var inherits = require('inherits')
;
function EventSourceTransport(transUrl) {
+ if (!EventSourceTransport.enabled()) {
+ throw new Error('Transport created when disabled');
+ }
+
AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);
}
diff --git a/lib/transport/htmlfile.js b/lib/transport/htmlfile.js
index b7f65b1..633b077 100644
--- a/lib/transport/htmlfile.js
+++ b/lib/transport/htmlfile.js
@@ -7,6 +7,9 @@ var inherits = require('inherits')
;
function HtmlFileTransport(transUrl) {
+ if (!HtmlfileReceiver.enabled) {
+ throw new Error('Transport created when disabled');
+ }
AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject);
}
diff --git a/lib/transport/iframe.js b/lib/transport/iframe.js
index c81f5c4..99b0ecb 100644
--- a/lib/transport/iframe.js
+++ b/lib/transport/iframe.js
@@ -24,6 +24,9 @@ if (process.env.NODE_ENV !== 'production') {
}
function IframeTransport(transport, transUrl, baseUrl) {
+ if (!IframeTransport.enabled()) {
+ throw new Error('Transport created when disabled');
+ }
EventEmitter.call(this);
var self = this;
diff --git a/lib/transport/jsonp-polling.js b/lib/transport/jsonp-polling.js
index 054438d..9883ab9 100644
--- a/lib/transport/jsonp-polling.js
+++ b/lib/transport/jsonp-polling.js
@@ -15,6 +15,9 @@ var inherits = require('inherits')
;
function JsonPTransport(transUrl) {
+ if (!JsonPTransport.enabled()) {
+ throw new Error('Transport created when disabled');
+ }
SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);
}
diff --git a/lib/transport/websocket.js b/lib/transport/websocket.js
index e64403e..8e0b597 100644
--- a/lib/transport/websocket.js
+++ b/lib/transport/websocket.js
@@ -13,6 +13,10 @@ if (process.env.NODE_ENV !== 'production') {
}
function WebSocketTransport(transUrl) {
+ if (!WebSocketTransport.enabled()) {
+ throw new Error('Transport created when disabled');
+ }
+
EventEmitter.call(this);
debug('constructor', transUrl);
diff --git a/lib/transport/xdr-polling.js b/lib/transport/xdr-polling.js
index 36a1f9b..da84404 100644
--- a/lib/transport/xdr-polling.js
+++ b/lib/transport/xdr-polling.js
@@ -8,6 +8,9 @@ var inherits = require('inherits')
;
function XdrPollingTransport(transUrl) {
+ if (!XDRObject.enabled) {
+ throw new Error('Transport created when disabled');
+ }
AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XDRObject);
}
diff --git a/lib/transport/xdr-streaming.js b/lib/transport/xdr-streaming.js
index 33fc7ab..0fede49 100644
--- a/lib/transport/xdr-streaming.js
+++ b/lib/transport/xdr-streaming.js
@@ -11,6 +11,9 @@ var inherits = require('inherits')
// http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
function XdrStreamingTransport(transUrl) {
+ if (!XDRObject.enabled) {
+ throw new Error('Transport created when disabled');
+ }
AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XDRObject);
}
diff --git a/lib/transport/xhr-polling.js b/lib/transport/xhr-polling.js
index 546a42f..a07ad9f 100644
--- a/lib/transport/xhr-polling.js
+++ b/lib/transport/xhr-polling.js
@@ -8,6 +8,9 @@ var inherits = require('inherits')
;
function XhrPollingTransport(transUrl) {
+ if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {
+ throw new Error('Transport created when disabled');
+ }
AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XHRCorsObject);
}
diff --git a/lib/transport/xhr-streaming.js b/lib/transport/xhr-streaming.js
index 5e6a5d0..678cb72 100644
--- a/lib/transport/xhr-streaming.js
+++ b/lib/transport/xhr-streaming.js
@@ -9,6 +9,9 @@ var inherits = require('inherits')
;
function XhrStreamingTransport(transUrl) {
+ if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {
+ throw new Error('Transport created when disabled');
+ }
AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XHRCorsObject);
}
--
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