MCPcopy Index your code
hub / github.com/facebook/react / emitTypedArrayChunk

Function emitTypedArrayChunk

packages/react-server/src/ReactFlightServer.js:4501–4535  ·  view source on GitHub ↗
(
  request: Request,
  id: number,
  tag: string,
  typedArray: $ArrayBufferView,
  debug: boolean,
)

Source from the content-addressed store, hash-verified

4499}
4500
4501function 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
4537function emitTextChunk(
4538 request: Request,

Callers 3

serializeTypedArrayFunction · 0.85
serializeDebugTypedArrayFunction · 0.85
emitChunkFunction · 0.85

Calls 9

typedArrayToBinaryChunkFunction · 0.90
byteLengthOfBinaryChunkFunction · 0.90
stringToChunkFunction · 0.90
binaryToComparableStringFunction · 0.85
throwTaintViolationFunction · 0.85
hasMethod · 0.65
getMethod · 0.65
toStringMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected