Skip to content

#3598 Navigator and encoding stream global shape parity#3650

Open
andrewtdiz wants to merge 14 commits into
PerryTS:mainfrom
andrewtdiz:codex/3598-navigator-urlpattern-streams
Open

#3598 Navigator and encoding stream global shape parity#3650
andrewtdiz wants to merge 14 commits into
PerryTS:mainfrom
andrewtdiz:codex/3598-navigator-urlpattern-streams

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Refs #3598

Summary

  • Exposes Navigator as a global constructor shape for the existing globalThis.navigator singleton, including constructor/prototype identity, instanceof Navigator, and Node-like illegal construction.
  • Splits TextEncoderStream and TextDecoderStream allocation so each instance keeps the correct constructor identity, class id, prototype constructor, and instanceof behavior while preserving the existing readable/writable stub shape.
  • Adds deterministic Node baseline fixtures for navigator and encoding stream constructor/instance identity.
  • Documents URLPattern as intentionally absent while Perry advertises a Node 22 target.

Verification

  • git fetch origin main and git merge-base --is-ancestor origin/main HEAD returned success.
  • cargo fmt --check
  • cargo check -q -p perry-runtime -p perry-hir -p perry-codegen
  • cargo test -q -p perry-runtime navigator_global_constructor_identity_shape -- --nocapture
  • cargo test -q -p perry-runtime text_encoding_stream_globals_construct_readable_writable_shape -- --nocapture
  • Node baselines for:
    • test-parity/node-suite/globals/navigator-constructor-identity.ts
    • test-parity/node-suite/stream/web/text-encoding-stream-constructor-identity.ts
  • git diff --check

I also accidentally invoked ./run_parity_tests.sh --help; it entered the broad release-build parity path, so I stopped it before fixture output per the bounded-verification coordination note.

Remaining Work

  • URLPattern stays absent in this PR; adding the global and parser should be handled when/if Perry targets Node 24+ semantics.
  • Encoding streams still expose only the modest constructor/prototype/instance/readable/writable shape here; full transform encode/decode stream behavior is left for a dedicated follow-up.
  • This PR does not touch the URL/URLSearchParams/TextEncoder/TextDecoder constructor-exposure slice from draft PR Expose URL and encoding globals for #3598 #3631 or the queueMicrotask/Promise FIFO branch.

@andrewtdiz andrewtdiz force-pushed the codex/3598-navigator-urlpattern-streams branch 6 times, most recently from d98e9bb to 9ef97d2 Compare May 31, 2026 20:06
@andrewtdiz andrewtdiz force-pushed the codex/3598-navigator-urlpattern-streams branch from 9ef97d2 to fd4d571 Compare May 31, 2026 20:22
@andrewtdiz andrewtdiz marked this pull request as ready for review May 31, 2026 20:57
Ralph Kuepper added 9 commits June 1, 2026 08:56
# Conflicts:
#	crates/perry-hir/src/analysis/builtins.rs
#	crates/perry-runtime/src/object/instanceof.rs
#	crates/perry-runtime/src/object/tests.rs
#	docs/api/perry.d.ts
#	docs/src/api/reference.md
# Conflicts:
#	scripts/check_file_size.sh
# Conflicts:
#	crates/perry-hir/src/analysis/builtins.rs
populate_global_this_builtins() ran during js_get_global_this()'s lazy
init (before GLOBAL_THIS_READY is set). The new navigator path called
js_navigator_object(), which re-fetched the Navigator constructor via
js_get_global_this_builtin_value -> js_get_global_this, re-entering the
in-progress init and recursing/spinning forever. This hung cargo-test
(observed when the navigator + encoding-stream identity tests run
concurrently) and was the cause of the cancelled CI runs.

Read the already-installed Navigator constructor off the singleton and
hand it to navigator_object_with_constructor() directly instead.

Also add Navigator to builtin_constructor_spec_length so Navigator.length
reports 0 (matches Node), fixing the navigator-constructor-identity
parity fixture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant