RESOLVED FIXED 240227
[WinCairo] CloseEvent has wasClean=true and no error code when the WebSocket connection got terminated from the server side
https://bugs.webkit.org/show_bug.cgi?id=240227
Summary [WinCairo] CloseEvent has wasClean=true and no error code when the WebSocket ...
Max Schmitt
Reported 2022-05-09 03:56:54 PDT
Repro: ```js // server.js const express = require('express'); const ws = require('ws'); const app = express(); const wsServer = new ws.Server({ noServer: true }); app.get("/", (req, res)=>res.end(` <p>watch console</p> <script> function createWs(){ const ws=new WebSocket("ws://localhost:3003/ws"); ws.onopen = e => console.log("onopen", e); ws.onerror = e => console.error("onerror",e); ws.onclose = e => { console.log("onclose",e,e.code,e.wasClean); document.writeln("onclose with code " + e.code + " wasClean: " + e.wasClean); }; } createWs(); </script> `)); const server = app.listen(3003); server.on('upgrade', (request, socket, head) => { wsServer.handleUpgrade(request, socket, head, socket => { socket.terminate(); }); }); ``` 1. `mkdir tmp` 2. `cd tmp` 3. `npm init -y` 4. `npm install ws express` 5. `node server.js` 6. Navigate to `http://localhost:3003` Expected (Firefox, Chromium): `onclose with code 1006 wasClean: false ` Actual (Epiphany 42.1, Custom WebKit on tip-of-tree): `onclose with code 0 wasClean: true` Downstream bug: https://github.com/microsoft/playwright/issues/12353
Attachments
WIP patch (589 bytes, patch)
2023-02-06 13:57 PST, Fujii Hironori
no flags
server.js (781 bytes, text/javascript)
2023-02-06 16:35 PST, Fujii Hironori
no flags
Max Schmitt
Comment 1 2023-02-03 12:28:06 PST
Looks like this is fixed on Linux now and is only present in Windows.
Fujii Hironori
Comment 2 2023-02-06 13:57:23 PST
Created attachment 464871 [details] WIP patch
Fujii Hironori
Comment 3 2023-02-06 16:35:09 PST
Created attachment 464879 [details] server.js WinCairo WK1 can't load the page because it has no Content-Type responose header. Modified server.js. I confirmed WinCairo WK1 works fine.
Fujii Hironori
Comment 4 2023-02-06 17:50:56 PST
EWS
Comment 5 2023-02-08 12:03:26 PST
Committed 260025@main (42847605cf96): <https://commits.webkit.org/260025@main> Reviewed commits have been landed. Closing PR #9728 and removing active labels.
Radar WebKit Bug Importer
Comment 6 2023-02-08 12:04:22 PST
Note You need to log in before you can comment on or make changes to this bug.