Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion deps/ada/ada.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2026-01-30 13:29:04 -0500. Do not edit! */
/* auto-generated on 2026-02-23 21:29:24 -0500. Do not edit! */
/* begin file src/ada.cpp */
#include "ada.h"
/* begin file src/checkers.cpp */
Expand Down Expand Up @@ -14495,6 +14495,12 @@ bool url_aggregator::set_pathname(const std::string_view input) {
if (get_pathname().starts_with("//") && !has_authority() && !has_dash_dot()) {
buffer.insert(components.pathname_start, "/.");
components.pathname_start += 2;
if (components.search_start != url_components::omitted) {
components.search_start += 2;
}
if (components.hash_start != url_components::omitted) {
components.hash_start += 2;
}
}
ADA_ASSERT_TRUE(validate());
return true;
Expand Down
23 changes: 15 additions & 8 deletions deps/ada/ada.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2026-01-30 13:29:04 -0500. Do not edit! */
/* auto-generated on 2026-02-23 21:29:24 -0500. Do not edit! */
/* begin file include/ada.h */
/**
* @file ada.h
Expand Down Expand Up @@ -8091,6 +8091,12 @@ inline void url_aggregator::update_base_pathname(const std::string_view input) {
// output.
buffer.insert(components.pathname_start, "/.");
components.pathname_start += 2;
if (components.search_start != url_components::omitted) {
components.search_start += 2;
}
if (components.hash_start != url_components::omitted) {
components.hash_start += 2;
}
}

uint32_t difference = replace_and_resize(
Expand Down Expand Up @@ -9530,13 +9536,14 @@ url_pattern_component<regex_provider>::create_component_match_result(
auto result =
url_pattern_component_result{.input = std::move(input), .groups = {}};

// Optimization: Let's reserve the size.
result.groups.reserve(exec_result.size());

// We explicitly start iterating from 0 even though the spec
// says we should start from 1. This case is handled by the
// std_regex_provider.
for (size_t index = 0; index < exec_result.size(); index++) {
// std_regex_provider which removes the full match from index 0.
// Use min() to guard against potential mismatches between
// exec_result size and group_name_list size.
const size_t size = std::min(exec_result.size(), group_name_list.size());
result.groups.reserve(size);
for (size_t index = 0; index < size; index++) {
result.groups.emplace(group_name_list[index],
std::move(exec_result[index]));
}
Expand Down Expand Up @@ -11221,14 +11228,14 @@ constructor_string_parser<regex_provider>::parse(std::string_view input) {
#ifndef ADA_ADA_VERSION_H
#define ADA_ADA_VERSION_H

#define ADA_VERSION "3.4.2"
#define ADA_VERSION "3.4.3"

namespace ada {

enum {
ADA_VERSION_MAJOR = 3,
ADA_VERSION_MINOR = 4,
ADA_VERSION_REVISION = 2,
ADA_VERSION_REVISION = 3,
};

} // namespace ada
Expand Down
7 changes: 7 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3742,6 +3742,7 @@ V8 options that are allowed are:
* `--expose-gc`
* `--interpreted-frames-native-stack`
* `--jitless`
* `--max-heap-size`
* `--max-old-space-size`
* `--max-semi-space-size`
* `--perf-basic-prof-only-functions`
Expand Down Expand Up @@ -4102,6 +4103,12 @@ documented here:

### `--jitless`

### `--max-heap-size`

Specifies the maximum heap size (in megabytes) for the process.

This option is typically used to limit the amount of memory the process can use for its JavaScript heap.

<!-- Anchor to make sure old links find a target -->

<a id="--max-old-space-sizesize-in-megabytes"></a>
Expand Down
9 changes: 7 additions & 2 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2665,11 +2665,15 @@

<!-- YAML
changes:
- version:
- v24.0.0
pr-url: https://github.com/nodejs/node/pull/55017

Check warning on line 2670 in doc/api/deprecations.md

View workflow job for this annotation

GitHub Actions / lint-pr-url

pr-url doesn't match the URL of the current PR.
description: DEP0169 covers also `url.format()` and `url.resolve()`.
- version:
- v19.0.0
- v18.13.0
pr-url: https://github.com/nodejs/node/pull/44919
description: \`url.parse()` is deprecated again in DEP0169.
description: DEP0169 deprecates `url.parse()` again.
- version:
- v15.13.0
- v14.17.0
Expand Down Expand Up @@ -3783,7 +3787,7 @@
have security implications. Use the [WHATWG URL API][] instead. CVEs are not
issued for `url.parse()` vulnerabilities.

Passing a string argument to [`url.format()`][] invokes `url.parse()`
Calling [`url.format(urlString)`][] or [`url.resolve()`][] invokes `url.parse()`
internally, and is therefore also covered by this deprecation.

### DEP0170: Invalid port when using `url.parse()`
Expand Down Expand Up @@ -4597,6 +4601,7 @@
[`tls.createSecureContext()`]: tls.md#tlscreatesecurecontextoptions
[`tls.createServer()`]: tls.md#tlscreateserveroptions-secureconnectionlistener
[`url.format()`]: url.md#urlformaturlobject
[`url.format(urlString)`]: url.md#urlformaturlstring
[`url.parse()`]: url.md#urlparseurlstring-parsequerystring-slashesdenotehost
[`url.resolve()`]: url.md#urlresolvefrom-to
[`util._extend()`]: util.md#util_extendtarget-source
Expand Down
5 changes: 1 addition & 4 deletions doc/api/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<!--
NB(chrisdickinson): if you move this file, be sure to update
tools/doc/html.mjs to point at the new location.
-->
# Index

<!--introduced_in=v0.10.0-->

Expand Down
10 changes: 9 additions & 1 deletion doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@

`url.format(urlString)` is shorthand for `url.format(url.parse(urlString))`.

Because it invokes the deprecated [`url.parse()`][], passing a string argument
Because it invokes the deprecated [`url.parse()`][] internally, passing a string argument
to `url.format()` is itself deprecated.

Canonicalizing a URL string can be performed using the WHATWG URL API, by
Expand Down Expand Up @@ -1956,6 +1956,10 @@
<!-- YAML
added: v0.1.25
changes:
- version:
- v24.0.0
pr-url: https://github.com/nodejs/node/pull/55017

Check warning on line 1961 in doc/api/url.md

View workflow job for this annotation

GitHub Actions / lint-pr-url

pr-url doesn't match the URL of the current PR.
description: Deprecated again through DEP0169.
- version:
- v15.13.0
- v14.17.0
Expand All @@ -1979,6 +1983,8 @@
contains a hostname.
-->

> Stability: 0 - Deprecated: Use the WHATWG URL API instead.

* `from` {string} The base URL to use if `to` is a relative URL.
* `to` {string} The target URL to resolve.

Expand All @@ -1992,6 +1998,8 @@
url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
```

Because it invokes the deprecated [`url.parse()`][] internally, `url.resolve()` is itself deprecated.

To achieve the same result using the WHATWG URL API:

```js
Expand Down
7 changes: 7 additions & 0 deletions lib/internal/webstreams/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const {
Buffer,
} = require('buffer');

const {
isArrayBuffer,
} = require('internal/util/types');

const {
AbortError,
ErrnoException,
Expand Down Expand Up @@ -213,6 +217,9 @@ function newWritableStreamFromStreamWritable(streamWritable) {
start(c) { controller = c; },

write(chunk) {
if (!streamWritable.writableObjectMode && isArrayBuffer(chunk)) {
chunk = new Uint8Array(chunk);
}
if (streamWritable.writableNeedDrain || !streamWritable.write(chunk)) {
backpressurePromise = PromiseWithResolvers();
return SafePromisePrototypeFinally(
Expand Down
3 changes: 2 additions & 1 deletion src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,8 @@ static void IsAscii(const FunctionCallbackInfo<Value>& args) {
env, "Cannot validate on a detached buffer");
}

args.GetReturnValue().Set(simdutf::validate_ascii(abv.data(), abv.length()));
args.GetReturnValue().Set(
!simdutf::validate_ascii_with_errors(abv.data(), abv.length()).error);
}

void SetBufferPrototype(const FunctionCallbackInfo<Value>& args) {
Expand Down
1 change: 1 addition & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
"help system profilers to translate JavaScript interpreted frames",
V8Option{},
kAllowedInEnvvar);
AddOption("--max-heap-size", "", V8Option{}, kAllowedInEnvvar);
AddOption("--max-old-space-size", "", V8Option{}, kAllowedInEnvvar);
AddOption("--max-old-space-size-percentage",
"set V8's max old space size as a percentage of available memory "
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ class EnvironmentOptions : public Options {
std::vector<std::string> preload_esm_modules;

bool strip_types = HAVE_AMARO;
bool experimental_transform_types = false;

std::vector<std::string> user_argv;

Expand Down
19 changes: 15 additions & 4 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,11 @@ inline bool StatementSync::IsFinalized() {
return statement_ == nullptr;
}

inline int StatementSync::ResetStatement() {
reset_generation_++;
return sqlite3_reset(statement_);
}

bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) {
int r = sqlite3_clear_bindings(statement_);
CHECK_ERROR_OR_THROW(env()->isolate(), db_.get(), r, SQLITE_OK, false);
Expand Down Expand Up @@ -2812,7 +2817,7 @@ void StatementSync::All(const FunctionCallbackInfo<Value>& args) {
THROW_AND_RETURN_ON_BAD_STATE(
env, stmt->IsFinalized(), "statement has been finalized");
Isolate* isolate = env->isolate();
int r = sqlite3_reset(stmt->statement_);
int r = stmt->ResetStatement();
CHECK_ERROR_OR_THROW(isolate, stmt->db_.get(), r, SQLITE_OK, void());

if (!stmt->BindParams(args)) {
Expand All @@ -2838,7 +2843,7 @@ void StatementSync::Iterate(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
THROW_AND_RETURN_ON_BAD_STATE(
env, stmt->IsFinalized(), "statement has been finalized");
int r = sqlite3_reset(stmt->statement_);
int r = stmt->ResetStatement();
CHECK_ERROR_OR_THROW(env->isolate(), stmt->db_.get(), r, SQLITE_OK, void());

if (!stmt->BindParams(args)) {
Expand All @@ -2861,7 +2866,7 @@ void StatementSync::Get(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
THROW_AND_RETURN_ON_BAD_STATE(
env, stmt->IsFinalized(), "statement has been finalized");
int r = sqlite3_reset(stmt->statement_);
int r = stmt->ResetStatement();
CHECK_ERROR_OR_THROW(env->isolate(), stmt->db_.get(), r, SQLITE_OK, void());

if (!stmt->BindParams(args)) {
Expand All @@ -2885,7 +2890,7 @@ void StatementSync::Run(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
THROW_AND_RETURN_ON_BAD_STATE(
env, stmt->IsFinalized(), "statement has been finalized");
int r = sqlite3_reset(stmt->statement_);
int r = stmt->ResetStatement();
CHECK_ERROR_OR_THROW(env->isolate(), stmt->db_.get(), r, SQLITE_OK, void());

if (!stmt->BindParams(args)) {
Expand Down Expand Up @@ -3430,6 +3435,7 @@ StatementSyncIterator::StatementSyncIterator(Environment* env,
: BaseObject(env, object), stmt_(std::move(stmt)) {
MakeWeak();
done_ = false;
statement_reset_generation_ = stmt_->reset_generation_;
}

StatementSyncIterator::~StatementSyncIterator() {}
Expand Down Expand Up @@ -3488,6 +3494,11 @@ void StatementSyncIterator::Next(const FunctionCallbackInfo<Value>& args) {
return;
}

THROW_AND_RETURN_ON_BAD_STATE(
env,
iter->statement_reset_generation_ != iter->stmt_->reset_generation_,
"iterator was invalidated");

int r = sqlite3_step(iter->stmt_->statement_);
if (r != SQLITE_ROW) {
CHECK_ERROR_OR_THROW(
Expand Down
3 changes: 3 additions & 0 deletions src/node_sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ class StatementSync : public BaseObject {
bool use_big_ints_;
bool allow_bare_named_params_;
bool allow_unknown_named_params_;
uint64_t reset_generation_ = 0;
std::optional<std::map<std::string, std::string>> bare_named_params_;
inline int ResetStatement();
bool BindParams(const v8::FunctionCallbackInfo<v8::Value>& args);
bool BindValue(const v8::Local<v8::Value>& value, const int index);

Expand Down Expand Up @@ -321,6 +323,7 @@ class StatementSyncIterator : public BaseObject {
~StatementSyncIterator() override;
BaseObjectPtr<StatementSync> stmt_;
bool done_;
uint64_t statement_reset_generation_;
};

using Sqlite3ChangesetGenFunc = int (*)(sqlite3_session*, int*, void**);
Expand Down
49 changes: 49 additions & 0 deletions test/common/v8-max-heap-size-option.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

const assert = require('assert');
const { spawnSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const tmpdir = require('./tmpdir');

const testScript = `
const v8 = require('v8');
const stats = v8.getHeapStatistics();
const maxHeapSizeMB = Math.round(stats.heap_size_limit / 1024 / 1024);
console.log(maxHeapSizeMB);
`;

tmpdir.refresh();
const scriptPath = path.join(tmpdir.path, 'heap-limit-test.js');
fs.writeFileSync(scriptPath, testScript);

const child = spawnSync(
process.execPath,
[scriptPath],
{
encoding: 'utf8',
env: {
...process.env,
NODE_OPTIONS: '--max-heap-size=750',
},
},
);

assert.strictEqual(
child.status,
0,
[
`Child process did not exit cleanly.`,
` Exit code: ${child.status}`,
child.stderr ? ` Stderr: ${child.stderr.toString()}` : '',
child.stdout ? ` Stdout: ${child.stdout.toString()}` : '',
].filter(Boolean).join('\n'),
);
const output = child.stdout.trim();
const heapLimit = Number(output);

assert.strictEqual(
heapLimit,
750,
`max heap size is ${heapLimit}MB, expected 750MB`,
);
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Last update:
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
- web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/7cbe7e8ed9/WebCryptoAPI
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/42e47329fd/WebCryptoAPI
- webidl: https://github.com/web-platform-tests/wpt/tree/63ca529a02/webidl
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/2f96fa1996/webidl/ecmascript-binding/es-exceptions
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel
Expand Down
Loading
Loading