Skip to content

Commit

Permalink
websocket: don't clone buffer (#3240)
Browse files Browse the repository at this point in the history
* websocket: don't clone buffer

* Apply suggestions from code review

* fixup

* Apply suggestions from code review
  • Loading branch information
tsctx committed May 10, 2024
1 parent f744596 commit eadf781
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
2 changes: 1 addition & 1 deletion lib/web/websocket/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class WebSocket extends EventTarget {
// not throw an exception must increase the bufferedAmount attribute
// by the length of data’s buffer in bytes.

const ab = new FastBuffer(data, data.byteOffset, data.byteLength)
const ab = new FastBuffer(data.buffer, data.byteOffset, data.byteLength)

const frame = new WebsocketFrameSend(ab)
const buffer = frame.createFrame(opcodes.BINARY)
Expand Down
36 changes: 0 additions & 36 deletions test/wpt/status/websockets.status.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,6 @@
}
}
},
"Send-binary-arraybufferview-float32.any.js": {
"note": "TODO(@KhafraDev): investigate failure",
"fail": [
"Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be closed"
]
},
"Send-binary-arraybufferview-float64.any.js": {
"note": "TODO(@KhafraDev): investigate failure",
"fail": [
"Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be closed"
]
},
"Send-binary-arraybufferview-int16-offset.any.js": {
"note": "TODO(@KhafraDev): investigate failure",
"fail": [
"Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be closed"
]
},
"Send-binary-arraybufferview-int32.any.js": {
"note": "TODO(@KhafraDev): investigate failure",
"fail": [
"Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be closed"
]
},
"Send-binary-arraybufferview-uint16-offset-length.any.js": {
"note": "TODO(@KhafraDev): investigate failure",
"fail": [
"Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be closed"
]
},
"Send-binary-arraybufferview-uint32-offset.any.js": {
"note": "TODO(@KhafraDev): investigate failure",
"fail": [
"Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be closed"
]
},
"Create-on-worker-shutdown.any.js": {
"skip": true,
"//": "Node.js workers are different from web workers & don't work with blob: urls"
Expand Down

0 comments on commit eadf781

Please sign in to comment.