ladybird/Tests/LibWeb/Text/input/WebSocket/WebSocket-gc.html
sideshowbarker aabd3cd5fe Tests: Run a local WebSocket echo server in place of the hosted one
Problem: Our WebSocket tests were connecting to an externally-hosted
echo server — so they depended on network reachability from our CI
runners. Any network hiccups between a runner and that server timed the
tests out — and that’s been a relatively-frequent source of CI flakes.

Fix: Teach our existing in-tree echo server to also speak WebSocket. It
performs the RFC 6455 handshake, and echoes every text or binary frame
back — on the same OS-assigned port already exposed to tests. Updated
our tests to connect to that local server, not the remote one.

Also, updated our WebSocket echo.html to drive the exchange from its
onopen handler — rather than waiting for a server-initiated greeting.
That’s because: A frame the server sends in the moment right after the
handshake — before the client has sent anything — is currently delivered
unreliably by our (curl-backed) WebSocket client. See issue #9776.
2026-05-31 14:08:50 +02:00

22 lines
499 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
asyncTest((done) => {
{
const ws = new WebSocket(`ws://localhost:${internals.getEchoServerPort()}/`);
ws.onopen = () => {
};
ws.onmessage = () => {
};
ws.onerror = () => {
};
}
setTimeout(() => {
internals.gc();
println("PASS! (Didn't crash)");
done();
}, 0);
});
</script>