-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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.
0133258
to
1837b1b
Compare
This comment has been minimized.
This comment has been minimized.
}; | ||
|
||
function typedArrayToBase64(array: any) { | ||
if (globalThis.Buffer) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
packages/playwright-core/src/server/isomorphic/utilityScriptSerializers.ts
Outdated
Show resolved
Hide resolved
packages/playwright-core/src/server/isomorphic/utilityScriptSerializers.ts
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"1 failed 7 flaky38029 passed, 650 skipped Merge workflow run. |
Based on https://gist.github.com/pavelfeldman/4c7826893182ac9f85cc60ddbd7b2d11