Skip to content

Commit

Permalink
url: replace url-parser with ada
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
anonrig authored and MylesBorins committed Feb 18, 2023
1 parent 7d6c27e commit a51fe3c
Show file tree
Hide file tree
Showing 17 changed files with 378 additions and 2,990 deletions.
500 changes: 142 additions & 358 deletions lib/internal/url.js

Large diffs are not rendered by default.

33 changes: 0 additions & 33 deletions node.gyp
Expand Up @@ -533,7 +533,6 @@
'src/node_trace_events.cc',
'src/node_types.cc',
'src/node_url.cc',
'src/node_url_tables.cc',
'src/node_util.cc',
'src/node_v8.cc',
'src/node_wasi.cc',
Expand Down Expand Up @@ -895,37 +894,6 @@
},
],
}, # node_lib_target_name
{ # fuzz_url
'target_name': 'fuzz_url',
'type': 'executable',
'dependencies': [
'<(node_lib_target_name)',
],
'includes': [
'node.gypi'
],
'include_dirs': [
'src',
],
'defines': [
'NODE_ARCH="<(target_arch)"',
'NODE_PLATFORM="<(OS)"',
'NODE_WANT_INTERNALS=1',
],
'sources': [
'src/node_snapshot_stub.cc',
'test/fuzzers/fuzz_url.cc',
],
'conditions': [
['OS=="linux"', {
'ldflags': [ '-fsanitize=fuzzer' ]
}],
# Ensure that ossfuzz flag has been set and that we are on Linux
[ 'OS!="linux" or ossfuzz!="true"', {
'type': 'none',
}],
],
}, # fuzz_url
{ # fuzz_env
'target_name': 'fuzz_env',
'type': 'executable',
Expand Down Expand Up @@ -1018,7 +986,6 @@
'test/cctest/test_sockaddr.cc',
'test/cctest/test_traced_value.cc',
'test/cctest/test_util.cc',
'test/cctest/test_url.cc',
],

'conditions': [
Expand Down
7 changes: 3 additions & 4 deletions src/crypto/crypto_common.cc
@@ -1,13 +1,12 @@
#include "crypto/crypto_common.h"
#include "base_object-inl.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "node.h"
#include "node_buffer.h"
#include "node_crypto.h"
#include "crypto/crypto_common.h"
#include "node.h"
#include "node_internals.h"
#include "node_url.h"
#include "string_bytes.h"
#include "memory_tracker-inl.h"
#include "v8.h"

#include <openssl/ec.h>
Expand Down
5 changes: 3 additions & 2 deletions src/inspector_agent.cc
Expand Up @@ -650,8 +650,9 @@ class NodeInspectorClient : public V8InspectorClient {
protocol::StringUtil::StringViewToUtf8(resource_name_view);
if (!IsFilePath(resource_name))
return nullptr;
node::url::URL url = node::url::URL::FromFilePath(resource_name);
return Utf8ToStringView(url.href());

std::string url = node::url::FromFilePath(resource_name);
return Utf8ToStringView(url);
}

node::Environment* env_;
Expand Down
3 changes: 0 additions & 3 deletions src/module_wrap.cc
Expand Up @@ -7,7 +7,6 @@
#include "node_external_reference.h"
#include "node_internals.h"
#include "node_process-inl.h"
#include "node_url.h"
#include "node_watchdog.h"
#include "util-inl.h"

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

using node::contextify::ContextifyContext;
using node::url::URL;
using node::url::URL_FLAGS_FAILED;
using v8::Array;
using v8::ArrayBufferView;
using v8::Context;
Expand Down
2 changes: 1 addition & 1 deletion src/node_api.cc
Expand Up @@ -657,7 +657,7 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
// a file system path.
// TODO(gabrielschulhof): Pass the `filename` through unchanged if/when we
// receive it as a URL already.
module_filename = node::url::URL::FromFilePath(filename.ToString()).href();
module_filename = node::url::FromFilePath(filename.ToString());
}

// Create a new napi_env for this specific module.
Expand Down
2 changes: 2 additions & 0 deletions src/node_metadata.cc
@@ -1,5 +1,6 @@
#include "node_metadata.h"
#include "acorn_version.h"
#include "ada.h"
#include "ares.h"
#include "brotli/encode.h"
#include "llhttp.h"
Expand Down Expand Up @@ -115,6 +116,7 @@ Metadata::Versions::Versions() {
#endif

simdutf = SIMDUTF_VERSION;
ada = ADA_VERSION;
}

Metadata::Release::Release() : name(NODE_RELEASE) {
Expand Down
1 change: 1 addition & 0 deletions src/node_metadata.h
Expand Up @@ -47,6 +47,7 @@ namespace node {
V(uvwasi) \
V(acorn) \
V(simdutf) \
V(ada) \
NODE_VERSIONS_KEY_UNDICI(V)

#if HAVE_OPENSSL
Expand Down

0 comments on commit a51fe3c

Please sign in to comment.