GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [v24.x backport] fs: stop recursive mkdir from retrying ENOENT forever by junaidkhan80121 · Pull Request #66927 · nodejs/node

[v24.x backport] fs: stop recursive mkdir from retrying ENOENT forever #66927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
junaidkhan80121 wants to merge 229 commits into nodejs:v24.x-staging from junaidkhan80121:backport-66340-to-v24.x

Uh oh!

There was an error while loading. Please reload this page.

Closed

[v24.x backport] fs: stop recursive mkdir from retrying ENOENT forever #66927

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
229 commits
Select commit Hold shift + click to select a range
9012fc6
fs: stop recursive mkdir from retrying ENOENT forever
junaidkhan80121 Oct 22, 2026
bd5809c
lib: add lint rule to enforce use of `kEmptyObject`
aduh95 Jun 10, 2026
59cb002
test_runner: add support for --test-coverage-include-all
avivkeller Jul 29, 2026
bda267f
test_runner: extend tag filter with boolean expression DSL
atlowChemi Aug 13, 2026
4e7af48
module: do not split a portable compile cache by uid
codebytere Aug 21, 2026
672edce
quic: apply multiple fixes to flow control signaling
jasnell Aug 15, 2026
e87f4b3
test: use common spawnSync helpers in more tests
greenheadHQ Aug 28, 2026
09bd62a
test: remove `console.log` call in `node_run_list`
aduh95 Aug 29, 2026
b40723c
node-api: enter env context for async callbacks
codebytere Aug 30, 2026
503e1be
tools: avoid workflow shell interpolation
panva Sep 13, 2026
35e9b53
test: update WPT for WebCryptoAPI to 55ce71bb9d
nodejs-github-bot Sep 7, 2026
dcc61cd
http: reduce per-request allocations in the server
mcollina Sep 19, 2026
31291c0
test: deflake long timer WPTs
marcopiraccini Sep 19, 2026
131cdc1
quic: cleanly tear down QUIC after worker.terminate()
pimterry Sep 19, 2026
16984dc
perf_hooks: fix truncation of uvMetricsInfo counters
jasnell Sep 17, 2026
e5652fd
doc: use Type for performanceNodeTiming.uvMetricsInfo
jasnell Sep 17, 2026
b9e8ef1
perf_hooks: add performanceNodeTiming.uvMetricsInfoBigInt
jasnell Sep 17, 2026
5caa780
stream: trim per-stream costs in webstreams
mcollina Sep 20, 2026
0086baa
meta: bump codecov/codecov-action from 7.0.0 to 7.1.0
dependabot[bot] Sep 20, 2026
933e5fe
perf_hooks: fix PerformanceObserver observer count leaks
jasnell Sep 17, 2026
60e9651
perf_hooks: track GC callback installation natively
jasnell Sep 17, 2026
ed6e0ca
perf_hooks: restore GC tracking after snapshot deserialization
jasnell Sep 17, 2026
26a67f6
https: handle invalid TLS options in proxied requests
christianaurichzm Sep 20, 2026
e91949b
lib: add primitive fast path to structuredClone
araujogui Sep 20, 2026
870c014
fs: close fd 0 on discarded FileHandle transfer
christianaurichzm Sep 21, 2026
c75d081
typings: wire up quic internal binding types
agape1225 Sep 21, 2026
679934a
doc: restore XadillaX to collaborators
XadillaX Sep 21, 2026
a338bd7
node-api: do not crash on module version mismatch
krassx Sep 21, 2026
c3af058
test: deflake test-benchmark-crypto
panva Sep 20, 2026
99725a8
test: deflake test-http2-debug
panva Sep 20, 2026
372c60d
test: update WPT for WebCryptoAPI to a6a0a0292a
nodejs-github-bot Sep 22, 2026
22097ef
typings: add mksnapshot internal binding types
leah-1ee Sep 22, 2026
ed8e4f4
watch: strip watch flags from NODE_OPTIONS in child process
marcopiraccini Sep 22, 2026
09f7277
typings: share AsyncWrap and HandleWrap types
leah-1ee Sep 22, 2026
4ba6b52
test: deflake pummel/test-timers
panva Sep 22, 2026
70788df
fs: close file streams with fd 0
greenheadHQ Sep 22, 2026
cd53f94
test: mark some tests flaky for now on riscv64
sxa Sep 4, 2026
9263f8e
src: free placeholder nodes for cppgc wrappers in MemoryTracker
codebytere Sep 22, 2026
433eb02
util: show SuppressedError's error/suppressed properties on inspect
agape1225 Sep 22, 2026
a2f1d39
test_runner: do not reuse a worker ID held by a running file
vserpokryl Sep 22, 2026
c72589c
stream: ensure nested async iterators are cancellation aware
jasnell Aug 30, 2026
c415463
stream: make broadcast waiters use SafeSet
jasnell Aug 30, 2026
260a7e3
stream: trim per-pipe and per-tee costs in webstreams
mcollina Sep 22, 2026
cbe02dd
doc: document iterable input for AbortSignal.any
haramj Sep 22, 2026
f580a84
src: add a flag to keep the embedder's wasm streaming callback
codebytere Sep 23, 2026
ef584fa
doc: clarify Worker execArgv vs Permission Model grants
yunshingng Sep 22, 2026
e0fcdc6
doc: add return type to Blocklist.isBlocklist
motokaneyuki Sep 23, 2026
d09171c
test: deflake watch mode tests
panva Sep 23, 2026
9b08726
test: update WPT for url to c48d58747e
nodejs-github-bot Sep 23, 2026
d4b2ba6
test: use heapdump test for SecureContext memory tracking
mertcanaltin Sep 23, 2026
0ab0a61
tools: add resume-ci label handling
panva Sep 24, 2026
a78c86c
test: accept ENOTEMPTY from libc++ in test-fs-rm
codebytere Sep 24, 2026
f9c7029
meta: label permission model changes correctly
RafaelGSS Sep 24, 2026
e13ba4f
process: graduate process.ref/unref from experimental
jasnell Sep 24, 2026
e0887dd
perf_hooks: harden histogram CBOR import validation
jasnell Sep 18, 2026
b020abb
perf_hooks: add histogram.snapshot()
jasnell Sep 18, 2026
08a745f
perf_hooks: add histogram.diff()
jasnell Sep 18, 2026
e6aba91
buffer: fix odd UTF-16LE indexOf start
inoway46 Sep 25, 2026
6da3ce3
doc: add indexed `Array.prototype` properties to primordial exclusions
Renegade334 Sep 25, 2026
295e806
crypto: match algorithm names as ASCII
panva Sep 22, 2026
f60e7c6
crypto: reject short AES-KW inputs
panva Sep 22, 2026
aa5fa20
crypto: isolate cipher job errors
panva Sep 22, 2026
10014dd
crypto: convert getRandomValues views
panva Sep 22, 2026
e360a4c
crypto: validate normalized hash names
panva Sep 22, 2026
a54fc10
crypto: allow short AES-GCM IVs
panva Sep 22, 2026
4cda1fc
crypto: allow unbound SubtleCrypto.supports
panva Sep 22, 2026
df85b12
crypto: resolve supports overloads by type
panva Sep 22, 2026
b0bd992
crypto: copy detached parameters as empty
panva Sep 22, 2026
00e04f3
crypto: convert importKey data as a union
panva Sep 22, 2026
0c6cf25
crypto: copy parameters without array species
panva Sep 22, 2026
d0b2e2c
crypto: check RSA JWK alg with SHA-3 hashes
panva Sep 22, 2026
9579558
crypto: reject duplicate unknown key usages
panva Sep 22, 2026
40caff7
crypto: handle PBKDF2 iteration limits
panva Sep 22, 2026
d676062
crypto: copy derived bits without species
panva Sep 22, 2026
efdc59f
crypto: minimize RSA public exponent metadata
panva Sep 22, 2026
34d6966
crypto: create key usage arrays without species
panva Sep 22, 2026
ebdaa95
crypto: derive Argon2 without worker threads
panva Sep 22, 2026
ee3721d
crypto: report actual RSA modulus lengths
panva Sep 22, 2026
b61a94a
crypto: split hybrid keys without species
panva Sep 22, 2026
3c36a9c
crypto: use the public CryptoKey prototype
panva Sep 22, 2026
2ac2db2
crypto: include EC public keys in PKCS8 exports
panva Sep 22, 2026
190de20
crypto: map JWK export failures to OperationError
panva Sep 22, 2026
e815589
crypto: check EC coordinate conversion results
panva Sep 22, 2026
b2ba5b7
benchmark: cover Web Crypto conversion costs
panva Sep 23, 2026
8d904d4
crypto: verify empty KMAC outputs
panva Sep 23, 2026
cd0126b
zlib: reject reset while a zstd frame is incomplete
xia-chao Sep 25, 2026
0514b1d
module: normalize package map paths
Dansatch Sep 25, 2026
5e0a0b1
url: create URLSearchParams collision map lazily
RomainLanz Sep 25, 2026
7094765
net: skip IPv6 regex when the string has no colon
anonrig Sep 25, 2026
6d01aec
test: ensure fsPromises.watch rejects on abort
hanityx Sep 25, 2026
8e87fba
net: speed up BlockList.check for strings
anonrig Sep 25, 2026
1a97ad5
util,assert: expose util.isPartialDeepStrictEqual()
tlhunter Sep 25, 2026
16eb02e
doc,src,test: fix typos in code comments
aguashui Sep 22, 2026
bf467d4
test: use spawnSync helpers in cpu-prof tests
DevJunz Sep 1, 2026
b74a817
src: reserve shared_array_buffers capacity in Message::Deserialize
agape1225 Sep 25, 2026
c52d345
http: preserve socket errors as response error causes
XadillaX Sep 16, 2026
33a0b94
stream: support ArrayBufferView in Utf8Stream write() buffer mode
agape1225 Aug 14, 2026
29d3e4a
build: add GZIP_COMPRESSION Make variable
inoway46 Sep 25, 2026
a19bf7a
test: deflake debugger function name extraction
panva Sep 26, 2026
4e0fa57
test: deflake inspector async hook setup
panva Sep 24, 2026
f7a1c4a
test: deflake test runner timeout coverage
panva Sep 24, 2026
db6ac9f
deps: update googletest to 4267679b6887f349f17b01ccd70c9e3483689b25
nodejs-github-bot Sep 26, 2026
01919a6
http: normalize CONNECT request paths
efekrskl Sep 26, 2026
1503c4b
build: add clang support for pgo on macOS/Linux
legendecas Sep 26, 2026
f61e83b
benchmark: fix shadowing that broke h=20 on incoming_headers benchmark
pimterry Sep 26, 2026
c55978e
zlib: reject reset after gzip/deflate emitted incomplete output
xia-chao Sep 26, 2026
87ae483
zlib: preserve brotli params and dictionary on reset
xia-chao Sep 26, 2026
90f36fb
stream: fix pipeline function tail deadlock
dayun6530 Sep 26, 2026
06ce26d
worker: remove messageerror listeners on exit
dayun6530 Sep 26, 2026
4e0cd18
fs: fix crash on negative zero file descriptor
christianaurichzm Sep 26, 2026
035725b
querystring: speed up default parse and unescape
anonrig Sep 26, 2026
f6f705e
worker: add Symbol.toStringTag to MessageChannel and MessagePort
lazerg Aug 25, 2026
701d7de
worker: add Symbol.toStringTag to BroadcastChannel
lazerg Aug 25, 2026
fb8125f
typings: wire up spawn_sync internal binding types
agape1225 Sep 27, 2026
3e1ced3
watch: detect files replaced via unlink and create
marcopiraccini Sep 27, 2026
9f98021
tools: check CI availability and workload
panva Sep 27, 2026
51759dd
http: avoid toLowerCase on the server hot path
anonrig Sep 25, 2026
edcf9b5
buffer: add isLatin1
jasnell Sep 28, 2026
cb44e48
stream: keep webstreams nil requests in fast mode
mcollina Sep 28, 2026
c53447a
buffer: fix negative index for large buffers
Dansatch Sep 28, 2026
6ee1f6d
test: use common.PIPE in fs.cp socket tests
maksim-romanov Sep 28, 2026
a9a15e0
deps: upgrade npm to 11.20.0
npm-cli-bot Sep 24, 2026
128d28c
module: avoid allocating a cache key string for every require()
MarshallOfSound Sep 28, 2026
f8d5387
deps: update zlib to 1.3.2.1-motley-456ae73
nodejs-github-bot Sep 29, 2026
b0dda97
http: add isValidHeaderName() and isValidHeaderValue()
jasnell Sep 27, 2026
3414a1e
benchmark: add http header validator benchmark
jasnell Sep 27, 2026
c06e38a
benchmark: add a node::MakeCallback benchmark
nigrosimone Sep 26, 2026
9d58d66
test: check frame restore in CallbackScope
nigrosimone Sep 26, 2026
fe23248
deps: update lief to 1.0.0
nodejs-github-bot Sep 29, 2026
1e5e9ef
benchmark: add zstdCompress benchmark
Cherry Sep 28, 2026
70850f5
crypto: fix raw key export error for wrong key type
koreahghg Sep 29, 2026
7a67004
src: fix builds without SSL and SQLite
panva Sep 30, 2026
0814dc8
src: remove `HAVE_QUIC` macro in favor of `OPENSSL_NO_QUIC`
aduh95 Sep 30, 2026
b5d513c
test: deflake inspector network fetch
panva Sep 26, 2026
97ec977
test: deflake debugger PID attachment and cleanup
panva Sep 26, 2026
2a63e46
test: deflake inspector close connection test
panva Sep 26, 2026
3b82a25
test: deflake http server mixed request timeouts
panva Sep 26, 2026
e1580c5
test: deflake http headers timeout keepalive
panva Sep 26, 2026
1c40413
test: deflake esm loader http imports
panva Sep 26, 2026
770fea3
test: deflake watch cwd with isolation none
panva Sep 26, 2026
445c44c
test: probe cluster workers with signal 0
panva Sep 26, 2026
9cbfbcc
test: isolate styleText tests from the environment
panva Sep 26, 2026
adc2c7a
src: assert that an IsolateData outlives its Environments
codebytere Sep 22, 2026
31df6e9
doc: update FreeEnvironment() notes for sibling Environments
codebytere Sep 22, 2026
717207a
fs: stop recursive mkdir from retrying ENOENT forever
marcopiraccini Sep 30, 2026
db5d16a
child_process: build the default env block in one native pass
codebytere Sep 30, 2026
e979505
test_runner: do not crash on stdout that mimics a v8 frame
faizanu94 Oct 1, 2026
8857230
tools: update gyp-next to 0.22.3
nodejs-github-bot Oct 1, 2026
506dd25
tools: keep OpenSSL update PRs in draft until arch configs committed
Renegade334 Oct 1, 2026
6645d29
process: use a class for nextTick resources
mcollina Oct 2, 2026
c648e79
test: do not hardcode V8 serialization header
joyeecheung Oct 2, 2026
95d35b9
tools: bump brace-expansion from 5.0.9 to 5.0.12 in /tools/eslint
dependabot[bot] Oct 2, 2026
39e1456
tools: bump brace-expansion in /tools/clang-format
dependabot[bot] Oct 3, 2026
faa502e
tools: add cache to `lint-js-and-md`
aduh95 Sep 30, 2026
8e84a29
util: fix inspect indentation of detached DataView
Kjubikstronk Oct 3, 2026
56f7a22
benchmark: add implicit-framing case to http/set-header
mcollina Sep 30, 2026
f8173e5
tools: avoid repeated subtree scans in must-call-assert
inoway46 Oct 3, 2026
b552df8
tools: wait for test processes instead of polling
mcollina Oct 3, 2026
86d2b7f
http: cache parser callbacks
mcollina Sep 27, 2026
d084008
zlib: fix abort with decodeStrings: false
Cherry Sep 29, 2026
9f68a35
http: avoid dictionary-mode objects in responses
mcollina Sep 30, 2026
77bdf6c
util: make mime parsing faster
jasnell Oct 5, 2026
d0c705d
build: fix vcbuild lint skipping lint-md-build
vedchaudhari Oct 5, 2026
4617f79
tools: limit format-cpp checkout history
inoway46 Oct 5, 2026
38d4954
build: fix vcbuild format-md install and exit
vedchaudhari Oct 5, 2026
352c4e6
tools: limit checkout for lint-cpp
inoway46 Oct 5, 2026
0b4471e
meta: bump github/codeql-action/upload-sarif from 4.38.0 to 4.38.2
dependabot[bot] Oct 5, 2026
ae181cf
meta: bump github/codeql-action/init from 4.38.0 to 4.38.2
dependabot[bot] Oct 5, 2026
f27f50b
meta: bump github/codeql-action/autobuild from 4.38.0 to 4.38.2
dependabot[bot] Oct 5, 2026
b7c8040
meta: bump github/codeql-action/analyze from 4.38.0 to 4.38.2
dependabot[bot] Oct 5, 2026
a2ddfc9
watch: escape quotes and backslashes in NODE_OPTIONS
trivikr Oct 5, 2026
6152c2f
deps: update histogram to 0.12.0
nodejs-github-bot Oct 6, 2026
93bb480
test: update WPT for WebCryptoAPI to 3127c3a492
nodejs-github-bot Oct 6, 2026
b9feae7
test: update test426-fixtures to 9ea66b466fd37e8a4050033d23b3e1480973c3d
nodejs-github-bot Oct 6, 2026
38d09ed
build: do not include shared gtest in `node` link path
aduh95 Oct 11, 2026
70035dd
test: run instantiateStreaming-bad-imports WPT
panva Sep 26, 2026
e4ad026
meta: bump codecov/codecov-action from 7.1.0 to 7.1.1
dependabot[bot] Oct 3, 2026
70f7ecd
tools: bump the eslint group in /tools/eslint with 5 updates
dependabot[bot] Oct 3, 2026
3c21460
test: remove duplicated cases in permission fs-read fixture
RafaelGSS Oct 3, 2026
8046eba
doc: add missing return types in cluster.md
Cayan Oct 4, 2026
24880f4
crypto: remove select Web Crypto warnings
panva Oct 4, 2026
f93b226
stream: port remaining SonicBoom tests for Utf8Stream
mcollina Oct 5, 2026
9e60804
test_runner: add mock call assertions to t.assert
araujogui Oct 6, 2026
aecf034
watch: strip underscore aliases of watch flags
trivikr Oct 6, 2026
83b29c1
quic: destroy stream on invalid promise body
christianaurichzm Oct 6, 2026
a1b2784
doc: run license-builder
github-actions[bot] Oct 7, 2026
0c8092e
tools: copy hdr_histogram_internal.h in update-histogram.sh
fcostaoliveira Oct 7, 2026
8b4c055
doc: clarify node binary misuse after compromise
RafaelGSS Oct 7, 2026
f5e51ec
crypto: skip secret key mutex allocation
panva Sep 30, 2026
fe89edc
crypto: remove RSA-OAEP key locking
panva Sep 30, 2026
ee54a95
crypto: remove verify setup key locking
panva Sep 30, 2026
1cc277b
crypto: isolate provider EC PKCS8 encoding
panva Oct 1, 2026
a9608f0
doc: clarify revert PR label policy
aduh95 Oct 7, 2026
91779c9
test_runner: report load errors with --test-isolation=none
lazerg Oct 8, 2026
478194f
doc: fix request.reusedSocket timeout example
efekrskl Sep 25, 2026
424e6c9
doc: document keepAliveTimeoutBuffer server option
efekrskl Sep 25, 2026
7974f94
doc: clarify http Agent keepSocketAlive behavior
efekrskl Oct 8, 2026
c57c394
child_process: propagate config-file permission flags to children
RafaelGSS Oct 8, 2026
fc74b37
benchmark: fix url-searchparams-sort to sort a fresh list
RafaelGSS Oct 5, 2026
1dbce2c
sqlite: validate aggregate() name and options
araujogui Oct 9, 2026
10787f5
test: tolerate async block count updates in test-fs-stat-bigint
RafaelGSS Oct 10, 2026
5139272
process: mark process.finalization as release candidate
mcollina Oct 1, 2026
c27b3ad
stream: fix Utf8Stream flush handling
jasnell Oct 3, 2026
39381a9
benchmark: add util.parseArgs benchmark
RafaelGSS Oct 10, 2026
859db74
http2: speed up response getHeaders
rozzilla Oct 10, 2026
8ff733d
benchmark: fix buffer option in buffer read/write benchmarks
RafaelGSS Oct 10, 2026
9cd7cfb
test_runner: rerun failing todo tests in suites
barakor Oct 10, 2026
60d0517
benchmark: fix input passed to subtle.digest in webcrypto-digest
RafaelGSS Oct 10, 2026
ce12d2c
stream: keep share buffer when all consumers detach
jasnell Oct 3, 2026
dda1509
stream: bound pre-batched async values in from()
jasnell Oct 3, 2026
78b412a
stream: fix fromSync() async input error messages
jasnell Oct 3, 2026
e1c9f09
deps: update simdjson to 5.0.3
lemire Oct 9, 2026
d901c61
build: support Python 3.15
MikeMcC399 Oct 11, 2026
15b6523
module: fix require of imports with package map
lazerg Oct 11, 2026
c334c6c
lib: fix AbortSignal.any() nested composite leak
DariusHQ Oct 12, 2026
352d07b
meta: bump nodejs/node-pr-labeler to dfe5eb3
soulee-dev Oct 12, 2026
2681f27
build: run QUIC CI for V8 changes
inoway46 Oct 12, 2026
dd049bc
http: reduce raw header name allocations
rozzilla Oct 12, 2026
4ae00b1
deps: update sqlite to 3.54.0
nodejs-github-bot Oct 12, 2026
fae672c
deps: update acorn to 8.19.0
nodejs-github-bot Oct 12, 2026
22f286b
querystring: fix value decoding after encoded keys
vedchaudhari Oct 13, 2026
830b87c
stream: skip idle webstreams start and watchers
mcollina Sep 30, 2026
45e2567
deps: update googletest to 988ea2c1798de7779f656df2281dd36d6039a17a
nodejs-github-bot Oct 13, 2026
9a8dad1
doc: list futimes among fd APIs disabled by the permission model
RafaelGSS Oct 13, 2026
bcb20cc
src: release uv_fs_t in permission WildcardIfDir
RafaelGSS Oct 13, 2026
70a874c
tools: restore Python 3.14 for daily WPT
panva Oct 13, 2026
e4106f4
permission: keep explicit fs grants when dropping a covering directory
RafaelGSS Oct 13, 2026
a83a23b
src: fix the fs permission tree node on wildcard nodes
jasnell Sep 19, 2026
6ec9311
Merge branch 'v24.x-staging' into backport-66340-to-v24.x
junaidkhan80121 Oct 25, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
stream: trim per-stream costs in webstreams
Short-lived streams (create, a few chunks, close) pay a fixed cost per
stream that dominates once the per-chunk path is lean.

