<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[288065] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/288065">288065</a></dd>
<dt>Author</dt> <dd>ysuzuki@apple.com</dd>
<dt>Date</dt> <dd>2022-01-15 13:32:37 -0800 (Sat, 15 Jan 2022)</dd>
</dl>

<h3>Log Message</h3>
<pre>[JSC] Fix misc issues in WebAssembly.Exception
https://bugs.webkit.org/show_bug.cgi?id=235261

Reviewed by Alexey Shvayka.

JSTests:

* wasm/stress/create-tag-from.js:
* wasm/v8/exceptions-api.js:
(TestGetArg):

LayoutTests/imported/w3c:

Remove web-platform-tests/wasm/jsapi/exception/type.tentative.any.js test since
this behavior is not defined in wasm exception-handling and/or wasm js-types spec.
Probably this test was confused with WebAssembly.Tag (and that test is in wasm/jsapi/tag/).

Also change RangeError to TypeError according to the spec[1].

[1]: https://webassembly.github.io/exception-handling/js-api/index.html#dom-exception-getarg

* web-platform-tests/wasm/jsapi/exception/getArg.tentative.any-expected.txt:
* web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.js:
(test):
* web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.worker-expected.txt:
* web-platform-tests/wasm/jsapi/exception/toString.tentative.any-expected.txt:
* web-platform-tests/wasm/jsapi/exception/toString.tentative.any.worker-expected.txt:
* web-platform-tests/wasm/jsapi/exception/type.tentative.any-expected.txt: Removed.
* web-platform-tests/wasm/jsapi/exception/type.tentative.any.html: Removed.
* web-platform-tests/wasm/jsapi/exception/type.tentative.any.js: Removed.
* web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker-expected.txt: Removed.
* web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker.html: Removed.

Source/JavaScriptCore:

1. Add @toStringTag to WebAssembly.Exception.prototype.
2. Add argument count check for WebAssembly.Exception methods (since it is specified in WebIDL and these methods do not have optional parameters).

