Skip to content

Commit a51fe3c

Browse files
anonrigMylesBorins
authored andcommittedFeb 18, 2023
url: replace url-parser with ada
PR-URL: #46410 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
1 parent 7d6c27e commit a51fe3c

17 files changed

+378
-2990
lines changed
 

‎lib/internal/url.js

+142-358
Large diffs are not rendered by default.

‎node.gyp

-33
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@
533533
'src/node_trace_events.cc',
534534
'src/node_types.cc',
535535
'src/node_url.cc',
536-
'src/node_url_tables.cc',
537536
'src/node_util.cc',
538537
'src/node_v8.cc',
539538
'src/node_wasi.cc',
@@ -895,37 +894,6 @@
895894
},
896895
],
897896
}, # node_lib_target_name
898-
{ # fuzz_url
899-
'target_name': 'fuzz_url',
900-
'type': 'executable',
901-
'dependencies': [
902-
'<(node_lib_target_name)',
903-
],
904-
'includes': [
905-
'node.gypi'
906-
],
907-
'include_dirs': [
908-
'src',
909-
],
910-
'defines': [
911-
'NODE_ARCH="<(target_arch)"',
912-
'NODE_PLATFORM="<(OS)"',
913-
'NODE_WANT_INTERNALS=1',
914-
],
915-
'sources': [
916-
'src/node_snapshot_stub.cc',
917-
'test/fuzzers/fuzz_url.cc',
918-
],
919-
'conditions': [
920-
['OS=="linux"', {
921-
'ldflags': [ '-fsanitize=fuzzer' ]
922-
}],
923-
# Ensure that ossfuzz flag has been set and that we are on Linux
924-
[ 'OS!="linux" or ossfuzz!="true"', {
925-
'type': 'none',
926-
}],
927-
],
928-
}, # fuzz_url
929897
{ # fuzz_env
930898
'target_name': 'fuzz_env',
931899
'type': 'executable',
@@ -1018,7 +986,6 @@
1018986
'test/cctest/test_sockaddr.cc',
1019987
'test/cctest/test_traced_value.cc',
1020988
'test/cctest/test_util.cc',
1021-
'test/cctest/test_url.cc',
1022989
],
1023990

1024991
'conditions': [

‎src/crypto/crypto_common.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
#include "crypto/crypto_common.h"
12
#include "base_object-inl.h"
23
#include "env-inl.h"
4+
#include "memory_tracker-inl.h"
5+
#include "node.h"
36
#include "node_buffer.h"
47
#include "node_crypto.h"
5-
#include "crypto/crypto_common.h"
6-
#include "node.h"
78
#include "node_internals.h"
8-
#include "node_url.h"
99
#include "string_bytes.h"
10-
#include "memory_tracker-inl.h"
1110
#include "v8.h"
1211

1312
#include <openssl/ec.h>

‎src/inspector_agent.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,9 @@ class NodeInspectorClient : public V8InspectorClient {
650650
protocol::StringUtil::StringViewToUtf8(resource_name_view);
651651
if (!IsFilePath(resource_name))
652652
return nullptr;
653-
node::url::URL url = node::url::URL::FromFilePath(resource_name);
654-
return Utf8ToStringView(url.href());
653+
654+
std::string url = node::url::FromFilePath(resource_name);
655+
return Utf8ToStringView(url);
655656
}
656657

657658
node::Environment* env_;

‎src/module_wrap.cc

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "node_external_reference.h"
88
#include "node_internals.h"
99
#include "node_process-inl.h"
10-
#include "node_url.h"
1110
#include "node_watchdog.h"
1211
#include "util-inl.h"
1312

@@ -21,8 +20,6 @@ namespace loader {
2120
using errors::TryCatchScope;
2221

2322
using node::contextify::ContextifyContext;
24-
using node::url::URL;
25-
using node::url::URL_FLAGS_FAILED;
2623
using v8::Array;
2724
using v8::ArrayBufferView;
2825
using v8::Context;

‎src/node_api.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
657657
// a file system path.
658658
// TODO(gabrielschulhof): Pass the `filename` through unchanged if/when we
659659
// receive it as a URL already.
660-
module_filename = node::url::URL::FromFilePath(filename.ToString()).href();
660+
module_filename = node::url::FromFilePath(filename.ToString());
661661
}
662662

663663
// Create a new napi_env for this specific module.

‎src/node_metadata.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "node_metadata.h"
22
#include "acorn_version.h"
3+
#include "ada.h"
34
#include "ares.h"
45
#include "brotli/encode.h"
56
#include "llhttp.h"
@@ -115,6 +116,7 @@ Metadata::Versions::Versions() {
115116
#endif
116117

117118
simdutf = SIMDUTF_VERSION;
119+
ada = ADA_VERSION;
118120
}
119121

120122
Metadata::Release::Release() : name(NODE_RELEASE) {

‎src/node_metadata.h

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace node {
4747
V(uvwasi) \
4848
V(acorn) \
4949
V(simdutf) \
50+
V(ada) \
5051
NODE_VERSIONS_KEY_UNDICI(V)
5152

5253
#if HAVE_OPENSSL

0 commit comments

Comments
 (0)