Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support typed arrays in indexeddb #34949

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Feb 27, 2025

@Skn0tt Skn0tt self-assigned this Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This pull request adds support for typed arrays in IndexedDB storage by extending the serialization and deserialization logic, updating relevant tests, and removing outdated documentation.

  • Introduces new types, functions, and handling for converting typed arrays to/from base64 strings.
  • Updates tests to store and retrieve typed arrays instead of regular strings.
  • Removes the documentation note that previously mentioned a lack of support for typed arrays.

Reviewed Changes

File Description
packages/playwright-core/src/server/isomorphic/utilityScriptSerializers.ts Adds typed array type definitions, conversion utilities, and updates parser logic.
tests/library/browsercontext-storage-state.spec.ts Modifies test cases to use typed arrays for IndexedDB operations.
docs/src/api/class-browsercontext.md Removes outdated note about lack of typed array support.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

@Skn0tt Skn0tt force-pushed the indexeddb-typed-arrays branch from 0133258 to 1837b1b Compare February 27, 2025 13:31

This comment has been minimized.

};

function typedArrayToBase64(array: any) {
if (globalThis.Buffer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have Node-specific code? It seems like btoa/atob should work both in the browser and in the Node.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question! I mostly copied from @pavelfeldman's gist. Pavel, why?

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

1 failed
❌ [firefox-library] › tests/library/browsercontext-storage-state.spec.ts:79:3 › should round-trip through the file @firefox-ubuntu-22.04-node18

7 flaky ⚠️ [firefox-library] › tests/library/inspector/cli-codegen-aria.spec.ts:76:7 › should update aria snapshot highlight @firefox-ubuntu-22.04-node18
⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-trace.spec.ts:341:5 › should work behind reverse proxy @macos-latest-node18-1
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:82:5 › click should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:107:5 › fill should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:161:5 › waitFor should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

38029 passed, 650 skipped
✔️✔️✔️

Merge workflow run.

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