Compare commits

..

3 Commits
2.5.0 ... 2.x

Author SHA1 Message Date
Damien Arrachequesne
88b2cdb6ab chore(release): 2.5.1
Release notes: https://github.com/socketio/socket.io/releases/tag/2.5.1
Diff: https://github.com/socketio/socket.io/compare/2.5.0...2.5.1
2024-06-19 10:48:24 +02:00
Damien Arrachequesne
d30630ba10 fix: add a noop handler for the error event
Backported from main: 15af22fc22
2024-06-19 10:46:29 +02:00
Damien Arrachequesne
f927ba29ef test: fix tests on Node.js > 18
Reference: https://nodejs.org/api/buffer.html#class-blob
2024-06-19 10:44:04 +02:00
4 changed files with 17 additions and 8 deletions

View File

@@ -1,3 +1,12 @@
## [2.5.1](https://github.com/socketio/socket.io/compare/2.5.0...2.5.1) (2024-06-19)
### Bug Fixes
* add a noop handler for the error event ([d30630b](https://github.com/socketio/socket.io/commit/d30630ba10562bf987f4d2b42440fc41a828119c))
# [2.5.0](https://github.com/socketio/socket.io/compare/2.4.1...2.5.0) (2022-06-26)

View File

@@ -49,6 +49,8 @@ var flags = [
var emit = Emitter.prototype.emit;
function noop() {}
/**
* Interface to a `Client` for a given `Namespace`.
*
@@ -72,6 +74,9 @@ function Socket(nsp, client, query){
this.fns = [];
this.flags = {};
this._rooms = [];
// prevents crash when the socket receives an "error" event without listener
this.on('error', noop);
}
/**
@@ -427,12 +432,7 @@ Socket.prototype.ondisconnect = function(){
*/
Socket.prototype.onerror = function(err){
if (this.listeners('error').length) {
this.emit('error', err);
} else {
console.error('Missing error handler on `socket`.');
console.error(err.stack);
}
this.emit('error', err);
};
/**

View File

@@ -1,6 +1,6 @@
{
"name": "socket.io",
"version": "2.5.0",
"version": "2.5.1",
"description": "node.js realtime framework server",
"keywords": [
"realtime",

View File

@@ -1858,7 +1858,7 @@ describe('socket.io', function(){
it('should not crash when messing with Object prototype (and other globals)', function(done){
Object.prototype.foo = 'bar';
global.File = '';
global.Blob = [];
// global.Blob = [];
var srv = http();
var sio = io(srv);
srv.listen(function(){