Skip to content

Commit

Permalink
url: remove unused URL::toObject
Browse files Browse the repository at this point in the history
PR-URL: #46486
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
anonrig authored and danielleadams committed Apr 3, 2023
1 parent 0493056 commit f57e7bc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
45 changes: 0 additions & 45 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<Value> URL::ToObject(Environment* env) const {
Isolate* isolate = env->isolate();
Local<Context> context = env->context();
Context::Scope context_scope(context);

const Local<Value> undef = Undefined(isolate);
const Local<Value> null = Null(isolate);

if (context_.flags & URL_FLAGS_FAILED)
return Local<Value>();

Local<Value> 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<Value> 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

Expand Down
2 changes: 0 additions & 2 deletions src/node_url.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<v8::Value> ToObject(Environment* env) const;

URL(const URL&) = default;
URL& operator=(const URL&) = default;
URL(URL&&) = default;
Expand Down

0 comments on commit f57e7bc

Please sign in to comment.