mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Update quickjs (#890)
Includes additional fixes from main repo's unmerged PRs: - quickjs#132: Fix undefined behavior: shift 32 bits for uint32_t in bf_set_ui - quickjs#171: Fix locale-aware representation of hours in Date class - quickjs#182: Fix stack overflow in CVE-2023-31922
This commit is contained in:
parent
4b7ba9a4c5
commit
879bb84244
12 changed files with 2330 additions and 2182 deletions
26
third_party/quickjs/object.c
vendored
26
third_party/quickjs/object.c
vendored
|
@ -652,6 +652,31 @@ static JSValue js_object_hasOwnProperty(JSContext *ctx, JSValueConst this_val,
|
|||
return JS_NewBool(ctx, ret);
|
||||
}
|
||||
|
||||
static JSValue js_object_hasOwn(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
JSValue obj;
|
||||
JSAtom atom;
|
||||
JSObject *p;
|
||||
BOOL ret;
|
||||
obj = JS_ToObject(ctx, argv[0]);
|
||||
if (JS_IsException(obj))
|
||||
return obj;
|
||||
atom = JS_ValueToAtom(ctx, argv[1]);
|
||||
if (UNLIKELY(atom == JS_ATOM_NULL)) {
|
||||
JS_FreeValue(ctx, obj);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
p = JS_VALUE_GET_OBJ(obj);
|
||||
ret = JS_GetOwnPropertyInternal(ctx, NULL, p, atom);
|
||||
JS_FreeAtom(ctx, atom);
|
||||
JS_FreeValue(ctx, obj);
|
||||
if (ret < 0)
|
||||
return JS_EXCEPTION;
|
||||
else
|
||||
return JS_NewBool(ctx, ret);
|
||||
}
|
||||
|
||||
static JSValue js_object_valueOf(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
|
@ -1195,6 +1220,7 @@ static const JSCFunctionListEntry js_object_funcs[] = {
|
|||
//JS_CFUNC_DEF("__getObjectData", 1, js_object___getObjectData ),
|
||||
//JS_CFUNC_DEF("__setObjectData", 2, js_object___setObjectData ),
|
||||
JS_CFUNC_DEF("fromEntries", 1, js_object_fromEntries ),
|
||||
JS_CFUNC_DEF("hasOwn", 2, js_object_hasOwn ),
|
||||
};
|
||||
|
||||
static const JSCFunctionListEntry js_object_proto_funcs[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue