WebAssembly.RuntimeError missing exception check
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Apr 2019 20:46:39 +0000 (20:46 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Apr 2019 20:46:39 +0000 (20:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196700
<rdar://problem/49693932>

Reviewed by Yusuke Suzuki.

JSTests:

* wasm/js-api/runtime-error-should-exception-check.js: Added.

Source/JavaScriptCore:

* wasm/js/JSWebAssemblyRuntimeError.h:
* wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
(JSC::constructJSWebAssemblyRuntimeError):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244040 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/wasm/js-api/runtime-error-should-exception-check.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.h
Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp

index 5f0cfee..26fe3cd 100644 (file)
@@ -1,3 +1,13 @@
+2019-04-08  Saam Barati  <sbarati@apple.com>
+
+        WebAssembly.RuntimeError missing exception check
+        https://bugs.webkit.org/show_bug.cgi?id=196700
+        <rdar://problem/49693932>
+
+        Reviewed by Yusuke Suzuki.
+
+        * wasm/js-api/runtime-error-should-exception-check.js: Added.
+
 2019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
 
         Unreviewed, rolling in r243948 with test fix
diff --git a/JSTests/wasm/js-api/runtime-error-should-exception-check.js b/JSTests/wasm/js-api/runtime-error-should-exception-check.js
new file mode 100644 (file)
index 0000000..92ab52c
--- /dev/null
@@ -0,0 +1 @@
+new WebAssembly.RuntimeError({});
index 9c64d7d..c2e1d8e 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-08  Saam Barati  <sbarati@apple.com>
+
+        WebAssembly.RuntimeError missing exception check
+        https://bugs.webkit.org/show_bug.cgi?id=196700
+        <rdar://problem/49693932>
+
+        Reviewed by Yusuke Suzuki.
+
+        * wasm/js/JSWebAssemblyRuntimeError.h:
+        * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
+        (JSC::constructJSWebAssemblyRuntimeError):
+
 2019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
 
         Unreviewed, rolling in r243948 with test fix
index 563fbd6..68d3ad1 100644 (file)
@@ -36,10 +36,6 @@ public:
     typedef ErrorInstance Base;
 
     static JSWebAssemblyRuntimeError* create(ExecState*, VM&, Structure*, const String&);
-    static JSWebAssemblyRuntimeError* create(ExecState* exec, VM& vm, Structure* structure, JSValue message)
-    {
-        return create(exec, vm, structure, message.isUndefined() ? String() : message.toWTFString(exec));
-    }
 
     DECLARE_INFO;
 
index d29b9a9..7107d73 100644 (file)
@@ -49,9 +49,11 @@ static EncodedJSValue JSC_HOST_CALL constructJSWebAssemblyRuntimeError(ExecState
     auto& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
     JSValue message = exec->argument(0);
+    String messageString = message.isUndefined() ? String() : message.toWTFString(exec);
+    RETURN_IF_EXCEPTION(scope, encodedJSValue());
     auto* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), jsCast<InternalFunction*>(exec->jsCallee())->globalObject(vm)->webAssemblyRuntimeErrorStructure());
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
-    return JSValue::encode(JSWebAssemblyRuntimeError::create(exec, vm, structure, message));
+    return JSValue::encode(JSWebAssemblyRuntimeError::create(exec, vm, structure, WTFMove(messageString)));
 }
 
 static EncodedJSValue JSC_HOST_CALL callJSWebAssemblyRuntimeError(ExecState* exec)