From e65c22422728b3c23ddcb4de1cde4fd6f300bab7 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Fri, 29 Aug 2014 14:24:03 +0100 Subject: [PATCH] Update engine.io(-client) to 1.3.1 --- client/assets/libs/engine.io.js | 411 ++++++++++++++++---------------- package.json | 2 +- 2 files changed, 202 insertions(+), 211 deletions(-) diff --git a/client/assets/libs/engine.io.js b/client/assets/libs/engine.io.js index 635f33e..1736807 100644 --- a/client/assets/libs/engine.io.js +++ b/client/assets/libs/engine.io.js @@ -14,14 +14,14 @@ module.exports = _dereq_('./socket'); */ module.exports.parser = _dereq_('engine.io-parser'); -},{"./socket":3,"engine.io-parser":14}],3:[function(_dereq_,module,exports){ +},{"./socket":3,"engine.io-parser":15}],3:[function(_dereq_,module,exports){ (function (global){ /** * Module dependencies. */ var transports = _dereq_('./transports'); -var Emitter = _dereq_('emitter'); +var Emitter = _dereq_('component-emitter'); var debug = _dereq_('debug')('engine.io-client:socket'); var index = _dereq_('indexof'); var parser = _dereq_('engine.io-parser'); @@ -645,13 +645,13 @@ Socket.prototype.filterUpgrades = function (upgrades) { }; }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./transport":4,"./transports":5,"debug":12,"emitter":13,"engine.io-parser":14,"indexof":22,"parsejson":24,"parseqs":25,"parseuri":26}],4:[function(_dereq_,module,exports){ +},{"./transport":4,"./transports":5,"component-emitter":12,"debug":14,"engine.io-parser":15,"indexof":23,"parsejson":24,"parseqs":25,"parseuri":26}],4:[function(_dereq_,module,exports){ /** * Module dependencies. */ var parser = _dereq_('engine.io-parser'); -var Emitter = _dereq_('emitter'); +var Emitter = _dereq_('component-emitter'); /** * Module exports. @@ -772,8 +772,14 @@ Transport.prototype.onOpen = function () { * @api private */ -Transport.prototype.onData = function (data) { - this.onPacket(parser.decodePacket(data, this.socket.binaryType)); +Transport.prototype.onData = function(data){ + try { + var packet = parser.decodePacket(data, this.socket.binaryType); + this.onPacket(packet); + } catch(e){ + e.data = data; + this.onError('parser decode error', e); + } }; /** @@ -795,7 +801,7 @@ Transport.prototype.onClose = function () { this.emit('close'); }; -},{"emitter":13,"engine.io-parser":14}],5:[function(_dereq_,module,exports){ +},{"component-emitter":12,"engine.io-parser":15}],5:[function(_dereq_,module,exports){ (function (global){ /** * Module dependencies @@ -855,7 +861,7 @@ function polling(opts){ */ var Polling = _dereq_('./polling'); -var inherit = _dereq_('inherits'); +var inherit = _dereq_('component-inherit'); /** * Module exports. @@ -986,7 +992,7 @@ JSONPPolling.prototype.doPoll = function () { this.script = script; var isUAgecko = 'undefined' != typeof navigator && /gecko/i.test(navigator.userAgent); - + if (isUAgecko) { setTimeout(function () { var iframe = document.createElement('iframe'); @@ -1083,7 +1089,7 @@ JSONPPolling.prototype.doWrite = function (data, fn) { }; }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./polling":8,"inherits":23}],7:[function(_dereq_,module,exports){ +},{"./polling":8,"component-inherit":13}],7:[function(_dereq_,module,exports){ (function (global){ /** * Module requirements. @@ -1091,9 +1097,9 @@ JSONPPolling.prototype.doWrite = function (data, fn) { var XMLHttpRequest = _dereq_('xmlhttprequest'); var Polling = _dereq_('./polling'); -var Emitter = _dereq_('emitter'); +var Emitter = _dereq_('component-emitter'); +var inherit = _dereq_('component-inherit'); var debug = _dereq_('debug')('engine.io-client:polling-xhr'); -var inherit = _dereq_('inherits'); /** * Module exports. @@ -1397,7 +1403,7 @@ function unloadHandler() { } }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./polling":8,"debug":12,"emitter":13,"inherits":23,"xmlhttprequest":10}],8:[function(_dereq_,module,exports){ +},{"./polling":8,"component-emitter":12,"component-inherit":13,"debug":14,"xmlhttprequest":10}],8:[function(_dereq_,module,exports){ /** * Module dependencies. */ @@ -1405,8 +1411,8 @@ function unloadHandler() { var Transport = _dereq_('../transport'); var parseqs = _dereq_('parseqs'); var parser = _dereq_('engine.io-parser'); +var inherit = _dereq_('component-inherit'); var debug = _dereq_('debug')('engine.io-client:polling'); -var inherit = _dereq_('inherits'); /** * Module exports. @@ -1644,7 +1650,7 @@ Polling.prototype.uri = function(){ return schema + '://' + this.hostname + port + this.path + query; }; -},{"../transport":4,"debug":12,"engine.io-parser":14,"inherits":23,"parseqs":25,"xmlhttprequest":10}],9:[function(_dereq_,module,exports){ +},{"../transport":4,"component-inherit":13,"debug":14,"engine.io-parser":15,"parseqs":25,"xmlhttprequest":10}],9:[function(_dereq_,module,exports){ /** * Module dependencies. */ @@ -1652,8 +1658,8 @@ Polling.prototype.uri = function(){ var Transport = _dereq_('../transport'); var parser = _dereq_('engine.io-parser'); var parseqs = _dereq_('parseqs'); +var inherit = _dereq_('component-inherit'); var debug = _dereq_('debug')('engine.io-client:websocket'); -var inherit = _dereq_('inherits'); /** * `ws` exposes a WebSocket-compatible interface in @@ -1875,7 +1881,7 @@ WS.prototype.check = function(){ return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name); }; -},{"../transport":4,"debug":12,"engine.io-parser":14,"inherits":23,"parseqs":25,"ws":27}],10:[function(_dereq_,module,exports){ +},{"../transport":4,"component-inherit":13,"debug":14,"engine.io-parser":15,"parseqs":25,"ws":27}],10:[function(_dereq_,module,exports){ // browser shim for xmlhttprequest module var hasCORS = _dereq_('has-cors'); @@ -1951,151 +1957,6 @@ module.exports = (function() { }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],12:[function(_dereq_,module,exports){ -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - if (!debug.enabled(name)) return function(){}; - - return function(fmt){ - fmt = coerce(fmt); - - var curr = new Date; - var ms = curr - (debug[name] || curr); - debug[name] = curr; - - fmt = name - + ' ' - + fmt - + ' +' + debug.humanize(ms); - - // This hackery is required for IE8 - // where `console.log` doesn't have 'apply' - window.console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); - } -} - -/** - * The currently active debug mode names. - */ - -debug.names = []; -debug.skips = []; - -/** - * Enables a debug mode by name. This can include modes - * separated by a colon and wildcards. - * - * @param {String} name - * @api public - */ - -debug.enable = function(name) { - try { - localStorage.debug = name; - } catch(e){} - - var split = (name || '').split(/[\s,]+/) - , len = split.length; - - for (var i = 0; i < len; i++) { - name = split[i].replace('*', '.*?'); - if (name[0] === '-') { - debug.skips.push(new RegExp('^' + name.substr(1) + '$')); - } - else { - debug.names.push(new RegExp('^' + name + '$')); - } - } -}; - -/** - * Disable debug output. - * - * @api public - */ - -debug.disable = function(){ - debug.enable(''); -}; - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -debug.humanize = function(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -}; - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -debug.enabled = function(name) { - for (var i = 0, len = debug.skips.length; i < len; i++) { - if (debug.skips[i].test(name)) { - return false; - } - } - for (var i = 0, len = debug.names.length; i < len; i++) { - if (debug.names[i].test(name)) { - return true; - } - } - return false; -}; - -/** - * Coerce `val`. - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} - -// persist - -try { - if (window.localStorage) debug.enable(localStorage.debug); -} catch(e){} - -},{}],13:[function(_dereq_,module,exports){ - -/** - * Module dependencies. - */ - -var index = _dereq_('indexof'); - /** * Expose `Emitter`. */ @@ -2136,7 +1997,8 @@ function mixin(obj) { * @api public */ -Emitter.prototype.on = function(event, fn){ +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; (this._callbacks[event] = this._callbacks[event] || []) .push(fn); @@ -2162,7 +2024,7 @@ Emitter.prototype.once = function(event, fn){ fn.apply(this, arguments); } - fn._off = on; + on.fn = fn; this.on(event, on); return this; }; @@ -2179,7 +2041,8 @@ Emitter.prototype.once = function(event, fn){ Emitter.prototype.off = Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = function(event, fn){ +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ this._callbacks = this._callbacks || {}; // all @@ -2199,8 +2062,14 @@ Emitter.prototype.removeAllListeners = function(event, fn){ } // remove specific handler - var i = index(callbacks, fn._off || fn); - if (~i) callbacks.splice(i, 1); + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } return this; }; @@ -2252,7 +2121,154 @@ Emitter.prototype.hasListeners = function(event){ return !! this.listeners(event).length; }; -},{"indexof":22}],14:[function(_dereq_,module,exports){ +},{}],13:[function(_dereq_,module,exports){ + +module.exports = function(a, b){ + var fn = function(){}; + fn.prototype = b.prototype; + a.prototype = new fn; + a.prototype.constructor = a; +}; +},{}],14:[function(_dereq_,module,exports){ + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + if (!debug.enabled(name)) return function(){}; + + return function(fmt){ + fmt = coerce(fmt); + + var curr = new Date; + var ms = curr - (debug[name] || curr); + debug[name] = curr; + + fmt = name + + ' ' + + fmt + + ' +' + debug.humanize(ms); + + // This hackery is required for IE8 + // where `console.log` doesn't have 'apply' + window.console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } +} + +/** + * The currently active debug mode names. + */ + +debug.names = []; +debug.skips = []; + +/** + * Enables a debug mode by name. This can include modes + * separated by a colon and wildcards. + * + * @param {String} name + * @api public + */ + +debug.enable = function(name) { + try { + localStorage.debug = name; + } catch(e){} + + var split = (name || '').split(/[\s,]+/) + , len = split.length; + + for (var i = 0; i < len; i++) { + name = split[i].replace('*', '.*?'); + if (name[0] === '-') { + debug.skips.push(new RegExp('^' + name.substr(1) + '$')); + } + else { + debug.names.push(new RegExp('^' + name + '$')); + } + } +}; + +/** + * Disable debug output. + * + * @api public + */ + +debug.disable = function(){ + debug.enable(''); +}; + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +debug.humanize = function(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +}; + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +debug.enabled = function(name) { + for (var i = 0, len = debug.skips.length; i < len; i++) { + if (debug.skips[i].test(name)) { + return false; + } + } + for (var i = 0, len = debug.names.length; i < len; i++) { + if (debug.names[i].test(name)) { + return true; + } + } + return false; +}; + +/** + * Coerce `val`. + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} + +// persist + +try { + if (window.localStorage) debug.enable(localStorage.debug); +} catch(e){} + +},{}],15:[function(_dereq_,module,exports){ (function (global){ /** * Module dependencies. @@ -2799,7 +2815,7 @@ exports.decodePayloadAsBinary = function (data, binaryType, callback) { }; }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./keys":15,"after":16,"arraybuffer.slice":17,"base64-arraybuffer":18,"blob":11,"utf8":19}],15:[function(_dereq_,module,exports){ +},{"./keys":16,"after":17,"arraybuffer.slice":18,"base64-arraybuffer":19,"blob":11,"utf8":20}],16:[function(_dereq_,module,exports){ /** * Gets the keys for an object. @@ -2820,7 +2836,7 @@ module.exports = Object.keys || function keys (obj){ return arr; }; -},{}],16:[function(_dereq_,module,exports){ +},{}],17:[function(_dereq_,module,exports){ module.exports = after function after(count, callback, err_cb) { @@ -2850,7 +2866,7 @@ function after(count, callback, err_cb) { function noop() {} -},{}],17:[function(_dereq_,module,exports){ +},{}],18:[function(_dereq_,module,exports){ /** * An abstraction for slicing an arraybuffer even when * ArrayBuffer.prototype.slice is not supported @@ -2881,7 +2897,7 @@ module.exports = function(arraybuffer, start, end) { return result.buffer; }; -},{}],18:[function(_dereq_,module,exports){ +},{}],19:[function(_dereq_,module,exports){ /* * base64-arraybuffer * https://github.com/niklasvh/base64-arraybuffer @@ -2942,7 +2958,7 @@ module.exports = function(arraybuffer, start, end) { }; })("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); -},{}],19:[function(_dereq_,module,exports){ +},{}],20:[function(_dereq_,module,exports){ (function (global){ /*! http://mths.be/utf8js v2.0.0 by @mathias */ ;(function(root) { @@ -3185,16 +3201,6 @@ module.exports = function(arraybuffer, start, end) { }(this)); }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],20:[function(_dereq_,module,exports){ - -/** - * Returns `this`. Execute this without a "context" (i.e. without it being - * attached to an object of the left-hand side), and `this` points to the - * "global" scope of the current JS execution. - */ - -module.exports = (function () { return this; })(); - },{}],21:[function(_dereq_,module,exports){ /** @@ -3220,7 +3226,17 @@ try { module.exports = false; } -},{"global":20}],22:[function(_dereq_,module,exports){ +},{"global":22}],22:[function(_dereq_,module,exports){ + +/** + * Returns `this`. Execute this without a "context" (i.e. without it being + * attached to an object of the left-hand side), and `this` points to the + * "global" scope of the current JS execution. + */ + +module.exports = (function () { return this; })(); + +},{}],23:[function(_dereq_,module,exports){ var indexOf = [].indexOf; @@ -3231,31 +3247,6 @@ module.exports = function(arr, obj){ } return -1; }; -},{}],23:[function(_dereq_,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - },{}],24:[function(_dereq_,module,exports){ (function (global){ /** @@ -3404,4 +3395,4 @@ if (WebSocket) ws.prototype = WebSocket.prototype; },{}]},{},[1]) (1) -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index 4a0dfab..0e86c60 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dependencies": { "node-static": "0.7.3", "uglify-js": "2.4.12", - "engine.io": "1.2", + "engine.io": "^1.3.1", "lodash": "2.4.1", "daemonize2": "0.4.2", "eventemitter2": "0.4.13", -- 2.25.1