From 4865ae13e1a637a86de1266f1f5147b6142872c6 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 11 Sep 2024 09:14:50 +1000 Subject: [PATCH] BREAKING(net): remove `Deno.[Tls]Listener.prototype.rid` (#25556) Towards #22079 --------- Signed-off-by: Asher Gomez --- ext/net/01_net.js | 18 +----------------- ext/net/02_tls.js | 9 --------- ext/net/lib.deno_net.d.ts | 9 --------- tests/specs/future/runtime_api/main.js | 21 --------------------- tests/specs/future/runtime_api/main.out | 2 -- tests/unit/net_test.ts | 5 ----- 6 files changed, 1 insertion(+), 63 deletions(-) diff --git a/ext/net/01_net.js b/ext/net/01_net.js index b636ec67a74dcf..5b894947ee08c2 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -1,6 +1,6 @@ // 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 { BadResourcePrototype, InterruptedPrototype, @@ -237,13 +237,6 @@ class Listener { #promise = null; constructor(rid, addr) { - if (internals.future) { - ObjectDefineProperty(this, "rid", { - __proto__: null, - enumerable: false, - value: undefined, - }); - } ObjectDefineProperty(this, internalRidSymbol, { __proto__: null, enumerable: false, @@ -253,15 +246,6 @@ class Listener { this.#addr = addr; } - get rid() { - internals.warnOnDeprecatedApi( - "Deno.Listener.rid", - new Error().stack, - "Use `Deno.Listener` instance methods instead.", - ); - return this.#rid; - } - get addr() { return this.#addr; } diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js index a2cb65b831a3af..11d19440f7474d 100644 --- a/ext/net/02_tls.js +++ b/ext/net/02_tls.js @@ -86,15 +86,6 @@ class TlsListener extends Listener { this.#rid = rid; } - get rid() { - internals.warnOnDeprecatedApi( - "Deno.TlsListener.rid", - new Error().stack, - "Use `Deno.TlsListener` instance methods instead.", - ); - return this.#rid; - } - async accept() { const { 0: rid, 1: localAddr, 2: remoteAddr } = await op_net_accept_tls( this.#rid, diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts index f34fcb0fda2c92..b66dcea8d71816 100644 --- a/ext/net/lib.deno_net.d.ts +++ b/ext/net/lib.deno_net.d.ts @@ -35,15 +35,6 @@ declare namespace Deno { /** Return the address of the `Listener`. */ 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; /** diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index 1b6caac5f10c5c..8ccbf0ba08b5b1 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -1,24 +1,5 @@ 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 { new Deno.FsFile(0); } catch (error) { @@ -31,6 +12,4 @@ try { } } -tlsListener.close(); - self.close(); diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index 70c62c30554225..8fef1407d7b23a 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -1,4 +1,2 @@ window is undefined -Deno.Listener.prototype.rid is undefined -Deno.TlsListener.prototype.rid is undefined Deno.FsFile constructor is illegal diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts index b7230da252574f..c243da47fa0e52 100644 --- a/tests/unit/net_test.ts +++ b/tests/unit/net_test.ts @@ -2,11 +2,9 @@ import { assert, assertEquals, - assertNotEquals, assertRejects, assertThrows, delay, - DENO_FUTURE, execCode, execCode2, tmpUnixSocketPath, @@ -28,9 +26,6 @@ Deno.test({ permissions: { net: true } }, function netTcpListenClose() { assert(listener.addr.transport === "tcp"); assertEquals(listener.addr.hostname, "127.0.0.1"); assertEquals(listener.addr.port, listenPort); - if (!DENO_FUTURE) { - assertNotEquals(listener.rid, 0); - } listener.close(); });