mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
BREAKING(net): remove Deno.[Tls]Listener.prototype.rid
(#25556)
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
parent
ace1202227
commit
4865ae13e1
6 changed files with 1 additions and 63 deletions
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { core, internals, primordials } from "ext:core/mod.js";
|
import { core, primordials } from "ext:core/mod.js";
|
||||||
const {
|
const {
|
||||||
BadResourcePrototype,
|
BadResourcePrototype,
|
||||||
InterruptedPrototype,
|
InterruptedPrototype,
|
||||||
|
@ -237,13 +237,6 @@ class Listener {
|
||||||
#promise = null;
|
#promise = null;
|
||||||
|
|
||||||
constructor(rid, addr) {
|
constructor(rid, addr) {
|
||||||
if (internals.future) {
|
|
||||||
ObjectDefineProperty(this, "rid", {
|
|
||||||
__proto__: null,
|
|
||||||
enumerable: false,
|
|
||||||
value: undefined,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
ObjectDefineProperty(this, internalRidSymbol, {
|
ObjectDefineProperty(this, internalRidSymbol, {
|
||||||
__proto__: null,
|
__proto__: null,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
|
@ -253,15 +246,6 @@ class Listener {
|
||||||
this.#addr = addr;
|
this.#addr = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
get rid() {
|
|
||||||
internals.warnOnDeprecatedApi(
|
|
||||||
"Deno.Listener.rid",
|
|
||||||
new Error().stack,
|
|
||||||
"Use `Deno.Listener` instance methods instead.",
|
|
||||||
);
|
|
||||||
return this.#rid;
|
|
||||||
}
|
|
||||||
|
|
||||||
get addr() {
|
get addr() {
|
||||||
return this.#addr;
|
return this.#addr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,15 +86,6 @@ class TlsListener extends Listener {
|
||||||
this.#rid = rid;
|
this.#rid = rid;
|
||||||
}
|
}
|
||||||
|
|
||||||
get rid() {
|
|
||||||
internals.warnOnDeprecatedApi(
|
|
||||||
"Deno.TlsListener.rid",
|
|
||||||
new Error().stack,
|
|
||||||
"Use `Deno.TlsListener` instance methods instead.",
|
|
||||||
);
|
|
||||||
return this.#rid;
|
|
||||||
}
|
|
||||||
|
|
||||||
async accept() {
|
async accept() {
|
||||||
const { 0: rid, 1: localAddr, 2: remoteAddr } = await op_net_accept_tls(
|
const { 0: rid, 1: localAddr, 2: remoteAddr } = await op_net_accept_tls(
|
||||||
this.#rid,
|
this.#rid,
|
||||||
|
|
9
ext/net/lib.deno_net.d.ts
vendored
9
ext/net/lib.deno_net.d.ts
vendored
|
@ -35,15 +35,6 @@ declare namespace Deno {
|
||||||
/** Return the address of the `Listener`. */
|
/** Return the address of the `Listener`. */
|
||||||
readonly addr: A;
|
readonly addr: A;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the rid of the `Listener`.
|
|
||||||
*
|
|
||||||
* @deprecated This will be removed in Deno 2.0. See the
|
|
||||||
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
|
|
||||||
* for migration instructions.
|
|
||||||
*/
|
|
||||||
readonly rid: number;
|
|
||||||
|
|
||||||
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
console.log("window is", globalThis.window);
|
console.log("window is", globalThis.window);
|
||||||
|
|
||||||
// TCP
|
|
||||||
// Since these tests may run in parallel, ensure this port is unique to this file
|
|
||||||
const tcpPort = 4509;
|
|
||||||
const tcpListener = Deno.listen({ port: tcpPort });
|
|
||||||
console.log("Deno.Listener.prototype.rid is", tcpListener.rid);
|
|
||||||
tcpListener.close();
|
|
||||||
|
|
||||||
// TLS
|
|
||||||
// Since these tests may run in parallel, ensure this port is unique to this file
|
|
||||||
const tlsPort = 4510;
|
|
||||||
const cert = Deno.readTextFileSync(
|
|
||||||
new URL("../../../testdata/tls/localhost.crt", import.meta.url),
|
|
||||||
);
|
|
||||||
const key = Deno.readTextFileSync(
|
|
||||||
new URL("../../../testdata/tls/localhost.key", import.meta.url),
|
|
||||||
);
|
|
||||||
const tlsListener = Deno.listenTls({ port: tlsPort, cert, key });
|
|
||||||
console.log("Deno.TlsListener.prototype.rid is", tlsListener.rid);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new Deno.FsFile(0);
|
new Deno.FsFile(0);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -31,6 +12,4 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tlsListener.close();
|
|
||||||
|
|
||||||
self.close();
|
self.close();
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
window is undefined
|
window is undefined
|
||||||
Deno.Listener.prototype.rid is undefined
|
|
||||||
Deno.TlsListener.prototype.rid is undefined
|
|
||||||
Deno.FsFile constructor is illegal
|
Deno.FsFile constructor is illegal
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
import {
|
import {
|
||||||
assert,
|
assert,
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertNotEquals,
|
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertThrows,
|
assertThrows,
|
||||||
delay,
|
delay,
|
||||||
DENO_FUTURE,
|
|
||||||
execCode,
|
execCode,
|
||||||
execCode2,
|
execCode2,
|
||||||
tmpUnixSocketPath,
|
tmpUnixSocketPath,
|
||||||
|
@ -28,9 +26,6 @@ Deno.test({ permissions: { net: true } }, function netTcpListenClose() {
|
||||||
assert(listener.addr.transport === "tcp");
|
assert(listener.addr.transport === "tcp");
|
||||||
assertEquals(listener.addr.hostname, "127.0.0.1");
|
assertEquals(listener.addr.hostname, "127.0.0.1");
|
||||||
assertEquals(listener.addr.port, listenPort);
|
assertEquals(listener.addr.port, listenPort);
|
||||||
if (!DENO_FUTURE) {
|
|
||||||
assertNotEquals(listener.rid, 0);
|
|
||||||
}
|
|
||||||
listener.close();
|
listener.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue