Skip to content

js_interop changes in 3.6 (master) to JSTypedArray subtypes break passing SharedArrayBuffer as the underlying buffer. #56455

Open
@nullrocket

Description

@nullrocket

A recent change adding constructors to the JSTypedArray subtypes requires a JSArrayBuffer as the buffer argument, however Javascript also allows passing a SharedArrayBuffer.

You can see the change to JSInt32Array here, however it affects all JSTypedArray subtypes.

external JSInt32Array([JSArrayBuffer buffer, int byteOffset, int length]);

This situation around SharedArrayBuffers vs ArrayBuffers breaks occasionaly and I have had workarounds that I have used in the past after opening related issues, so I test it regularly now with the latest versions to make sure I have a heads up on future breaking changes.

I get that it is hard to test using the current dart test package so I created a repo that can reproduce the issue and test it using a fork of the test package specified in dependency_overrides that sets the correct headers to allow SharedArrayBuffer to work on browser tests.

Here is the repo with minimal tests if you want a reproduction. try it with dart 3.4 (stable) or 3.5 (beta) ( both pass) . dart 3.6 (master) fails.

https://github.com/nullrocket/js_typed_array_with_sab_and_atomics

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dart2js-interceptorstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)web-dev-compilerweb-js-interopIssues that impact all js interop

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions