servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 117 forks source link

Add bindings for DataView typed array #406

Open jdm opened 6 years ago

jdm commented 6 years ago

It will be very similar to the ArrayBufferView typed array bindings.

anthgur commented 6 years ago

@jdm I think this might be a prerequisite to https://github.com/servo/servo/issues/20417 so I can take a crack at it too.

jdm commented 6 years ago

So it looks like we can't reuse the macro because the JS API for DataView objects functions a little differently. We'll need to hand-write this implementation to use UnwrapArrayBuffer, these functions, and this implementation using this function. At that point we should be able to reuse the array_alias! macro

aditj commented 5 years ago

@jdm Can I work on this in an attempt to fix servo/servo issue #20417

aditj commented 5 years ago

@jdm Can I work on this in an attempt to fix servo/servo issue #20417

Also if yes, can you maybe tell me is there a dxr tree for the same? :grin: :sweat_smile:

jdm commented 5 years ago

Absolutely. I'm pretty sure the answer to your DXR question is no, though, since the version of mozjs that we're using is at least 6 months older than the version in DXR/searchfox.

aditj commented 5 years ago

@jdm Should I start by creating a macro rule for creating DataView element (like the one typed array element have)?

jdm commented 5 years ago

Sure.

aditj commented 5 years ago

@jdm I think the DataView element would be similar to the typed array element ,any properties that you think should be added? Also, should I also write DataView Array structure? (And create a seperate array_alias macro for DataView Array)

jdm commented 5 years ago

@aditj I do not believe we need a separate DataViewArray structure. We should be able to use the existing TypedArray structure without any changes; we just need to define an implementation of TypedArrayElement and TypedArrayElementCreator that uses the DataView APIs.