* Resolve esbuild getter-table exports like plain exports
- cjs: resolve esbuild getter-table exports like plain exports.
* lowering: leave the getter-table memo out of the unit journal
* program-facts: register the getter-table shape prefilter
The getter-table recognizer tests a module's source text for the `__export`
helper before walking its statements. Every whole-program text test is
registered so the registry says what the scan decides; this one is a
prefilter, and the walk behind it decides the shape from the module's
syntax tree.
* cjs: snapshot a getter-table export at every destructuring declaration
* Answer an HTTP/2 compat request's complete once it is aborted
The dynamic read of `complete` on the compatibility request answered only
the HTTP/1 flag, so a request whose stream the peer reset reported false
while Node reports true once the message can receive no more body.
* Answer "" for an HTTP/2 compat response's statusMessage
The dynamic read fell through to the HTTP/1 reason phrase, which an h2
response never has, so it answered undefined where Node answers "". The
request it serves over an h2 stream now answers the empty reason phrase.
* Answer an HTTP/2 compat request's stream member
A dynamic read of `stream` on the compatibility request fell through to
undefined; Node exposes the Http2Stream it is carried on. The member now
answers that stream.
* Hold the http2 iterator across the error and close drains
* Dispatch signal listeners from process.emit
- process: emit a signal's listeners synchronously.
* process: emit signal listeners with no arguments, on the main thread
* process: island signal listeners get no emit arguments either
* process: three review fixes for emit
* process: a once listener removed mid-dispatch still runs
* process: the exit cleanup releases a once signal listener's wrapper state
* Verify Windows island cache ownership and DACLs before reuse
* Create island directories owned by the user, not the token's default owner
- An elevated administrator token's default owner is BUILTIN\Administrators,
so a directory the runtime created was owned by another principal and failed
the ownership check on the next start: island modules never loaded.
- The protected descriptor now names the token's user as the owner, so a tree
this process created passes the check under an elevated or a normal token.
* Never delete an island tree another process may be loading from
- When the digest directory cannot be moved aside, the run installed into a
shared `.local` tree and deleted the previous one on every start, even
while another process was loading from it.
- The fallback now installs into a fresh random-named sibling and deletes
nothing, so two concurrent launches each load a whole tree of their own.
* Give a spawned child only its stdio handles on Windows
- The child launcher starts the child with an explicit handle list holding the
child's own inheritable duplicates of its stdio descriptors, so no other
handle this process holds is inherited.
- The STARTUPINFO names only what that list holds.
* Fail a Windows spawn that cannot restrict what the child inherits
- When the handle list cannot be built or updated, or one of the child's
stdio duplicates cannot be made, the spawn now fails with that error
instead of handing the child every inheritable handle the process holds.
- Only the listed duplicates reach the STARTUPINFO, and a spawn with no
stdio slots passes bInheritHandles = FALSE instead of falling back.
* Find a static write's classes without rescanning the program
Closes#4559
Co-authored-by: yukkes <44968006+yukkes@users.noreply.github.com>
* Prune visited classes in the static-write descendant walk
The reverse map lists a class under every superclass name isSubclassOf
recognizes (its bases along the base chain and each generic family), so two
names can lead to the same class. The walk tested `!seen.add(name)`, but
Set.prototype.add returns the set, so the test never pruned anything: a chain
whose links carry two names follows every path instead of visiting each class
once, which is exponential in its depth and exhausts CPU and heap.
The walk now checks has() before add(), and lives in descendantClasses
(class-descendants.ts) with unit tests for the doubled chain (bounded at
2^30 visits without the prune), a reconverging diamond, and the start class.
A 30-class chain whose base constructor is held by a dynamic class value is a
corpus program whose output matches Node.
* Assemble a large static-field fence batch without spreading it
The fence helper gets one branch per class and static field, so a program
with a few hundred inheriting classes and two hundred static fields builds a
batch of tens of thousands of entries. Passing that batch as separate
arguments to splice() overflows the engine's argument limit and fails the
compile with 'RangeError: Maximum call stack size exceeded'.
The batch is now assembled into the helper's body in declaration order
without a spread call; successive insertions at the same index left the
branches reversed, and a large-batch test (350 classes x 200 fields) fails on
the old code with the RangeError and passes here.
* Record the TS7 order baselines for the new corpus programs
generic-family-static-write and static-write-inheritance-chain had no
recorded preflight/order baseline, which fails the lint and format job
(test:ts7). Recorded with SCRIPTC_UPDATE_BASELINES=1 against the parity
suite; test:ts7 --baselines-only, format:check and lint pass.
---------
Co-authored-by: yukkes <44968006+yukkes@users.noreply.github.com>
process.nextTick lowers to scr_next_tick in scr_async.c, which a sync
library archive does not link. The async_free gate did not name it, so a
library graph could pass SC4005 and produce an archive whose scr_next_tick
reference failed only at the embedder's link. Add it to the refused
prefixes so the graph refuses with SC4005 while preparing the library.
Regression tests cover the call form and the imported nextTick form.
Refs #265
Co-authored-by: mmamedel <23098414+mmamedel@users.noreply.github.com>
* Carry the lib call's builtin name as a string in the IR
* Remove unused libFnSignatures imports in validate and lib-boundary
* Regenerate the IR codec for the string builtin name
* Index the builtin signatures once instead of recasting the table per lookup
* Treat non-iterable HeadersInit objects as records like Node
- fetch: read any object's own properties for a HeadersInit record.
* fetch: read a HeadersInit record's values when each conversion comes
* fetch: snapshot a HeadersInit record's keys without reading its values
* fetch: read a HeadersInit record accessor with the object as its this
* fetch: a HeadersInit record includes its non-enumerable own properties
* http: destroy(error) on IncomingMessage and ServerResponse
- http: destroy(error) on IncomingMessage and ServerResponse.
* http: pin the destroy(error) late-listener ordering
* http: report destroy(error) to the server's clientError listeners
* http: drop the retained destroy error when its event fires
* http: reject a for-await body with the destroy error
* Project declarations for workspace packages registered as npm-static
- decl-projection: a workspace package's declarations count as a package's.
* decl-origin: a workspace package's nested package.json is not its root
* Preserve object aliases and shared ArrayBuffers in structuredClone
- structuredClone preserves aliases and shares cloned buffers.
* structuredClone keeps its per-call alias tables in identity hash tables
* structuredClone tells a typed array or DataView apart from its ArrayBuffer
* promises: race over plain entries
- promises: race over plain entries.
* promises: race joins a dynamic entry that holds a promise
* promises: refuse a dynamic race entry that holds a thenable by name
* promises: trace the value a dynamic race entry settles with
* promises: reject a dynamic race entry whose then read throws
* promises: check a dynamic race entry's fulfillment into the declared type
* promises: evaluate every race entry before resolving a dynamic one
* Make Blob reads iterative, validate before allocating, and open with O_CLOEXEC
- Blob: ask a source before allocating its bytes on read.
* Blob: hold a validation frame's window across a stack push
* Format tests/harness/blob-fd-cloexec.test.ts
* Blob: validate only the window a slice reads
* A JS object field another module fills stays checked-dynamic
- A JS object field another module fills stays checked-dynamic.
* A file-scope binding from a dynamic CommonJS export registers
* A narrowed dynamic receiver converts at the dynamic member call
* Assignments to Error program state lower through their slot handlers
* A checked-dynamic local keeps its narrowed static view in field reads
* Warn about a shared FFI manifest's unused bindings, and document packaging
- Warn about a shared FFI manifest's unused bindings, and document packaging.
Co-authored-by: SergiiSharpov <25509495+SergiiSharpov@users.noreply.github.com>
Co-authored-by: espetro <26749475+espetro@users.noreply.github.com>
Fixes#3048Fixes#3531
* Refuse a manifest name the program implements itself
* ffi: keep an ordinary function named by an unused manifest entry
* ffi: leave a scoped overload set to the program when the entry is unused
* compiler: register the FFI name scan with the whole-program facts
* ffi: poison a call only when its declaration was diagnosed
---------
Co-authored-by: SergiiSharpov <25509495+SergiiSharpov@users.noreply.github.com>
Co-authored-by: espetro <26749475+espetro@users.noreply.github.com>
* Lower a push spread over a freshly built source
- array methods: width-coerce a push spread's elements from a fresh source.
* fresh-spread: require the builtin Array.prototype.map, not the name
* Invoke Symbol.toPrimitive with string hint during ToString conversion
- Corpus: an object's Symbol.toPrimitive in string conversions.
* ToPrimitive keeps a borrowed receiver alive across the protocol
* DOMException: propagate a failing name or message conversion
* ToString reads a Symbol.toPrimitive getter once
* An explicit toString on a dynamic object answers the inherited tag
* ToPrimitive: keep receiver retained and read getter once in scr_json
* Corpus: a sole-owner Symbol.toPrimitive getter converted through cluster.fork
* Dynamic error views: an explicit toString answers Error.prototype.toString
* Branch on a run-time shell option in execFileSync
- execFileSync's shell option read at call time.
* Format the shell-source binding in the execFileSync lowering
* execFileSync runtime shell: Node's evaluation and validation order
* Corpus: a runtime shell path with an embedded NUL
* execFileSync runtime shell: refuse a shell path with an embedded NUL
* execFileSync runtime shell: an empty shell string launches the file directly
* ClientRequest.setHeaders accepts a Headers object or a Map
- http: ClientRequest.setHeaders takes a Headers or Map.
* http: setHeaders checks headersSent before it iterates
* tests: pin the refusal of a void-call result read as a value
- tests: pin the refusal of a void-call result read as a value.
* tests: pin parenthesized and for-head void calls as discarded
* tests: pin conditional-statement void arms as discarded
* frontend: refuse a void call's read where the value is dropped or erased
* tests: pin a read conditional arm as refused
* frontend: refuse a void call's read through a callback parameter or alias
* tests: pin the callback parameter read refusal and the kept declaration answer
* frontend: base the void-read refusal on the callee value's declared void type
* tests: pin the destructured, member and optional callback reads
* frontend: keep the refusal for erased callback answers in held slots and indirect callees
* tests: pin the any-slot, element and Map handler reads
* frontend: look through type-only wrappers on a void-typed callee
* tests: pin the non-null asserted callback reads
* frontend: unwrap angle-bracket type assertions on a void-typed callee
* tests: pin the angle-bracket asserted callback read
* frontend: require a non-writable member before an initializer proves undefined
* tests: pin the writable wrapped-initializer member reads
* frontend: refuse a writable member's initializer under a boolean coercion
* tests: pin computed-key and aliased-patch member reads
* Report OpenSSL ASN.1 error codes for malformed DER private keys
- crypto: answer OpenSSL's ASN.1 errors for malformed private DER.
* crypto: report header and value errors for truncated DER fields
* process.send serializes records like JSON.stringify
- child_process: send messages through the JSON walker.
* ipc: keep send's record containers live for the runtime walker
* A conditional whole export keeps the members attached to its value
- A conditional whole export keeps the members attached to its value.
* Format the conditional whole-export detector change
* worker_threads: give a Worker its listener lists
- worker_threads: give a Worker its listener lists.
* worker_threads: drop a worker's event hook with the worker
* worker_threads: detach a Worker's owner hook on both free paths
* worker_threads: keep the owner hook from reading a freed view
* Answer typeof for declared-only globals like Node
- typeof on a name that is only declared (declare global namespace, declare class, declare enum) with no runtime value returns "undefined" instead of throwing or refusing.
- A differential test covers each declaration form against Node.
* Answer typeof for ambient declarations of Node globals
* Answer a Node global's kind under a computed global write
* undici: pass TLS connect options, including checkServerIdentity, through to the connection
- The undici shim's connector hands the caller's TLS options to the TLS dial as undici does, so a certificate-pinning `checkServerIdentity` is applied instead of silently dropped.
- `tls.connect` executes a custom `checkServerIdentity` after chain verification, and a corpus program pins the accepting and rejecting cases against Node.
* tls: give checkServerIdentity a real certificate and Node's verdict rules
* tls: hand the verifier the issuer chain and skip it on a failed chain
* tls: keep a rejected identity rejected after close, and verify the verifier's chain
* native: link the x509 unit wherever TLS links
* stream: answer a readable's Symbol.asyncIterator
- stream: answer a readable's Symbol.asyncIterator.
* stream: answer a stream's Symbol.asyncIterator only where nothing else does
* stream: answer Symbol.asyncIterator for live streams, not cached views
* stream: unregister a stream on every destruction path
* stream: free the live-stream table with its last stream
* stream: an own Symbol.asyncIterator answers even when undefined
* stream: a prototype Symbol.asyncIterator answers even when undefined
* tests: pin an awaited void call read by a truthiness test
- tests: pin an awaited void call read by a truthiness test.
* frontend: keep a truthiness result's checked-dynamic value in its binding
* frontend: require proof for an awaited call through a void member
* tests: pin the awaited promise member test as refused
* modules: resolve a literal dynamic import to shipped JS and dispatch its namespace
- modules: resolve a literal dynamic import to shipped JS and dispatch its namespace.
* modules: skip unnamed exports in the namespace dispatch; drop generated entries
* modules: expose an unnamed default through a dynamic namespace
* modules: answer an anonymous default class through the namespace
* strings: test a self-append's length inline before the cold check
- strings: test a self-append's length inline before the cold check.
* strings: own a throwing result before its poll, and cover the remaining growth paths
* strings: cover the verifier's attack shapes in the corpus
* strings: evaluate the length check before a frozen write's guard
* strings: check the length before a record or class field write's guard
* test: pin the ML-KEM WebCrypto surface and the hash parameter shapes
- test: pin the ML-KEM WebCrypto surface and the hash parameter shapes.
* test: scope the ML-KEM ledger entry to the rows its corpus proves
* test: leave the ContextParams context row unclaimed
* tests: run the new corpus program on the wasm32 lane
- tests: run the new corpus program on the wasm32 lane.
* array: call a field or refuse a wrapped override on base-typed calls
* array: instantiate a generic override from the inherited signature
* array: refuse a base-typed generic override under a prototype redefinition
* Unions with checked-dynamic members in spreads and destructuring
- Join a checked-dynamic answer in a union destructuring.
* Collapse equal union arms after unregistered classes become f64
* Read an absent optional checked-dynamic field as undefined
* Read an absent optional checked-dynamic field through a union projection as undefined