From e568cb8bf85161ea850ca2ae3b11247a0d5dcabd Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Tue, 6 Feb 2024 18:07:20 +0530 Subject: [PATCH] chore(ws): remove unused op_ws_send_pong (#22283) --- cli/tests/unit/ops_test.ts | 2 +- cli/tools/test/fmt.rs | 1 - ext/websocket/lib.rs | 16 ---------------- runtime/js/99_main.js | 3 --- 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/cli/tests/unit/ops_test.ts b/cli/tests/unit/ops_test.ts index 71b66f3126..e91c37e67c 100644 --- a/cli/tests/unit/ops_test.ts +++ b/cli/tests/unit/ops_test.ts @@ -1,6 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -const EXPECTED_OP_COUNT = 51; +const EXPECTED_OP_COUNT = 50; Deno.test(function checkExposedOps() { // @ts-ignore TS doesn't allow to index with symbol diff --git a/cli/tools/test/fmt.rs b/cli/tools/test/fmt.rs index ac5cb48775..468b9d8f09 100644 --- a/cli/tools/test/fmt.rs +++ b/cli/tools/test/fmt.rs @@ -292,6 +292,5 @@ pub const OP_DETAILS: phf::Map<&'static str, [&'static str; 2]> = phf_map! { "op_ws_send_binary" => ["send a message on a WebSocket", "closing a `WebSocket` or `WebSocketStream`"], "op_ws_send_binary_ab" => ["send a message on a WebSocket", "closing a `WebSocket` or `WebSocketStream`"], "op_ws_send_ping" => ["send a message on a WebSocket", "closing a `WebSocket` or `WebSocketStream`"], - "op_ws_send_pong" => ["send a message on a WebSocket", "closing a `WebSocket` or `WebSocketStream`"], "op_spawn_wait" => ["wait for a subprocess to exit", "awaiting the result of a `Deno.Process#status` call"], }; diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs index 9b02d0759e..e6f382c341 100644 --- a/ext/websocket/lib.rs +++ b/ext/websocket/lib.rs @@ -659,21 +659,6 @@ pub fn op_ws_get_buffered_amount( .get() as u32 } -#[op2(async)] -pub async fn op_ws_send_pong( - state: Rc>, - #[smi] rid: ResourceId, -) -> Result<(), AnyError> { - let resource = state - .borrow_mut() - .resource_table - .get::(rid)?; - let lock = resource.reserve_lock(); - resource - .write_frame(lock, Frame::pong(EMPTY_PAYLOAD.into())) - .await -} - #[op2(async)] pub async fn op_ws_send_ping( state: Rc>, @@ -839,7 +824,6 @@ deno_core::extension!(deno_websocket, op_ws_send_binary_async, op_ws_send_text_async, op_ws_send_ping, - op_ws_send_pong, op_ws_get_buffered_amount, ], esm = [ "01_websocket.js", "02_websocketstream.js" ], diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 45349c038d..c1ded6b24e 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -614,9 +614,6 @@ const NOT_IMPORTED_OPS = [ "op_format_file_name", "op_apply_source_map", "op_apply_source_map_filename", - - // TODO(bartlomieju): this might be dead code. - "op_ws_send_pong", ]; function removeImportedOps() {