mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
url: remove unused setURLConstructor function
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
9d9b3f856f
commit
d6fbebda54
2 files changed
-33
No files matched your search
@@ -92,7 +92,6 @@ const {
|
||||
domainToUnicode: _domainToUnicode,
|
||||
encodeAuth,
|
||||
parse,
|
||||
setURLConstructor,
|
||||
URL_FLAGS_CANNOT_BE_BASE,
|
||||
URL_FLAGS_HAS_FRAGMENT,
|
||||
URL_FLAGS_HAS_HOST,
|
||||
@@ -1572,29 +1571,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 = { __proto__: 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,
|
||||
|
||||
@@ -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,
|
||||
@@ -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)
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user