aboutsummaryrefslogtreecommitdiff
path: root/misc/wasm
diff options
context:
space:
mode:
authorAurélio A. Heckert <aurium@gmail.com>2020-03-22 20:38:42 -0300
committerRichard Musiol <neelance@gmail.com>2020-03-24 10:31:12 +0000
commitf0e8b81aa34120e21642c569912bde00ccd33393 (patch)
tree84f8030fba8d3e1a74e5c777bae59123b6d754a7 /misc/wasm
parent6a9d850b82172225b55bd65e830b1e325b17a724 (diff)
downloadgo-f0e8b81aa34120e21642c569912bde00ccd33393.tar.gz
go-f0e8b81aa34120e21642c569912bde00ccd33393.zip
syscall/js: allow copyBytesTo(Go|JS) to use Uint8ClampedArray
closes #38011 Change-Id: Ic50f2f27456dccdc3fca1bda076871af1eb81705 Reviewed-on: https://go-review.googlesource.com/c/go/+/224638 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Richard Musiol <neelance@gmail.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'misc/wasm')
-rw-r--r--misc/wasm/wasm_exec.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/wasm/wasm_exec.js b/misc/wasm/wasm_exec.js
index 5ac4032993..8cb297f379 100644
--- a/misc/wasm/wasm_exec.js
+++ b/misc/wasm/wasm_exec.js
@@ -447,7 +447,7 @@
"syscall/js.copyBytesToGo": (sp) => {
const dst = loadSlice(sp + 8);
const src = loadValue(sp + 32);
- if (!(src instanceof Uint8Array)) {
+ if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {
this.mem.setUint8(sp + 48, 0);
return;
}
@@ -461,7 +461,7 @@
"syscall/js.copyBytesToJS": (sp) => {
const dst = loadValue(sp + 8);
const src = loadSlice(sp + 16);
- if (!(dst instanceof Uint8Array)) {
+ if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {
this.mem.setUint8(sp + 48, 0);
return;
}