]> Cypherpunks repositories - gostls13.git/commit
syscall/js: replace TypedArrayOf with CopyBytesToGo/CopyBytesToJS
authorRichard Musiol <mail@richard-musiol.de>
Wed, 15 May 2019 23:03:10 +0000 (01:03 +0200)
committerRichard Musiol <neelance@gmail.com>
Fri, 24 May 2019 09:38:37 +0000 (09:38 +0000)
commitc468ad04177c422534ad1ed4547295935f84743d
treea892aa5b0b50f530a4adfe67f8fabff53730ec51
parent7e5bc4775f12a5612a2f0bea1322af4bb8b24892
syscall/js: replace TypedArrayOf with CopyBytesToGo/CopyBytesToJS

The typed arrays returned by TypedArrayOf were backed by WebAssembly
memory. They became invalid each time we grow the WebAssembly memory.
This made them very error prone and hard to use correctly.

This change removes TypedArrayOf completely and instead introduces
CopyBytesToGo and CopyBytesToJS for copying bytes between a byte
slice and an Uint8Array. This breaking change is still allowed for
the syscall/js package.

Fixes #31980.
Fixes #31812.

Change-Id: I14c76fdd60b48dd517c1593972a56d04965cb272
Reviewed-on: https://go-review.googlesource.com/c/go/+/177537
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/wasm/wasm_exec.js
src/crypto/cipher/xor_test.go
src/crypto/rand/rand_js.go
src/net/http/roundtrip_js.go
src/syscall/fs_js.go
src/syscall/js/js.go
src/syscall/js/js_js.s
src/syscall/js/js_test.go
src/syscall/js/typedarray.go [deleted file]