Skip to content

Conversation

@Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Mar 27, 2025

Fixes PWTEST_MODE=service npm run ctest -- page-evaluate:97.

@Skn0tt Skn0tt requested a review from mxschmitt March 27, 2025 11:25
@Skn0tt Skn0tt self-assigned this Mar 27, 2025
@mxschmitt
Copy link
Contributor

For future reference:

This change corrects the byte length calculation for typed arrays. In typed arrays, the length parameter represents the number of elements, not the total number of bytes. Different typed arrays have different bytes per element (e.g., Int8Array uses 1 byte, Int16Array uses 2 bytes, Int32Array uses 4 bytes).
By dividing value.ta.b.length by ctor.BYTES_PER_ELEMENT, the code now correctly creates the typed array with the right number of elements, rather than potentially creating an array with an incorrect number of elements based on total byte length.
This is a subtle but important fix to ensure that typed arrays are reconstructed correctly during serialization and deserialization.

@github-actions
Copy link
Contributor

Test results for "tests 1"

3 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:424:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [chromium-library] › tests/library/inspector/cli-codegen-1.spec.ts:23:7 › cli codegen › should click @ubuntu-22.04-chromium-tip-of-tree
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

38888 passed, 805 skipped
✔️✔️✔️

Merge workflow run.

@Skn0tt Skn0tt merged commit f5a7465 into microsoft:main Mar 27, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants