Skip to content

Commit 0493056

Browse files
anonrigdanielleadams
authored andcommittedApr 3, 2023
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 8036583 commit 0493056

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
@@ -93,7 +93,6 @@ const {
9393
domainToUnicode: _domainToUnicode,
9494
encodeAuth,
9595
parse,
96-
setURLConstructor,
9796
URL_FLAGS_CANNOT_BE_BASE,
9897
URL_FLAGS_HAS_FRAGMENT,
9998
URL_FLAGS_HAS_HOST,
@@ -1573,29 +1572,6 @@ function toPathIfFileURL(fileURLOrPath) {
15731572
return fileURLToPath(fileURLOrPath);
15741573
}
15751574

1576-
function constructUrl(flags, protocol, username, password,
1577-
host, port, path, query, fragment) {
1578-
const ctx = new URLContext();
1579-
ctx.flags = flags;
1580-
ctx.scheme = protocol;
1581-
ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';
1582-
ctx.password = (flags & URL_FLAGS_HAS_PASSWORD) !== 0 ? password : '';
1583-
ctx.port = port;
1584-
ctx.path = (flags & URL_FLAGS_HAS_PATH) !== 0 ? path : [];
1585-
ctx.query = query;
1586-
ctx.fragment = fragment;
1587-
ctx.host = host;
1588-
1589-
const url = ObjectCreate(URL.prototype);
1590-
url[context] = ctx;
1591-
const params = new URLSearchParams();
1592-
url[searchParams] = params;
1593-
params[context] = url;
1594-
initSearchParams(params, query);
1595-
return url;
1596-
}
1597-
setURLConstructor(constructUrl);
1598-
15991575
module.exports = {
16001576
toUSVString,
16011577
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)
Please sign in to comment.