From 5c84ed6315c67327e9836263bfc00093a8144992 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 2 Feb 2022 16:24:43 -0800 Subject: [PATCH 1/2] [js-api] Throw RangeError when getArg's index is out of bounds Closes #184. --- document/js-api/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index b06b50c3..6f0bf0a2 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -1293,7 +1293,7 @@ The getArg(|exceptionTag|, |index|) 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|]). From 38e2d7be5c7f280f3b5209d7441edb11f414242c Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Thu, 3 Feb 2022 13:36:37 -0800 Subject: [PATCH 2/2] Fix getArg.tentative.any.js --- test/js-api/exception/getArg.tentative.any.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/js-api/exception/getArg.tentative.any.js b/test/js-api/exception/getArg.tentative.any.js index 4b72c61f..f0a568a8 100644 --- a/test/js-api/exception/getArg.tentative.any.js +++ b/test/js-api/exception/getArg.tentative.any.js @@ -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");