Skip to content

Commit

Permalink
url: remove unused setURLConstructor function
Browse files Browse the repository at this point in the history
PR-URL: #46485
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
anonrig authored and danielleadams committed Apr 3, 2023
1 parent 8036583 commit 0493056
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
24 changes: 0 additions & 24 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const {
domainToUnicode: _domainToUnicode,
encodeAuth,
parse,
setURLConstructor,
URL_FLAGS_CANNOT_BE_BASE,
URL_FLAGS_HAS_FRAGMENT,
URL_FLAGS_HAS_HOST,
Expand Down Expand Up @@ -1573,29 +1572,6 @@ function toPathIfFileURL(fileURLOrPath) {
return fileURLToPath(fileURLOrPath);
}

function constructUrl(flags, protocol, username, password,
host, port, path, query, fragment) {
const ctx = new URLContext();
ctx.flags = flags;
ctx.scheme = protocol;
ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';
ctx.password = (flags & URL_FLAGS_HAS_PASSWORD) !== 0 ? password : '';
ctx.port = port;
ctx.path = (flags & URL_FLAGS_HAS_PATH) !== 0 ? path : [];
ctx.query = query;
ctx.fragment = fragment;
ctx.host = host;

const url = ObjectCreate(URL.prototype);
url[context] = ctx;
const params = new URLSearchParams();
url[searchParams] = params;
params[context] = url;
initSearchParams(params, query);
return url;
}
setURLConstructor(constructUrl);

module.exports = {
toUSVString,
fileURLToPath,
Expand Down
9 changes: 0 additions & 9 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1824,13 +1824,6 @@ void DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
String::NewFromUtf8(env->isolate(), out.c_str()).ToLocalChecked());
}

void SetURLConstructor(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK_EQ(args.Length(), 1);
CHECK(args[0]->IsFunction());
env->set_url_constructor_function(args[0].As<Function>());
}

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context,
Expand All @@ -1839,7 +1832,6 @@ void Initialize(Local<Object> target,
SetMethodNoSideEffect(context, target, "encodeAuth", EncodeAuthSet);
SetMethodNoSideEffect(context, target, "domainToASCII", DomainToASCII);
SetMethodNoSideEffect(context, target, "domainToUnicode", DomainToUnicode);
SetMethod(context, target, "setURLConstructor", SetURLConstructor);

#define XX(name, _) NODE_DEFINE_CONSTANT(target, name);
FLAGS(XX)
Expand All @@ -1856,7 +1848,6 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(EncodeAuthSet);
registry->Register(DomainToASCII);
registry->Register(DomainToUnicode);
registry->Register(SetURLConstructor);
}

std::string URL::ToFilePath() const {
Expand Down

0 comments on commit 0493056

Please sign in to comment.