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

[js-api] Throw RangeError when getArg's index is out of bounds #196

Merged
merged 3 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ The <dfn method for="Exception">getArg(|exceptionTag|, |index|)</dfn> method ste
1. Throw a {{TypeError}}.
1. Let |payload| be **this**.\[[Payload]].
1. If |index| ≥ |payload|'s [=list/size=],
1. Throw a {{TypeError}}.
1. Throw a {{RangeError}}.
1. Return [=ToJSValue=](|payload|[|index|]).

</div>
Expand Down
2 changes: 1 addition & 1 deletion test/js-api/exception/getArg.tentative.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test(() => {
const tag = new WebAssembly.Tag({ parameters: [] });
const exn = new WebAssembly.Exception(tag, []);
for (const value of outOfRangeValues) {
assert_throws_js(TypeError, () => exn.getArg(tag, value));
assert_throws_js(RangeError, () => exn.getArg(tag, value));
}
}, "Getting out-of-range argument");

Expand Down