( request: Request, id: number, tag: string, typedArray: $ArrayBufferView, debug: boolean, )
| 4499 | } |
| 4500 | |
| 4501 | function emitTypedArrayChunk( |
| 4502 | request: Request, |
| 4503 | id: number, |
| 4504 | tag: string, |
| 4505 | typedArray: $ArrayBufferView, |
| 4506 | debug: boolean, |
| 4507 | ): void { |
| 4508 | if (enableTaint) { |
| 4509 | if (TaintRegistryByteLengths.has(typedArray.byteLength)) { |
| 4510 | // If we have had any tainted values of this length, we check |
| 4511 | // to see if these bytes matches any entries in the registry. |
| 4512 | const tainted = TaintRegistryValues.get( |
| 4513 | binaryToComparableString(typedArray), |
| 4514 | ); |
| 4515 | if (tainted !== undefined) { |
| 4516 | throwTaintViolation(tainted.message); |
| 4517 | } |
| 4518 | } |
| 4519 | } |
| 4520 | if (debug) { |
| 4521 | request.pendingDebugChunks++; |
| 4522 | } else { |
| 4523 | request.pendingChunks++; // Extra chunk for the header. |
| 4524 | } |
| 4525 | // TODO: Convert to little endian if that's not the server default. |
| 4526 | const binaryChunk = typedArrayToBinaryChunk(typedArray); |
| 4527 | const binaryLength = byteLengthOfBinaryChunk(binaryChunk); |
| 4528 | const row = id.toString(16) + ':' + tag + binaryLength.toString(16) + ','; |
| 4529 | const headerChunk = stringToChunk(row); |
| 4530 | if (__DEV__ && debug) { |
| 4531 | request.completedDebugChunks.push(headerChunk, binaryChunk); |
| 4532 | } else { |
| 4533 | request.completedRegularChunks.push(headerChunk, binaryChunk); |
| 4534 | } |
| 4535 | } |
| 4536 | |
| 4537 | function emitTextChunk( |
| 4538 | request: Request, |
no test coverage detected