* wasm/js/WebAssemblyExceptionPrototype.cpp:
(JSC::WebAssemblyExceptionPrototype::finishCreation):
(JSC::JSC_DEFINE_HOST_FUNCTION):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestswasmstresscreatetagfromjs">trunk/JSTests/wasm/stress/create-tag-from.js</a></li>
<li><a href="#trunkJSTestswasmv8exceptionsapijs">trunk/JSTests/wasm/v8/exceptions-api.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiongetArgtentativeanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiongetArgtentativeanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiongetArgtentativeanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontoStringtentativeanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontoStringtentativeanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any.worker-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorewasmjsWebAssemblyExceptionPrototypecpp">trunk/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionPrototype.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyjs">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyworkerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog  2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/JSTests/ChangeLog     2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2022-01-15  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><ins>+        [JSC] Fix misc issues in WebAssembly.Exception
+        https://bugs.webkit.org/show_bug.cgi?id=235261
+
+        Reviewed by Alexey Shvayka.
+
+        * wasm/stress/create-tag-from.js:
+        * wasm/v8/exceptions-api.js:
+        (TestGetArg):
+
+2022-01-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
</ins><span class="cx">         [JSC] Upgrade test262
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=235263
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkJSTestswasmstresscreatetagfromjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/stress/create-tag-from.js (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/stress/create-tag-from.js     2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/JSTests/wasm/stress/create-tag-from.js        2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -17,6 +17,6 @@
</span><span class="cx"> assert.eq(exception.getArg(tag, 1), 2.5);
</span><span class="cx"> assert.eq(exception.getArg(tag, 2), parameters);
</span><span class="cx"> 
</span><del>-assert.throws(() => exception.getArg(tag, 3), RangeError, "WebAssembly.Exception.getArg(): Index out of range");
</del><ins>+assert.throws(() => exception.getArg(tag, 3), TypeError, "WebAssembly.Exception.getArg(): Index out of range");
</ins><span class="cx"> 
</span><span class="cx"> assert.eq(WebAssembly.Exception.prototype.__proto__, Object.prototype)
</span></span></pre></div>
<a id="trunkJSTestswasmv8exceptionsapijs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/wasm/v8/exceptions-api.js (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/wasm/v8/exceptions-api.js  2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/JSTests/wasm/v8/exceptions-api.js     2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">       /First argument must be a WebAssembly.Tag/);
</span><span class="cx">   //assertThrows(() => exception.getArg(tag, undefined), TypeError,
</span><span class="cx">       ///Index must be convertible to a valid number/);
</span><del>-  assertThrows(() => exception.getArg(tag, 0xFFFFFFFF), RangeError,
</del><ins>+  assertThrows(() => exception.getArg(tag, 0xFFFFFFFF), TypeError,
</ins><span class="cx">       /Index out of range/);
</span><span class="cx">   let wrong_tag = new WebAssembly.Tag({parameters: ['i32']});
</span><span class="cx">   assertThrows(() => exception.getArg(wrong_tag, 0), TypeError,
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/ChangeLog    2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,5 +1,32 @@
</span><span class="cx"> 2022-01-15  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><ins>+        [JSC] Fix misc issues in WebAssembly.Exception
+        https://bugs.webkit.org/show_bug.cgi?id=235261
+
+        Reviewed by Alexey Shvayka.
+
+        Remove web-platform-tests/wasm/jsapi/exception/type.tentative.any.js test since
+        this behavior is not defined in wasm exception-handling and/or wasm js-types spec.
+        Probably this test was confused with WebAssembly.Tag (and that test is in wasm/jsapi/tag/).
+
+        Also change RangeError to TypeError according to the spec[1].
+
+        [1]: https://webassembly.github.io/exception-handling/js-api/index.html#dom-exception-getarg
+
+        * web-platform-tests/wasm/jsapi/exception/getArg.tentative.any-expected.txt:
+        * web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.js:
+        (test):
+        * web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.worker-expected.txt:
+        * web-platform-tests/wasm/jsapi/exception/toString.tentative.any-expected.txt:
+        * web-platform-tests/wasm/jsapi/exception/toString.tentative.any.worker-expected.txt:
+        * web-platform-tests/wasm/jsapi/exception/type.tentative.any-expected.txt: Removed.
+        * web-platform-tests/wasm/jsapi/exception/type.tentative.any.html: Removed.
+        * web-platform-tests/wasm/jsapi/exception/type.tentative.any.js: Removed.
+        * web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker-expected.txt: Removed.
+        * web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker.html: Removed.
+
+2022-01-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
</ins><span class="cx">         [JSC] Fix misc WebAssembly.Table issues
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=235262
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiongetArgtentativeanyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any-expected.txt (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any-expected.txt 2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any-expected.txt    2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,11 +1,7 @@
</span><span class="cx"> 
</span><del>-FAIL Missing arguments assert_throws_js: function "() => exn.getArg(tag)" threw object "RangeError: WebAssembly.Exception.getArg(): Index out of range" ("RangeError") expected instance of function "function TypeError() {
-    [native code]
-}" ("TypeError")
</del><ins>+PASS Missing arguments
</ins><span class="cx"> PASS Invalid exception argument
</span><span class="cx"> PASS Index out of bounds
</span><del>-FAIL Getting out-of-range argument assert_throws_js: function "() => exn.getArg(tag, value)" threw object "RangeError: WebAssembly.Exception.getArg(): Index out of range" ("RangeError") expected instance of function "function TypeError() {
-    [native code]
-}" ("TypeError")
</del><ins>+PASS Getting out-of-range argument
</ins><span class="cx"> PASS getArg
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiongetArgtentativeanyjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.js (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.js   2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.js      2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx"> test(() => {
</span><span class="cx">   const tag = new WebAssembly.Tag({ parameters: [] });
</span><span class="cx">   const exn = new WebAssembly.Exception(tag, []);
</span><del>-  assert_throws_js(RangeError, () => exn.getArg(tag, 1));
</del><ins>+  assert_throws_js(TypeError, () => exn.getArg(tag, 1));
</ins><span class="cx"> }, "Index out of bounds");
</span><span class="cx"> 
</span><span class="cx"> test(() => {
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiongetArgtentativeanyworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.worker-expected.txt (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.worker-expected.txt  2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/getArg.tentative.any.worker-expected.txt     2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,11 +1,7 @@
</span><span class="cx"> 
</span><del>-FAIL Missing arguments assert_throws_js: function "() => exn.getArg(tag)" threw object "RangeError: WebAssembly.Exception.getArg(): Index out of range" ("RangeError") expected instance of function "function TypeError() {
-    [native code]
-}" ("TypeError")
</del><ins>+PASS Missing arguments
</ins><span class="cx"> PASS Invalid exception argument
</span><span class="cx"> PASS Index out of bounds
</span><del>-FAIL Getting out-of-range argument assert_throws_js: function "() => exn.getArg(tag, value)" threw object "RangeError: WebAssembly.Exception.getArg(): Index out of range" ("RangeError") expected instance of function "function TypeError() {
-    [native code]
-}" ("TypeError")
</del><ins>+PASS Getting out-of-range argument
</ins><span class="cx"> PASS getArg
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontoStringtentativeanyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any-expected.txt (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any-expected.txt       2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any-expected.txt  2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Object.prototype.toString on an Exception
</span><del>-FAIL @@toStringTag exists on the prototype with the appropriate descriptor assert_own_property: expected property symbol "Symbol(Symbol.toStringTag)" missing
</del><ins>+PASS @@toStringTag exists on the prototype with the appropriate descriptor
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontoStringtentativeanyworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any.worker-expected.txt (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any.worker-expected.txt        2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/toString.tentative.any.worker-expected.txt   2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Object.prototype.toString on an Exception
</span><del>-FAIL @@toStringTag exists on the prototype with the appropriate descriptor assert_own_property: expected property symbol "Symbol(Symbol.toStringTag)" missing
</del><ins>+PASS @@toStringTag exists on the prototype with the appropriate descriptor
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any-expected.txt (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any-expected.txt   2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any-expected.txt      2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,5 +0,0 @@
</span><del>-
-FAIL [] WebAssembly.Exception constructor expects the first argument to be a WebAssembly.Tag
-FAIL [i32 i64] WebAssembly.Exception constructor expects the first argument to be a WebAssembly.Tag
-FAIL [i32 i64 f32 f64] WebAssembly.Exception constructor expects the first argument to be a WebAssembly.Tag
-
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.html (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.html   2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.html      2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-<!-- This file is required for WebKit test infrastructure to run the templated test -->
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyjs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.js (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.js     2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.js        2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,21 +0,0 @@
</span><del>-// META: global=window,dedicatedworker,jsshell
-// META: script=/wasm/jsapi/assertions.js
-
-function assert_type(argument) {
-  const exception = new WebAssembly.Exception(argument);
-  const exceptiontype = exception.type();
-
-  assert_array_equals(exceptiontype.parameters, argument.parameters);
-}
-
-test(() => {
-  assert_type({ "parameters": [] });
-}, "[]");
-
-test(() => {
-  assert_type({ "parameters": ["i32", "i64"] });
-}, "[i32 i64]");
-
-test(() => {
-  assert_type({ "parameters": ["i32", "i64", "f32", "f64"] });
-}, "[i32 i64 f32 f64]");
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyworkerexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker-expected.txt (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker-expected.txt    2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker-expected.txt       2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,5 +0,0 @@
</span><del>-
-FAIL [] WebAssembly.Exception constructor expects the first argument to be a WebAssembly.Tag
-FAIL [i32 i64] WebAssembly.Exception constructor expects the first argument to be a WebAssembly.Tag
-FAIL [i32 i64 f32 f64] WebAssembly.Exception constructor expects the first argument to be a WebAssembly.Tag
-
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestswasmjsapiexceptiontypetentativeanyworkerhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker.html (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker.html    2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/type.tentative.any.worker.html       2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-<!-- This file is required for WebKit test infrastructure to run the templated test -->
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/Source/JavaScriptCore/ChangeLog       2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2022-01-15  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><ins>+        [JSC] Fix misc issues in WebAssembly.Exception
+        https://bugs.webkit.org/show_bug.cgi?id=235261
+
+        Reviewed by Alexey Shvayka.
+
+        1. Add @toStringTag to WebAssembly.Exception.prototype.
+        2. Add argument count check for WebAssembly.Exception methods (since it is specified in WebIDL and these methods do not have optional parameters).
+
+        * wasm/js/WebAssemblyExceptionPrototype.cpp:
+        (JSC::WebAssemblyExceptionPrototype::finishCreation):
+        (JSC::JSC_DEFINE_HOST_FUNCTION):
+
+2022-01-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
</ins><span class="cx">         [JSC] Fix misc WebAssembly.Table issues
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=235262
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorewasmjsWebAssemblyExceptionPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionPrototype.cpp (288064 => 288065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionPrototype.cpp    2022-01-15 21:17:40 UTC (rev 288064)
+++ trunk/Source/JavaScriptCore/wasm/js/WebAssemblyExceptionPrototype.cpp       2022-01-15 21:32:37 UTC (rev 288065)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> /* Source for WebAssemblyExceptionPrototype.lut.h
</span><span class="cx">  @begin prototypeTableWebAssemblyException
</span><span class="cx">  getArg   webAssemblyExceptionProtoFuncGetArg   Function 2
</span><del>- is   webAssemblyExceptionProtoFuncIs   Function 1
</del><ins>+ is       webAssemblyExceptionProtoFuncIs       Function 1
</ins><span class="cx">  @end
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm);
</span><span class="cx">     ASSERT(inherits(vm, info()));
</span><ins>+    JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebAssemblyExceptionPrototype::WebAssemblyExceptionPrototype(VM& vm, Structure* structure)
</span><span class="lines">@@ -106,13 +107,15 @@
</span><span class="cx">         return makeString("WebAssembly.Exception.getArg(): ", message);
</span><span class="cx">     };
</span><span class="cx">     const auto& typeError = [&](const auto& message) {
</span><del>-        throwTypeError(globalObject, throwScope, formatMessage(message));
-        return encodedJSValue();
</del><ins>+        return throwVMTypeError(globalObject, throwScope, formatMessage(message));
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     JSWebAssemblyException* jsException = getException(globalObject, callFrame->thisValue());
</span><del>-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</del><ins>+    RETURN_IF_EXCEPTION(throwScope, { });
</ins><span class="cx"> 
</span><ins>+    if (UNLIKELY(callFrame->argumentCount() < 2))
+        return JSValue::encode(throwException(globalObject, throwScope, createNotEnoughArgumentsError(globalObject)));
+
</ins><span class="cx">     JSWebAssemblyTag* tag = getTag(vm, callFrame->argument(0));
</span><span class="cx">     if (!tag)
</span><span class="cx">         return typeError("First argument must be a WebAssembly.Tag");
</span><span class="lines">@@ -121,10 +124,8 @@
</span><span class="cx">         return typeError("First argument does not match the exception tag");
</span><span class="cx"> 
</span><span class="cx">     uint32_t index = callFrame->argument(1).toUInt32(globalObject);
</span><del>-    if (index >= tag->tag().parameterCount()) {
-        throwRangeError(globalObject, throwScope, formatMessage("Index out of range"));
-        return encodedJSValue();
-    }
</del><ins>+    if (index >= tag->tag().parameterCount())
+        return typeError("Index out of range");
</ins><span class="cx"> 
</span><span class="cx">     RELEASE_AND_RETURN(throwScope, JSValue::encode(jsException->getArg(globalObject, index)));
</span><span class="cx"> }
</span><span class="lines">@@ -135,13 +136,14 @@
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><span class="cx">     JSWebAssemblyException* jsException = getException(globalObject, callFrame->thisValue());
</span><del>-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</del><ins>+    RETURN_IF_EXCEPTION(throwScope, { });
</ins><span class="cx"> 
</span><ins>+    if (UNLIKELY(callFrame->argumentCount() < 1))
+        return JSValue::encode(throwException(globalObject, throwScope, createNotEnoughArgumentsError(globalObject)));
+
</ins><span class="cx">     JSWebAssemblyTag* tag = getTag(vm, callFrame->argument(0));
</span><del>-    if (!tag) {
-        throwTypeError(globalObject, throwScope, "WebAssembly.Exception.is(): First argument must be a WebAssembly.Tag");
-        return encodedJSValue();
-    }
</del><ins>+    if (!tag)
+        return throwVMTypeError(globalObject, throwScope, "WebAssembly.Exception.is(): First argument must be a WebAssembly.Tag");
</ins><span class="cx"> 
</span><span class="cx">     RELEASE_AND_RETURN(throwScope, JSValue::encode(jsBoolean(jsException->tag() == tag->tag())));
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>