[Pkg-javascript-commits] [sockjs-client] 317/350: [dist] 1.0.1
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:04:34 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 5af2fce8ec2c33be207b95b45b10c3cd14223532
Author: Bryce Kahle <bkahle at gmail.com>
Date: Sun Jul 19 17:54:43 2015 -0700
[dist] 1.0.1
---
Changelog.md | 9 ++++++++
dist/sockjs-1.0.0.min.js | 3 ---
dist/{sockjs-1.0.0.js => sockjs-1.0.1.js} | 38 +++++++++++++++++++++++--------
dist/sockjs-1.0.1.min.js | 3 +++
dist/sockjs.js | 38 +++++++++++++++++++++++--------
dist/sockjs.min.js | 6 ++---
gulpfile.js | 4 ----
lib/version.js | 2 +-
package.json | 2 +-
9 files changed, 75 insertions(+), 30 deletions(-)
diff --git a/Changelog.md b/Changelog.md
index 6c64398..6525332 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,12 @@
+1.0.1
+==
+
+ * Use proper base url for iframe-based info receiver - #249
+ * Don't register unload event in chrome packaged app - #223
+ * Allow custom session ids - #250
+ * Remove version property from bower.json - #247
+ * Update example CDN url - #244
+
1.0.0
===
diff --git a/dist/sockjs-1.0.0.min.js b/dist/sockjs-1.0.0.min.js
deleted file mode 100644
index d6719a4..0000000
--- a/dist/sockjs-1.0.0.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* sockjs-client v1.0.0 | http://sockjs.org | MIT license */
-!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");th [...]
-}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r= [...]
\ No newline at end of file
diff --git a/dist/sockjs-1.0.0.js b/dist/sockjs-1.0.1.js
similarity index 99%
rename from dist/sockjs-1.0.0.js
rename to dist/sockjs-1.0.1.js
index 11de7c7..12f8fbb 100644
--- a/dist/sockjs-1.0.0.js
+++ b/dist/sockjs-1.0.1.js
@@ -1,4 +1,4 @@
-/* sockjs-client v1.0.0 | http://sockjs.org | MIT license */
+/* sockjs-client v1.0.1 | http://sockjs.org | MIT license */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.SockJS=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot fin [...]
(function (global){
'use strict';
@@ -431,12 +431,12 @@ if (process.env.NODE_ENV !== 'production') {
debug = require('debug')('sockjs-client:info-iframe');
}
-function InfoIframe(url) {
+function InfoIframe(baseUrl, url) {
var self = this;
EventEmitter.call(this);
var go = function() {
- var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, url);
+ var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);
ifr.once('message', function(msg) {
if (msg) {
@@ -522,7 +522,7 @@ inherits(InfoReceiver, EventEmitter);
// TODO this is currently ignoring the list of available transports and the whitelist
-InfoReceiver._getReceiver = function(url, urlInfo) {
+InfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {
// determine method of CORS support (if needed)
if (urlInfo.sameOrigin) {
return new InfoAjax(url, XHRLocal);
@@ -534,7 +534,7 @@ InfoReceiver._getReceiver = function(url, urlInfo) {
return new InfoAjax(url, XDR);
}
if (InfoIframe.enabled()) {
- return new InfoIframe(url);
+ return new InfoIframe(baseUrl, url);
}
return new InfoAjax(url, XHRFake);
};
@@ -545,7 +545,7 @@ InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {
;
debug('doXhr', url);
- this.xo = InfoReceiver._getReceiver(url, urlInfo);
+ this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);
this.timeoutRef = setTimeout(function() {
debug('timeout');
@@ -651,6 +651,18 @@ function SockJS(url, protocols, options) {
log.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");
}
this._transportsWhitelist = options.transports;
+
+ var sessionId = options.sessionId || 8;
+ if (typeof sessionId === 'function') {
+ this._generateSessionId = sessionId;
+ } else if (typeof sessionId === 'number') {
+ this._generateSessionId = function() {
+ return random.string(sessionId);
+ };
+ } else {
+ throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");
+ }
+
this._server = options.server || random.numberString(1000);
// Step 1 of WS spec - parse and validate the url. Issue #8
@@ -803,7 +815,7 @@ SockJS.prototype._connect = function() {
this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);
debug('using timeout', timeoutMs);
- var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + random.string(8));
+ var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId());
debug('transport url', transportUrl);
var transportObj = new Transport(transportUrl, this._transUrl);
transportObj.on('message', this._transportMessage.bind(this));
@@ -3248,6 +3260,8 @@ var random = require('./random');
var onUnload = {}
, afterUnload = false
+ // detect google chrome packaged apps because they don't allow the 'unload' event
+ , isChromePackagedApp = global.chrome && global.chrome.app && global.chrome.app.runtime
;
module.exports = {
@@ -3274,6 +3288,10 @@ module.exports = {
}
, unloadAdd: function(listener) {
+ if (isChromePackagedApp) {
+ return null;
+ }
+
var ref = random.string(8);
onUnload[ref] = listener;
if (afterUnload) {
@@ -3306,7 +3324,9 @@ var unloadTriggered = function() {
// 'unload' alone is not reliable in opera within an iframe, but we
// can't use `beforeunload` as IE fires it on javascript: links.
-module.exports.attachEvent('unload', unloadTriggered);
+if (!isChromePackagedApp) {
+ module.exports.attachEvent('unload', unloadTriggered);
+}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
@@ -3677,7 +3697,7 @@ module.exports = {
}).call(this,{ env: {} })
},{"debug":54,"url-parse":59}],53:[function(require,module,exports){
-module.exports = '1.0.0';
+module.exports = '1.0.1';
},{}],54:[function(require,module,exports){
/**
diff --git a/dist/sockjs-1.0.1.min.js b/dist/sockjs-1.0.1.min.js
new file mode 100644
index 0000000..11fc42d
--- /dev/null
+++ b/dist/sockjs-1.0.1.min.js
@@ -0,0 +1,3 @@
+/* sockjs-client v1.0.1 | http://sockjs.org | MIT license */
+!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");th [...]
+else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t [...]
\ No newline at end of file
diff --git a/dist/sockjs.js b/dist/sockjs.js
index 11de7c7..12f8fbb 100644
--- a/dist/sockjs.js
+++ b/dist/sockjs.js
@@ -1,4 +1,4 @@
-/* sockjs-client v1.0.0 | http://sockjs.org | MIT license */
+/* sockjs-client v1.0.1 | http://sockjs.org | MIT license */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.SockJS=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot fin [...]
(function (global){
'use strict';
@@ -431,12 +431,12 @@ if (process.env.NODE_ENV !== 'production') {
debug = require('debug')('sockjs-client:info-iframe');
}
-function InfoIframe(url) {
+function InfoIframe(baseUrl, url) {
var self = this;
EventEmitter.call(this);
var go = function() {
- var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, url);
+ var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);
ifr.once('message', function(msg) {
if (msg) {
@@ -522,7 +522,7 @@ inherits(InfoReceiver, EventEmitter);
// TODO this is currently ignoring the list of available transports and the whitelist
-InfoReceiver._getReceiver = function(url, urlInfo) {
+InfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {
// determine method of CORS support (if needed)
if (urlInfo.sameOrigin) {
return new InfoAjax(url, XHRLocal);
@@ -534,7 +534,7 @@ InfoReceiver._getReceiver = function(url, urlInfo) {
return new InfoAjax(url, XDR);
}
if (InfoIframe.enabled()) {
- return new InfoIframe(url);
+ return new InfoIframe(baseUrl, url);
}
return new InfoAjax(url, XHRFake);
};
@@ -545,7 +545,7 @@ InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {
;
debug('doXhr', url);
- this.xo = InfoReceiver._getReceiver(url, urlInfo);
+ this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);
this.timeoutRef = setTimeout(function() {
debug('timeout');
@@ -651,6 +651,18 @@ function SockJS(url, protocols, options) {
log.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");
}
this._transportsWhitelist = options.transports;
+
+ var sessionId = options.sessionId || 8;
+ if (typeof sessionId === 'function') {
+ this._generateSessionId = sessionId;
+ } else if (typeof sessionId === 'number') {
+ this._generateSessionId = function() {
+ return random.string(sessionId);
+ };
+ } else {
+ throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");
+ }
+
this._server = options.server || random.numberString(1000);
// Step 1 of WS spec - parse and validate the url. Issue #8
@@ -803,7 +815,7 @@ SockJS.prototype._connect = function() {
this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);
debug('using timeout', timeoutMs);
- var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + random.string(8));
+ var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId());
debug('transport url', transportUrl);
var transportObj = new Transport(transportUrl, this._transUrl);
transportObj.on('message', this._transportMessage.bind(this));
@@ -3248,6 +3260,8 @@ var random = require('./random');
var onUnload = {}
, afterUnload = false
+ // detect google chrome packaged apps because they don't allow the 'unload' event
+ , isChromePackagedApp = global.chrome && global.chrome.app && global.chrome.app.runtime
;
module.exports = {
@@ -3274,6 +3288,10 @@ module.exports = {
}
, unloadAdd: function(listener) {
+ if (isChromePackagedApp) {
+ return null;
+ }
+
var ref = random.string(8);
onUnload[ref] = listener;
if (afterUnload) {
@@ -3306,7 +3324,9 @@ var unloadTriggered = function() {
// 'unload' alone is not reliable in opera within an iframe, but we
// can't use `beforeunload` as IE fires it on javascript: links.
-module.exports.attachEvent('unload', unloadTriggered);
+if (!isChromePackagedApp) {
+ module.exports.attachEvent('unload', unloadTriggered);
+}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
@@ -3677,7 +3697,7 @@ module.exports = {
}).call(this,{ env: {} })
},{"debug":54,"url-parse":59}],53:[function(require,module,exports){
-module.exports = '1.0.0';
+module.exports = '1.0.1';
},{}],54:[function(require,module,exports){
/**
diff --git a/dist/sockjs.min.js b/dist/sockjs.min.js
index d6719a4..11fc42d 100644
--- a/dist/sockjs.min.js
+++ b/dist/sockjs.min.js
@@ -1,3 +1,3 @@
-/* sockjs-client v1.0.0 | http://sockjs.org | MIT license */
-!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");th [...]
-}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r= [...]
\ No newline at end of file
+/* sockjs-client v1.0.1 | http://sockjs.org | MIT license */
+!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");th [...]
+else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t [...]
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 40491ae..0585c11 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -112,10 +112,6 @@ gulp.task('release', ['browserify', 'browserify:min'], function () {
});
gulp.task('stable-release', ['release'], function () {
- var bower = require('./bower.json');
- bower.version = pkg.version;
- fs.writeFileSync('./bower.json', JSON.stringify(bower, null, 2));
-
// sockjs.min.js
gulp.src('./build/' + libName + '.min.js')
.pipe(rename('sockjs.min.js'))
diff --git a/lib/version.js b/lib/version.js
index 0f85046..ceda9e1 100644
--- a/lib/version.js
+++ b/lib/version.js
@@ -1 +1 @@
-module.exports = '1.0.0';
\ No newline at end of file
+module.exports = '1.0.1';
\ No newline at end of file
diff --git a/package.json b/package.json
index 83a64e5..0a41d72 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "sockjs-client",
"description": "SockJS-client is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.",
- "version": "1.0.0",
+ "version": "1.0.1",
"author": "Bryce Kahle",
"browser": {
"./lib/transport/driver/websocket.js": "./lib/transport/browser/websocket.js",
--
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