From cba3f6142704ce228aaf54b5c98c6ef5b3f871be Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Fri, 13 Dec 2019 20:55:05 -0500 Subject: Bug 1343481 - Part 6: Add native functions wrapper for GetInternalError and GetTypeError. Tag #1287 --- js/src/jsexn.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js/src/jsexn.cpp') diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 3fc9200c1..72f03ea55 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -32,6 +32,7 @@ #include "vm/ErrorObject.h" #include "vm/GlobalObject.h" #include "vm/SavedStacks.h" +#include "vm/SelfHosting.h" #include "vm/StringBuffer.h" #include "jsobjinlines.h" @@ -1091,3 +1092,19 @@ js::ValueToSourceForError(JSContext* cx, HandleValue val, JSAutoByteString& byte return "<>"; return bytes.encodeLatin1(cx, str); } + +bool +js::GetInternalError(JSContext* cx, unsigned errorNumber, MutableHandleValue error) +{ + FixedInvokeArgs<1> args(cx); + args[0].set(Int32Value(errorNumber)); + return CallSelfHostedFunction(cx, "GetInternalError", NullHandleValue, args, error); +} + +bool +js::GetTypeError(JSContext* cx, unsigned errorNumber, MutableHandleValue error) +{ + FixedInvokeArgs<1> args(cx); + args[0].set(Int32Value(errorNumber)); + return CallSelfHostedFunction(cx, "GetTypeError", NullHandleValue, args, error); +} -- cgit v1.2.3