Explorar o código

Correctly catch exception in WebAssembly.instantiate and WebAssembly.compile to return a rejecting Promise

Michael Ferris %!s(int64=9) %!d(string=hai) anos
pai
achega
65af6fd228
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      lib/Runtime/Library/WebAssembly.cpp

+ 4 - 4
lib/Runtime/Library/WebAssembly.cpp

@@ -34,9 +34,9 @@ Var WebAssembly::EntryCompile(RecyclableObject* function, CallInfo callInfo, ...
         WebAssemblySource src(args[1], true, scriptContext);
         module = WebAssemblyModule::CreateModule(scriptContext, &src);
     }
-    catch (JavascriptError & e)
+    catch (JavascriptException & e)
     {
-        return JavascriptPromise::CreateRejectedPromise(&e, scriptContext);
+        return JavascriptPromise::CreateRejectedPromise(e.GetAndClear()->GetThrownObject(scriptContext), scriptContext);
     }
 
     Assert(module);
@@ -86,9 +86,9 @@ Var WebAssembly::EntryInstantiate(RecyclableObject* function, CallInfo callInfo,
             JavascriptOperators::OP_SetProperty(resultObject, PropertyIds::instance, instance, scriptContext);
         }
     }
-    catch (JavascriptError & e)
+    catch (JavascriptException & e)
     {
-        return JavascriptPromise::CreateRejectedPromise(&e, scriptContext);
+        return JavascriptPromise::CreateRejectedPromise(e.GetAndClear()->GetThrownObject(scriptContext), scriptContext);
     }
 
     Assert(resultObject != nullptr);