Skip to content

Commit 0fd3d78

Browse files
samueldeadprogram
authored andcommitted
syscall/js: allow copyBytesTo(Go|JS) to use Uint8ClampedArray
From golang/go@f0e8b81 Fixes #1941
1 parent b9c0aa7 commit 0fd3d78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

targets/wasm_exec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424

425425
const dst = loadSlice(dest_addr, dest_len);
426426
const src = loadValue(source_addr);
427-
if (!(src instanceof Uint8Array)) {
427+
if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {
428428
mem().setUint8(returned_status_addr, 0); // Return "not ok" status
429429
return;
430430
}
@@ -443,7 +443,7 @@
443443

444444
const dst = loadValue(dest_addr);
445445
const src = loadSlice(source_addr, source_len);
446-
if (!(dst instanceof Uint8Array)) {
446+
if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {
447447
mem().setUint8(returned_status_addr, 0); // Return "not ok" status
448448
return;
449449
}

0 commit comments

Comments
 (0)