Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/libwebsocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ var LibraryWebSocket = {
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},

emscripten_websocket_new__deps: ['$WS'],
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emscripten_websocket_new only references the webSockets handle allocator (it doesn't use the WS helper object). Depending on $WS will also pull in malloc via $WS__deps, which can unnecessarily increase code size for minimal builds that only call emscripten_websocket_new. Consider changing this dependency to $webSockets (or otherwise avoid bringing in malloc) so the fix is minimal and directly matches what the function uses.

Suggested change
emscripten_websocket_new__deps: ['$WS'],
emscripten_websocket_new__deps: ['$webSockets'],

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a missing dependency edge case (calling emscripten_websocket_new without any other websocket APIs). To prevent regressions, please consider adding a focused test that only links/calls emscripten_websocket_new (e.g., compile a tiny C program with -lwebsocket and run it) and asserts it doesn't throw ReferenceError: webSockets is not defined.

Suggested change
emscripten_websocket_new__deps: ['$WS'],
emscripten_websocket_new__deps: ['$WS', '$webSockets'],

Copilot uses AI. Check for mistakes.
emscripten_websocket_new__proxy: 'sync',
emscripten_websocket_new: (createAttributes) => {
if (!globalThis.WebSocket) {
Expand Down