(readData)
| 365 | } |
| 366 | } |
| 367 | parseMessage(readData) { |
| 368 | let dataLength = TypedArrayPrototypeGetLength(readData); |
| 369 | if (this.#pendingPartialV8Header) { |
| 370 | readData = Buffer.concat([TypedArrayPrototypeSubarray(v8Header, 0, 1), readData]); |
| 371 | dataLength = TypedArrayPrototypeGetLength(readData); |
| 372 | this.#pendingPartialV8Header = false; |
| 373 | } |
| 374 | |
| 375 | if (dataLength === 0) return; |
| 376 | const partialV8Header = readData[dataLength - 1] === v8Header[0]; |
| 377 | |
| 378 | if (partialV8Header) { |
| 379 | // This will break if v8Header length (2 bytes) is changed. |
| 380 | // However it is covered by tests. |
| 381 | readData = TypedArrayPrototypeSubarray(readData, 0, dataLength - 1); |
| 382 | dataLength--; |
| 383 | } |
| 384 | |
| 385 | if (dataLength > 0) { |
| 386 | if (this.#rawBuffer[0] && TypedArrayPrototypeGetLength(this.#rawBuffer[0]) < kSerializedSizeHeader) { |
| 387 | this.#rawBuffer[0] = Buffer.concat([this.#rawBuffer[0], readData]); |
| 388 | } else { |
| 389 | ArrayPrototypePush(this.#rawBuffer, readData); |
| 390 | } |
| 391 | this.#rawBufferSize += dataLength; |
| 392 | this.#processRawBuffer(); |
| 393 | } |
| 394 | |
| 395 | if (partialV8Header) { |
| 396 | this.#pendingPartialV8Header = true; |
| 397 | } |
| 398 | } |
| 399 | #drainRawBuffer() { |
| 400 | if (this.#pendingPartialV8Header) { |
| 401 | ArrayPrototypePush(this.#rawBuffer, TypedArrayPrototypeSubarray(v8Header, 0, 1)); |
no test coverage detected