From 9a604d67c31c83d2b66ea7dff0280f4a5c5edf49 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 5 Feb 2023 10:23:03 -0500 Subject: [PATCH] url: remove unused `URL::toObject` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/46486 Reviewed-By: Luigi Pinca Reviewed-By: Zeyu "Alex" Yang Reviewed-By: Robert Nagy Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- src/node_url.cc | 45 --------------------------------------------- src/node_url.h | 2 -- 2 files changed, 47 deletions(-) diff --git a/src/node_url.cc b/src/node_url.cc index 14c9d828f740a0..c5215d39075709 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -13,8 +13,6 @@ namespace node { -using errors::TryCatchScope; - using url::table_data::hex; using url::table_data::C0_CONTROL_ENCODE_SET; using url::table_data::FRAGMENT_ENCODE_SET; @@ -32,7 +30,6 @@ using v8::Int32; using v8::Integer; using v8::Isolate; using v8::Local; -using v8::MaybeLocal; using v8::NewStringType; using v8::Null; using v8::Object; @@ -1925,48 +1922,6 @@ URL URL::FromFilePath(const std::string& file_path) { return url; } -// This function works by calling out to a JS function that creates and -// returns the JS URL object. Be mindful of the JS<->Native boundary -// crossing that is required. -MaybeLocal URL::ToObject(Environment* env) const { - Isolate* isolate = env->isolate(); - Local context = env->context(); - Context::Scope context_scope(context); - - const Local undef = Undefined(isolate); - const Local null = Null(isolate); - - if (context_.flags & URL_FLAGS_FAILED) - return Local(); - - Local argv[] = { - undef, - undef, - undef, - undef, - null, // host defaults to null - null, // port defaults to null - undef, - null, // query defaults to null - null, // fragment defaults to null - }; - SetArgs(env, argv, context_); - - MaybeLocal ret; - { - TryCatchScope try_catch(env, TryCatchScope::CatchMode::kFatal); - - // The SetURLConstructor method must have been called already to - // set the constructor function used below. SetURLConstructor is - // called automatically when the internal/url.js module is loaded - // during the internal/bootstrap/node.js processing. - ret = env->url_constructor_function() - ->Call(env->context(), undef, arraysize(argv), argv); - } - - return ret; -} - } // namespace url } // namespace node diff --git a/src/node_url.h b/src/node_url.h index d7b9a1c368cdae..d0c1aaadb1a3ab 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -183,8 +183,6 @@ class URL { // Get the file URL from native file system path. static URL FromFilePath(const std::string& file_path); - v8::MaybeLocal ToObject(Environment* env) const; - URL(const URL&) = default; URL& operator=(const URL&) = default; URL(URL&&) = default;