Streams created internally (transform stream sides, tee branches,
ReadableStream.from, transferred streams) were built by wrapper
constructors that swapped the prototype of every instance and then
assigned an own, enumerable `constructor` property to look like a
public stream. Each internal stream therefore had its own hidden class
and `Object.keys(stream)` reported `['constructor']`. The public
constructors now accept the internal construction sentinel and leave
controller setup to the caller, so every ReadableStream and
WritableStream shares one hidden class and no per-instance prototype
swap or own property is needed.

The queue ring buffer grew after a push filled it, so the initial 8-slot
ring held only three (value, size) pairs and a four-chunk stream
reallocated every time. Growing before the push lets the ring hold four
pairs.

pipeTo observed the source's closed promise with two reactions and, on
teardown, let the reader and writer release paths probe and reject
promise records that only the pipe could have observed. One reaction
pair now watches the source, and finalize drops the records before
release.

Signed-off-by: Matteo Collina <[email protected]>
PR-URL: #66052
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@mcollina @aduh95
mcollina authored and aduh95 committed Oct 23, 2026
commit 5caa780e1d1ebcfe1e4fecb616f1179a87d75956

There are no files selected for viewing

163 changes: 69 additions & 94 deletions 163 lib/internal/webstreams/readablestream.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ class ReadableStream {
*/
constructor(source = kEmptyObject, strategy = kEmptyObject) {
markTransferMode(this, false, true);
// Internal construction (tee, transform streams, adapters, transfer):
// the caller sets up the controller, so every ReadableStream shares
// one hidden class and no per-instance prototype swap is needed.
if (source === kSkipThrow) {
this[kState] = createReadableStreamState();
return;
}
validateObject(source, 'source', kValidateObjectAllowObjects);
validateObject(strategy, 'strategy', kValidateObjectAllowObjectsAndNull);
this[kState] = createReadableStreamState();
Expand Down Expand Up @@ -718,22 +725,8 @@ ObjectDefineProperties(ReadableStream, {
from: kEnumerableProperty,
});

function InternalTransferredReadableStream() {
ObjectSetPrototypeOf(this, ReadableStream.prototype);
markTransferMode(this, false, true);
this[kType] = 'ReadableStream';
this[kState] = createReadableStreamState();
}

ObjectSetPrototypeOf(InternalTransferredReadableStream.prototype, ReadableStream.prototype);
ObjectSetPrototypeOf(InternalTransferredReadableStream, ReadableStream);

function TransferredReadableStream() {
const stream = new InternalTransferredReadableStream();

stream.constructor = ReadableStream;

return stream;
return new ReadableStream(kSkipThrow);
}

TransferredReadableStream.prototype[kDeserialize] = () => {};
Expand Down Expand Up @@ -1350,57 +1343,29 @@ ObjectDefineProperties(ReadableByteStreamController.prototype, {
[SymbolToStringTag]: getNonWritablePropertyDescriptor(ReadableByteStreamController.name),
});

function InternalReadableStream(start, pull, cancel, highWaterMark, size) {
ObjectSetPrototypeOf(this, ReadableStream.prototype);
markTransferMode(this, false, true);
this[kType] = 'ReadableStream';
this[kState] = createReadableStreamState();
const controller = new ReadableStreamDefaultController(kSkipThrow);
function createReadableStream(start, pull, cancel, highWaterMark = 1, size = defaultSizeAlgorithm) {
const stream = new ReadableStream(kSkipThrow);
setupReadableStreamDefaultController(
this,
controller,
stream,
new ReadableStreamDefaultController(kSkipThrow),
start,
pull,
cancel,
highWaterMark,
size);
}

ObjectSetPrototypeOf(InternalReadableStream.prototype, ReadableStream.prototype);
ObjectSetPrototypeOf(InternalReadableStream, ReadableStream);

function createReadableStream(start, pull, cancel, highWaterMark = 1, size = defaultSizeAlgorithm) {
const stream = new InternalReadableStream(start, pull, cancel, highWaterMark, size);

// For spec compliance the InternalReadableStream must be a ReadableStream
stream.constructor = ReadableStream;
return stream;
}

function InternalReadableByteStream(start, pull, cancel) {
ObjectSetPrototypeOf(this, ReadableStream.prototype);
markTransferMode(this, false, true);
this[kType] = 'ReadableStream';
this[kState] = createReadableStreamState();
const controller = new ReadableByteStreamController(kSkipThrow);
function createReadableByteStream(start, pull, cancel) {
const stream = new ReadableStream(kSkipThrow);
setupReadableByteStreamController(
this,
controller,
stream,
new ReadableByteStreamController(kSkipThrow),
start,
pull,
cancel,
0,
undefined);
}

ObjectSetPrototypeOf(InternalReadableByteStream.prototype, ReadableStream.prototype);
ObjectSetPrototypeOf(InternalReadableByteStream, ReadableStream);

function createReadableByteStream(start, pull, cancel) {
const stream = new InternalReadableByteStream(start, pull, cancel);

// For spec compliance the InternalReadableByteStream must be a ReadableStream
stream.constructor = ReadableStream;
return stream;
}

Expand Down Expand Up @@ -1630,6 +1595,13 @@ function readableStreamPipeTo(
// tells us that the promise must be rejected even
// when error is undefine.
function finalize(rejected, error) {
// The pipe is the only observer of the reader's and writer's promise
// records (including the ready hook installed by parkOnReady), and
// it is done with them: dropping them lets release skip the
// pending-promise probes and the rejections nothing would handle.
writer[kState].ready = undefined;
writer[kState].close = undefined;
reader[kState].close = undefined;
writableStreamDefaultWriterRelease(writer);
readableStreamReaderGenericRelease(reader);
if (signal !== undefined)
Expand Down Expand Up @@ -1727,12 +1699,6 @@ function readableStreamPipeTo(
PromisePrototypeThen(promise, undefined, action);
}

function watchClosed(stream, promise, action) {
if (stream[kState].state === 'closed')
action();
else
PromisePrototypeThen(promise, action, () => {});
}

// The pump loop is callback-driven to avoid per-iteration promise
// allocations. At most one read is in flight at a time, so one read
Expand Down Expand Up @@ -1863,15 +1829,34 @@ function readableStreamPipeTo(

pump();

watchErrored(source, readerClosedPromise(reader).promise, (error) => {
function onSourceErrored(error) {
if (!preventAbort) {
return shutdownWithAnAction(
() => writableStreamAbort(dest, error),
true,
error);
}
shutdown(true, error);
});
}

function onSourceClosed() {
if (!preventClose) {
return shutdownWithAnAction(
() => writableStreamDefaultWriterCloseWithErrorPropagation(writer));
}
shutdown();
}

// The spec installs the source-errored watcher before the dest-errored
// one and the source-closed watcher last; a source that is already
// errored is handled before the dest watcher is installed, and an
// already-closed source after it, as before.
if (source[kState].state === 'errored') {
onSourceErrored(source[kState].storedError);
} else if (source[kState].state !== 'closed') {
PromisePrototypeThen(
readerClosedPromise(reader).promise, onSourceClosed, onSourceErrored);
}

watchErrored(dest, writerClosedPromise(writer).promise, (error) => {
if (!preventCancel) {
Expand All @@ -1883,13 +1868,8 @@ function readableStreamPipeTo(
shutdown(true, error);
});

watchClosed(source, readerClosedPromise(reader).promise, () => {
if (!preventClose) {
return shutdownWithAnAction(
() => writableStreamDefaultWriterCloseWithErrorPropagation(writer));
}
shutdown();
});
if (source[kState].state === 'closed')
onSourceClosed();

if (writableStreamCloseQueuedOrInFlight(dest) ||
dest[kState].state === 'closed') {
Expand Down Expand Up @@ -2899,29 +2879,27 @@ function setupReadableStreamDefaultController(

const startResult = startAlgorithm();

const started = () => {
controller[kState].started = true;
assert(!controller[kState].pulling);
assert(!controller[kState].pullAgain);
readableStreamDefaultControllerCallPullIfNeeded(controller);
};

if (startResult === null ||
(typeof startResult !== 'object' && typeof startResult !== 'function')) {
// Non-thenable start result: fulfillment is guaranteed and no .then
// lookup on the result is observable, so run the post-start step
// directly at the exact microtask position the promise reaction
// would have had, skipping two promise allocations.
queueMicrotask(() => {
controller[kState].started = true;
assert(!controller[kState].pulling);
assert(!controller[kState].pullAgain);
readableStreamDefaultControllerCallPullIfNeeded(controller);
});
// lookup on the result is observable, so the post-start step runs at
// the exact microtask position the promise reaction would have had.
queueMicrotask(started);
return;
}

// The wrapper promise matches the reference implementation's
// promiseResolvedWith(), whose extra microtask hops WPT relies on.
PromisePrototypeThen(
new Promise((r) => r(startResult)),
() => {
controller[kState].started = true;
assert(!controller[kState].pulling);
assert(!controller[kState].pullAgain);
readableStreamDefaultControllerCallPullIfNeeded(controller);
},
started,
(error) => readableStreamDefaultControllerError(controller, error));
}

Expand Down Expand Up @@ -3783,26 +3761,23 @@ function setupReadableByteStreamController(

const startResult = startAlgorithm();

const started = () => {
controller[kState].started = true;
assert(!controller[kState].pulling);
assert(!controller[kState].pullAgain);
readableByteStreamControllerCallPullIfNeeded(controller);
};

// See setupReadableStreamDefaultController.
if (startResult === null ||
(typeof startResult !== 'object' && typeof startResult !== 'function')) {
// See setupReadableStreamDefaultController.
queueMicrotask(() => {
controller[kState].started = true;
assert(!controller[kState].pulling);
assert(!controller[kState].pullAgain);
readableByteStreamControllerCallPullIfNeeded(controller);
});
queueMicrotask(started);
return;
}

PromisePrototypeThen(
new Promise((r) => r(startResult)),
() => {
controller[kState].started = true;
assert(!controller[kState].pulling);
assert(!controller[kState].pullAgain);
readableByteStreamControllerCallPullIfNeeded(controller);
},
started,
(error) => readableByteStreamControllerError(controller, error));
}

Expand Down
16 changes: 9 additions & 7 deletions 16 lib/internal/webstreams/util.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ class Queue {
// Single-slot entries (readable byte controller chunk records).

push(entry) {
if (this.length === this.list.length)
this.grow();
const tail = this.tail;
this.list[tail] = entry;
this.tail = (tail + 1) & this.capacityMask;
this.length++;
if (this.tail === this.head)
this.grow();
}

shift() {
Expand All @@ -207,14 +207,14 @@ class Queue {
// never need to wrap.

pushPair(value, size) {
if (this.length * 2 === this.list.length)
this.grow();
const tail = this.tail;
const list = this.list;
list[tail] = value;
list[tail + 1] = size;
this.tail = (tail + 2) & this.capacityMask;
this.length++;
if (this.tail === this.head)
this.grow();
}

// Returns the dequeued value; the size of the same entry is left in
Expand All @@ -237,9 +237,11 @@ class Queue {
return this.list[this.head];
}

// The ring is completely full (the post-push tail caught up with the
// head): double the capacity, re-linearizing from the head so index
// arithmetic stays trivial.
// The ring is completely full (the tail has caught up with the head, so
// the next push would overwrite the oldest entry): double the capacity,
// re-linearizing from the head so index arithmetic stays trivial.
// Growing before the push rather than after it lets the initial 8-slot
// ring hold four (value, size) pairs without reallocating.
grow() {
const list = this.list;
const capacity = list.length;
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.