Skip to content

Commit d6fbebd

Browse files
anonrigMylesBorins
authored andcommitted
url: remove unused setURLConstructor function
PR-URL: #46485 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9d9b3f8 commit d6fbebd

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

lib/internal/url.js

-24
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ const {
9292
domainToUnicode: _domainToUnicode,
9393
encodeAuth,
9494
parse,
95-
setURLConstructor,
9695
URL_FLAGS_CANNOT_BE_BASE,
9796
URL_FLAGS_HAS_FRAGMENT,
9897
URL_FLAGS_HAS_HOST,
@@ -1572,29 +1571,6 @@ function toPathIfFileURL(fileURLOrPath) {
15721571
return fileURLToPath(fileURLOrPath);
15731572
}
15741573

1575-
function constructUrl(flags, protocol, username, password,
1576-
host, port, path, query, fragment) {
1577-
const ctx = new URLContext();
1578-
ctx.flags = flags;
1579-
ctx.scheme = protocol;
1580-
ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';
1581-
ctx.password = (flags & URL_FLAGS_HAS_PASSWORD) !== 0 ? password : '';
1582-
ctx.port = port;
1583-
ctx.path = (flags & URL_FLAGS_HAS_PATH) !== 0 ? path : [];
1584-
ctx.query = query;
1585-
ctx.fragment = fragment;
1586-
ctx.host = host;
1587-
1588-
const url = { __proto__: URL.prototype };
1589-
url[context] = ctx;
1590-
const params = new URLSearchParams();
1591-
url[searchParams] = params;
1592-
params[context] = url;
1593-
initSearchParams(params, query);
1594-
return url;
1595-
}
1596-
setURLConstructor(constructUrl);
1597-
15981574
module.exports = {
15991575
toUSVString,
16001576
fileURLToPath,

src/node_url.cc

-9
Original file line numberDiff line numberDiff line change
@@ -1824,13 +1824,6 @@ void DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
18241824
String::NewFromUtf8(env->isolate(), out.c_str()).ToLocalChecked());
18251825
}
18261826

1827-
void SetURLConstructor(const FunctionCallbackInfo<Value>& args) {
1828-
Environment* env = Environment::GetCurrent(args);
1829-
CHECK_EQ(args.Length(), 1);
1830-
CHECK(args[0]->IsFunction());
1831-
env->set_url_constructor_function(args[0].As<Function>());
1832-
}
1833-
18341827
void Initialize(Local<Object> target,
18351828
Local<Value> unused,
18361829
Local<Context> context,
@@ -1839,7 +1832,6 @@ void Initialize(Local<Object> target,
18391832
SetMethodNoSideEffect(context, target, "encodeAuth", EncodeAuthSet);
18401833
SetMethodNoSideEffect(context, target, "domainToASCII", DomainToASCII);
18411834
SetMethodNoSideEffect(context, target, "domainToUnicode", DomainToUnicode);
1842-
SetMethod(context, target, "setURLConstructor", SetURLConstructor);
18431835

18441836
#define XX(name, _) NODE_DEFINE_CONSTANT(target, name);
18451837
FLAGS(XX)
@@ -1856,7 +1848,6 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
18561848
registry->Register(EncodeAuthSet);
18571849
registry->Register(DomainToASCII);
18581850
registry->Register(DomainToUnicode);
1859-
registry->Register(SetURLConstructor);
18601851
}
18611852

18621853
std::string URL::ToFilePath() const {

0 commit comments

Comments
 (0)