Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit c61da44

Browse files
authored
Fix small issues in the JS API (#78)
1 parent d8f6d8e commit c61da44

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

document/js-api/index.bs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ enum IndexType {
569569
"i64",
570570
};
571571

572-
typedef ([EnforceRange] unsigned long long or bigint) IndexValue;
572+
typedef ([EnforceRange] unsigned long or bigint) IndexValue;
573573

574574
dictionary ModuleExportDescriptor {
575575
required USVString name;
@@ -683,7 +683,7 @@ dictionary MemoryDescriptor {
683683
[LegacyNamespace=WebAssembly, Exposed=*]
684684
interface Memory {
685685
constructor(MemoryDescriptor descriptor);
686-
unsigned long grow(IndexValue delta);
686+
IndexValue grow(IndexValue delta);
687687
ArrayBuffer toFixedLengthBuffer();
688688
ArrayBuffer toResizableBuffer();
689689
readonly attribute ArrayBuffer buffer;
@@ -792,7 +792,8 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
792792
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
793793
1. Let |indextype| be the [=index type=] in [=mem_type=](|store|, |memaddr|).
794794
1. Let |delta64| be [=?=] [=IndexValueToU64=](|delta|, |indextype|).
795-
1. Return the result of [=grow the memory buffer|growing the memory buffer=] associated with |memaddr| by |delta64|.
795+
1. Let |ret| be the result of [=grow the memory buffer|growing the memory buffer=] associated with |memaddr| by |delta64|.
796+
1. Return [=U64ToIndexValue=](|ret|, |indextype|).
796797
</div>
797798

798799
Immediately after a WebAssembly [=memory.grow=] instruction executes, perform the following steps:
@@ -1364,7 +1365,9 @@ The algorithm <dfn>IndexValueToU64</dfn>(|v|, |indextype|) asserts that a JavaSc
13641365
1. Otherwise, [=throw=] a {{TypeError}}.
13651366
1. Else if |indextype| is "i64",
13661367
1. If |v| [=is a BigInt=],
1367-
1. If |v| is not equal to [=!=] [$ToBigUint64$](|v|), [=throw=] a {{RangeError}}.
1368+
1. If |v| is not equal to [=!=] [$ToBigUint64$](|v|), [=throw=] a {{TypeError}}.
1369+
1370+
Note: This operation is designed to mirror [=[EnforceRange]=], which [=throws=] a {{TypeError}} for out-of-range numeric values.
13681371
1. Return [=ℝ=](|v|) as a WebAssembly [=u64=].
13691372
1. Otherwise, [=throw=] a {{TypeError}}.
13701373
1. Assert: This step is not reached.

0 commit comments

Comments
 (0)