From b669bacb661d32a57b2eb04e9944d84aca0a59ee Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Fri, 3 Feb 2023 10:20:15 -0500 Subject: [PATCH] url: remove unused `URL::toObject` --- 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 b8edc0c21d7e5b..6578278659ab85 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; @@ -1934,48 +1931,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;