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

WebIDL: use TypedArray #31064

Closed
gterzian opened this issue Jan 11, 2024 · 2 comments
Closed

WebIDL: use TypedArray #31064

gterzian opened this issue Jan 11, 2024 · 2 comments
Labels
A-content/script Related to the script thread I-safety Some piece of code violates memory safety guarantees.

Comments

@gterzian
Copy link
Member

gterzian commented Jan 11, 2024

As as follow-up to #30990, we should do the same for other typed arrays.

The list is found at

Types.ArrayBuffer: IDLType.Tags.interface,

See the various arrays which currently default to IDLType.Tags.interface, and which currently all fallback to using a JSObject in codegen. Each should be changed to use it's own type, like was done in the linked-to PR for FLoat32Array. Note that not all may be currently used by Servo, to find out if they are, search for it in *.webidl files.

Each could be done independently, although it might make sense to investigate making components/script/dom/bindings/typedarrays.rs generic first.

If the typed array is currently stored in a Heap, then a wrapper like HeapFloat32Array would be useful, otherwise the unsafe code can simply be hidden behind utilities, such as create_float32_array

The actual typed array JS types are found at https://github.com/servo/mozjs/blob/7184f658b7e2de8a8d288ff39001364513115782/mozjs/src/typedarray.rs

part of #30862

@gterzian gterzian added I-safety Some piece of code violates memory safety guarantees. A-content/script Related to the script thread labels Jan 11, 2024
@gterzian gterzian changed the title WebIDL: use ArrayBuffer WebIDL: use TypedArray Jan 11, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 25, 2024
…ebIDL (#31164)

<!-- Please describe your changes on the following line: -->

part #31064

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because there is no behavior
changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->

There types are not used we can migrate them, in next PR I will make
`HeapFloat32Array` generic and convert ArrayBufferView, ArrayBuffer,
Uint8ClampedArray and Float64Array.

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
@Taym95
Copy link
Contributor

Taym95 commented Feb 18, 2024

@gterzian @mrobinson this issue can be closed now.

@gterzian
Copy link
Member Author

@Taym95 thanks a lot for the contrib!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/script Related to the script thread I-safety Some piece of code violates memory safety guarantees.
Projects
None yet
Development

No branches or pull requests

3 participants