mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
Bug 1343481 - Part 6: Add native functions wrapper for GetInternalError and GetTypeError.
Tag #1287
This commit is contained in:
parent
04ec8aaf1c
commit
2bbebc6ebc
3 changed files with 24 additions and 4 deletions
|
|
@ -11,11 +11,11 @@
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
|
|
||||||
#include "jscntxt.h"
|
#include "jscntxt.h"
|
||||||
|
#include "jsexn.h"
|
||||||
|
|
||||||
#include "gc/Heap.h"
|
#include "gc/Heap.h"
|
||||||
#include "js/Debug.h"
|
#include "js/Debug.h"
|
||||||
#include "vm/AsyncFunction.h"
|
#include "vm/AsyncFunction.h"
|
||||||
#include "vm/SelfHosting.h"
|
|
||||||
|
|
||||||
#include "jsobjinlines.h"
|
#include "jsobjinlines.h"
|
||||||
|
|
||||||
|
|
@ -783,9 +783,7 @@ RejectMaybeWrappedPromise(JSContext *cx, HandleObject promiseObj, HandleValue re
|
||||||
// interpreter frame active right now. If a thenable job with a
|
// interpreter frame active right now. If a thenable job with a
|
||||||
// throwing `then` function got us here, that'll not be the case,
|
// throwing `then` function got us here, that'll not be the case,
|
||||||
// so we add one by throwing the error from self-hosted code.
|
// so we add one by throwing the error from self-hosted code.
|
||||||
FixedInvokeArgs<1> getErrorArgs(cx);
|
if (!GetInternalError(cx, JSMSG_PROMISE_ERROR_IN_WRAPPED_REJECTION_REASON, &reason))
|
||||||
getErrorArgs[0].set(Int32Value(JSMSG_PROMISE_ERROR_IN_WRAPPED_REJECTION_REASON));
|
|
||||||
if (!CallSelfHostedFunction(cx, "GetInternalError", reason, getErrorArgs, &reason))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "vm/ErrorObject.h"
|
#include "vm/ErrorObject.h"
|
||||||
#include "vm/GlobalObject.h"
|
#include "vm/GlobalObject.h"
|
||||||
#include "vm/SavedStacks.h"
|
#include "vm/SavedStacks.h"
|
||||||
|
#include "vm/SelfHosting.h"
|
||||||
#include "vm/StringBuffer.h"
|
#include "vm/StringBuffer.h"
|
||||||
|
|
||||||
#include "jsobjinlines.h"
|
#include "jsobjinlines.h"
|
||||||
|
|
@ -1091,3 +1092,19 @@ js::ValueToSourceForError(JSContext* cx, HandleValue val, JSAutoByteString& byte
|
||||||
return "<<error converting value to string>>";
|
return "<<error converting value to string>>";
|
||||||
return bytes.encodeLatin1(cx, str);
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,11 @@ class AutoAssertNoPendingException
|
||||||
extern const char*
|
extern const char*
|
||||||
ValueToSourceForError(JSContext* cx, HandleValue val, JSAutoByteString& bytes);
|
ValueToSourceForError(JSContext* cx, HandleValue val, JSAutoByteString& bytes);
|
||||||
|
|
||||||
|
bool
|
||||||
|
GetInternalError(JSContext* cx, unsigned errorNumber, MutableHandleValue error);
|
||||||
|
bool
|
||||||
|
GetTypeError(JSContext* cx, unsigned errorNumber, MutableHandleValue error);
|
||||||
|
|
||||||
} // namespace js
|
} // namespace js
|
||||||
|
|
||||||
#endif /* jsexn_h */
|
#endif /* jsexn_h */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue