зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1415076 - Improve error message about defineProperty r=arai
This commit is contained in:
Родитель
397b8bb7f0
Коммит
5984eacd98
|
@ -205,7 +205,7 @@ function ObjectOrReflectDefineProperty(obj, propertyKey, attributes, strict) {
|
|||
|
||||
// 6.2.4.5 ToPropertyDescriptor, step 1.
|
||||
if (!IsObject(attributes))
|
||||
ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, DecompileArg(2, obj));
|
||||
ThrowArgTypeNotObject(NOT_OBJECT_KIND_DESCRIPTOR, attributes);
|
||||
|
||||
// 6.2.4.5 ToPropertyDescriptor, step 2.
|
||||
var attrs = 0, hasValue = false;
|
||||
|
|
|
@ -141,4 +141,6 @@
|
|||
|
||||
#define INTL_INTERNALS_OBJECT_SLOT 0
|
||||
|
||||
#define NOT_OBJECT_KIND_DESCRIPTOR 0
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1874,6 +1874,21 @@ intrinsic_WarnDeprecatedStringMethod(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
intrinsic_ThrowArgTypeNotObject(JSContext* cx, unsigned argc ,Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc,vp);
|
||||
MOZ_ASSERT(args.length() == 2);
|
||||
MOZ_ASSERT(args[0].isNumber());
|
||||
MOZ_ASSERT(!args[1].isObject());
|
||||
if (args[0].toNumber() == NOT_OBJECT_KIND_DESCRIPTOR)
|
||||
ReportNotObjectWithName(cx, "descriptor", args[1]);
|
||||
else
|
||||
MOZ_CRASH("unexpected kind");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
intrinsic_ConstructFunction(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
|
@ -2505,6 +2520,7 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
IntrinsicStringSplitString),
|
||||
JS_FN("StringSplitStringLimit", intrinsic_StringSplitStringLimit, 3, 0),
|
||||
JS_FN("WarnDeprecatedStringMethod", intrinsic_WarnDeprecatedStringMethod, 2, 0),
|
||||
JS_FN("ThrowArgTypeNotObject", intrinsic_ThrowArgTypeNotObject, 2, 0),
|
||||
|
||||
// See builtin/RegExp.h for descriptions of the regexp_* functions.
|
||||
JS_FN("regexp_exec_no_statics", regexp_exec_no_statics, 2,0),
|
||||
|
|
Загрузка…
Ссылка в новой задаче