mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 21:01:52 +00:00
add Socket.prototype; lol (#5945)
This commit is contained in:
@@ -79,17 +79,15 @@ const Socket = (function (InternalSocket) {
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
return Object.defineProperty(
|
||||
function Socket(options) {
|
||||
return new InternalSocket(options);
|
||||
function Socket(options) {
|
||||
return new InternalSocket(options);
|
||||
}
|
||||
Socket.prototype = InternalSocket.prototype;
|
||||
return Object.defineProperty(Socket, Symbol.hasInstance, {
|
||||
value(instance) {
|
||||
return instance instanceof InternalSocket;
|
||||
},
|
||||
Symbol.hasInstance,
|
||||
{
|
||||
value(instance) {
|
||||
return instance instanceof InternalSocket;
|
||||
},
|
||||
},
|
||||
);
|
||||
});
|
||||
})(
|
||||
class Socket extends Duplex {
|
||||
static #Handlers = {
|
||||
|
||||
@@ -306,18 +306,15 @@ const TLSSocket = (function (InternalTLSSocket) {
|
||||
value: "TLSSocket",
|
||||
enumerable: false,
|
||||
});
|
||||
|
||||
return Object.defineProperty(
|
||||
function Socket(options) {
|
||||
return new InternalTLSSocket(options);
|
||||
function Socket(options) {
|
||||
return new InternalTLSSocket(options);
|
||||
}
|
||||
Socket.prototype = InternalTLSSocket.prototype;
|
||||
return Object.defineProperty(Socket, Symbol.hasInstance, {
|
||||
value(instance) {
|
||||
return instance instanceof InternalTLSSocket;
|
||||
},
|
||||
Symbol.hasInstance,
|
||||
{
|
||||
value(instance) {
|
||||
return instance instanceof InternalTLSSocket;
|
||||
},
|
||||
},
|
||||
);
|
||||
});
|
||||
})(
|
||||
class TLSSocket extends InternalTCPSocket {
|
||||
#secureContext;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -411,3 +411,10 @@ it("should handle connection error (unix)", done => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("Socket has a prototype", () => {
|
||||
function Connection() {}
|
||||
function Connection2() {}
|
||||
require("util").inherits(Connection, Socket);
|
||||
require("util").inherits(Connection2, require("tls").TLSSocket);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user