[Webkit-unassigned] [Bug 240227] New: CloseEvent has wasClean=true and no code when the Websocket connection got terminated from the server side

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 9 03:56:54 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=240227

            Bug ID: 240227
           Summary: CloseEvent has wasClean=true and no code when the
                    Websocket connection got terminated from the server
                    side
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: max at schmitt.mx
                CC: bugs-noreply at webkitgtk.org

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220509/891acbaa/attachment.htm>


More information about the webkit-unassigned mailing list