Skip to content

fix(tests): bind test server to loopback so Firefox/WebKit can connect#200

Open
SamJB123 wants to merge 1 commit into
cloudflare:mainfrom
SamJB123:fix/test-server-loopback-bind
Open

fix(tests): bind test server to loopback so Firefox/WebKit can connect#200
SamJB123 wants to merge 1 commit into
cloudflare:mainfrom
SamJB123:fix/test-server-loopback-bind

Conversation

@SamJB123

Copy link
Copy Markdown

The global test server called httpServer.listen(0) with no host, so on dual-stack hosts Node binds the IPv6 wildcard ::. That address is then provided to clients verbatim as testServerHost, so tests connect to http://[::]:PORT / ws://[::]:PORT.

Chromium tolerates connecting to the wildcard [::], but Firefox and WebKit reject it, causing the browsers-without-using project to fail deterministically on those engines:

  • HTTP requests > can perform a batch HTTP request (NetworkError / Load failed)
  • WebSockets > can open a WebSocket connection (WebSocket connection failed)

Bind explicitly to 127.0.0.1 so every engine gets a concrete loopback target. Passing a host makes listen() take the async DNS-resolution path, so we await the "listening" event before reading address() (with no host, binding was synchronous).

Verified on macOS: Firefox and WebKit go from failing those two tests to passing; node and workerd are unaffected.

The global test server called `httpServer.listen(0)` with no host, so on
dual-stack hosts Node binds the IPv6 wildcard `::`. That address is then
provided to clients verbatim as `testServerHost`, so tests connect to
`http://[::]:PORT` / `ws://[::]:PORT`.

Chromium tolerates connecting to the wildcard `[::]`, but Firefox and
WebKit reject it, causing the `browsers-without-using` project to fail
deterministically on those engines:

  - HTTP requests > can perform a batch HTTP request  (NetworkError / Load failed)
  - WebSockets > can open a WebSocket connection      (WebSocket connection failed)

Bind explicitly to `127.0.0.1` so every engine gets a concrete loopback
target. Passing a host makes `listen()` take the async DNS-resolution
path, so we await the "listening" event before reading `address()` (with
no host, binding was synchronous).

Verified on macOS: Firefox and WebKit go from failing those two tests to
passing; node and workerd are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5bb8bf1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@SamJB123

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 24, 2026
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