Skip to content
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
43 changes: 22 additions & 21 deletions lib/Parser/rterrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ RT_ERROR_MSG(JSERR_DeletePropertyWithSuper, 5146, "Unable to delete property '%s
RT_ERROR_MSG(JSERR_DetachedTypedArray, 5147, "%s: The ArrayBuffer is detached.", "The ArrayBuffer is detached.", kjstTypeError, 0)
RT_ERROR_MSG(JSERR_AsmJsCompileError, 5148, "%s: Compiling asm.js failed.", "Compiling asm.js failed.", kjstError, 0)
RT_ERROR_MSG(JSERR_ImmutablePrototypeSlot, 5149, "%s: Can't set the prototype of this object.", "Can't set the prototype of this object.", kjstTypeError, 0)
RT_ERROR_MSG(JSERR_WasmCompileError, 5150, "Compiling wasm failed: %s", "Compiling wasm failed.", kjstError, 0)

/* Error messages for misbehaved Async Operations for use in Promise.js */
RT_ERROR_MSG(ASYNCERR_NoErrorInErrorState, 5200, "", "Status is 'error', but getResults did not return an error", kjstError, 0)
Expand Down Expand Up @@ -363,23 +362,25 @@ RT_ERROR_MSG(JSERR_InvalidTypedArrayIndex, 5663, "", "Access index is out of ran
RT_ERROR_MSG(JSERR_InvalidOperationOnTypedArray, 5664, "", "The operation is not supported on this typed array type", kjstRangeError, 0)
RT_ERROR_MSG(JSERR_CannotSuspendBuffer, 5665, "", "Current agent cannot be suspended", kjstRangeError, 0)
RT_ERROR_MSG(JSERR_CantDeleteNonConfigProp, 5666, "Cannot delete non-configurable property '%s'", "Cannot delete non-configurable property", kjstTypeError, 0)

RT_ERROR_MSG(WASMERR_Unreachable, 5667, "", "Unreachable Code", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_NeedBufferSource, 5668, "%s is not a BufferSource", "BufferSource expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedModule, 5669, "%s is not a WebAssembly.Module", "WebAssembly.Module expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_DataSegOutOfRange, 5670, "", "Data segment is out of range", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_MutableGlobal, 5671, "", "Cannot export mutable global", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidImport, 5672, "", "Import is invalid", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidGlobalRef, 5673, "", "Global initialization does not support forward reference", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedMemoryObject, 5674, "%s is not a WebAssembly.Memory", "WebAssembly.Memory object expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidTypeConversion, 5675, "Invalid WebAssembly type conversion %s to %s", "Invalid WebAssembly type conversion", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_DivideByZero, 5676, "", "Division by zero", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_ExpectedAnyFunc, 5677, "%s is not AnyFunc", "AnyFunc expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedTableObject, 5678, "%s is not a WebAssembly.Table", "WebAssembly.Table object expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedWebAssemblyFunc, 5679, "%s is not a WebAssembly exported function", "WebAssembly exported function expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_SignatureMismatch, 5680, "%s called with invalid signature", "Function called with invalid signature", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_ElementSegOutOfRange, 5681, "", "Element segment is out of range", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_TableIndexOutOfRange, 5682, "", "Table index is out of range", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_ArrayIndexOutOfRange, 5683, "", "Memory index is out of range", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(JSERR_CantRedefineProp, 5684, "Cannot redefine property '%s'", "Cannot redefine property", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidInstantiateArgument, 5685, "", "Invalid arguments to instantiate", kjstTypeError, 0)
RT_ERROR_MSG(JSERR_CantRedefineProp, 5667, "Cannot redefine property '%s'", "Cannot redefine property", kjstTypeError, 0)

// WebAssembly Errors
RT_ERROR_MSG(WASMERR_WasmCompileError, 7000, "%s", "Compilation failed.", kjstWebAssemblyCompileError, 0)
RT_ERROR_MSG(WASMERR_Unreachable, 7001, "", "Unreachable Code", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_NeedBufferSource, 7002, "%s is not a BufferSource", "BufferSource expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedModule, 7003, "%s is not a WebAssembly.Module", "WebAssembly.Module expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_DataSegOutOfRange, 7004, "", "Data segment is out of range", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_MutableGlobal, 7005, "", "Cannot export mutable global", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidImport, 7006, "", "Import is invalid", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidGlobalRef, 7007, "", "Global initialization does not support forward reference", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedMemoryObject, 7008, "%s is not a WebAssembly.Memory", "WebAssembly.Memory object expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_InvalidTypeConversion, 7009, "Invalid WebAssembly type conversion %s to %s", "Invalid WebAssembly type conversion", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_DivideByZero, 7010, "", "Division by zero", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_ExpectedAnyFunc, 7011, "%s is not AnyFunc", "AnyFunc expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedTableObject, 7012, "%s is not a WebAssembly.Table", "WebAssembly.Table object expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_NeedWebAssemblyFunc, 7013, "%s is not a WebAssembly exported function", "WebAssembly exported function expected", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_SignatureMismatch, 7014, "%s called with invalid signature", "Function called with invalid signature", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_ElementSegOutOfRange, 7015, "", "Element segment is out of range", kjstTypeError, 0)
RT_ERROR_MSG(WASMERR_TableIndexOutOfRange, 7016, "", "Table index is out of range", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_ArrayIndexOutOfRange, 7017, "", "Memory index is out of range", kjstWebAssemblyRuntimeError, 0)
RT_ERROR_MSG(WASMERR_InvalidInstantiateArgument, 7018, "", "Invalid arguments to instantiate", kjstTypeError, 0)
2 changes: 1 addition & 1 deletion lib/Parser/screrror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ HRESULT CompileScriptException::ProcessError(IScanner * pScan, HRESULT hr, Pars
// Remove E_FAIL once we have this feature.
// error during code gen - no line number info available
// E_ABORT may result if compilation does stack probe while thread is in disabled state.
Assert(hr == JSERR_WasmCompileError || hr == JSERR_AsmJsCompileError || hr == ERRnoMemory || hr == VBSERR_OutOfStack || hr == E_OUTOFMEMORY || hr == E_FAIL || hr == E_ABORT);
Assert(hr == WASMERR_WasmCompileError || hr == JSERR_AsmJsCompileError || hr == ERRnoMemory || hr == VBSERR_OutOfStack || hr == E_OUTOFMEMORY || hr == E_FAIL || hr == E_ABORT);
}
return SCRIPT_E_RECORDED;
}
2 changes: 1 addition & 1 deletion lib/Runtime/Library/WasmLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Js::JavascriptMethod Js::WasmLibrary::WasmDeferredParseEntryPoint(Js::AsmJsScrip
char16* msg = newEx.ReleaseErrorMessage();
JavascriptLibrary *library = scriptContext->GetLibrary();
JavascriptError *pError = library->CreateWebAssemblyCompileError();
JavascriptError::SetErrorMessage(pError, JSERR_WasmCompileError, msg, scriptContext);
JavascriptError::SetErrorMessage(pError, WASMERR_WasmCompileError, msg, scriptContext);

func->GetDynamicType()->SetEntryPoint(WasmLazyTrapCallback);
entypointInfo->jsMethod = WasmLazyTrapCallback;
Expand Down
2 changes: 1 addition & 1 deletion lib/Runtime/Library/WebAssemblyModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ WebAssemblyModule::CreateModule(
}
JavascriptLibrary *library = scriptContext->GetLibrary();
JavascriptError *pError = library->CreateWebAssemblyCompileError();
JavascriptError::SetErrorMessage(pError, JSERR_WasmCompileError, newEx.ReleaseErrorMessage(), scriptContext);
JavascriptError::SetErrorMessage(pError, WASMERR_WasmCompileError, newEx.ReleaseErrorMessage(), scriptContext);
JavascriptExceptionOperators::Throw(pError, scriptContext);
}

Expand Down
6 changes: 3 additions & 3 deletions test/wasm/baselines/api.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Test 4: Expected Error: TypeError: BufferSource expected
Test 5: Expected Error: TypeError: BufferSource expected
Test 6: Expected Error: TypeError: BufferSource expected
Test 7: Expected Error: TypeError: BufferSource expected
Test 8: Expected Error: WebAssemblyCompileError: Compiling wasm failed: Invalid LEB128 format
Test 8: Expected Error: WebAssemblyCompileError: Invalid LEB128 format
Test 9: Expected Error: TypeError: BufferSource expected
Testing module
exports
Expand All @@ -38,7 +38,7 @@ Test 4: Expected Error: TypeError: BufferSource expected
Test 5: Expected Error: TypeError: BufferSource expected
Test 6: Expected Error: TypeError: BufferSource expected
Test 7: Expected Error: TypeError: BufferSource expected
Test 8: Expected Error: WebAssemblyCompileError: Compiling wasm failed: Invalid LEB128 format
Test 8: Expected Error: WebAssemblyCompileError: Invalid LEB128 format
Test 9: Expected Error: TypeError: BufferSource expected
Test 10: Expected Error: TypeError: Object expected
Test 11: Expected Error: TypeError: Object expected
Expand Down Expand Up @@ -86,7 +86,7 @@ Test 6: Expected Error: TypeError: BufferSource expected
Test 7: Expected Error: TypeError: BufferSource expected
Test 8: Expected Error: TypeError: BufferSource expected
Test 9: Expected Error: TypeError: BufferSource expected
Test 10: Expected Error: WebAssemblyCompileError: Compiling wasm failed: Invalid LEB128 format
Test 10: Expected Error: WebAssemblyCompileError: Invalid LEB128 format
Test 11: Expected Error: TypeError: BufferSource expected
Testing module
exports
Expand Down
2 changes: 1 addition & 1 deletion test/wasm/baselines/global.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ impInit: 78.145
Invalid cases
Should be invalid type conversion: Invalid WebAssembly type conversion
Should be invalid type conversion: Invalid WebAssembly type conversion
Should be invalid init expr: Compiling wasm failed: Global can only be initialized with a const or an imported global
Should be invalid init expr: Global can only be initialized with a const or an imported global