mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1159469 - Add public jsapi ES6 Map delete method; r=jorendorff
This commit is contained in:
parent
fa5c5b4fc2
commit
d4823d0806
@ -1468,6 +1468,22 @@ MapObject::set(JSContext* cx, unsigned argc, Value* vp)
|
|||||||
return CallNonGenericMethod<MapObject::is, MapObject::set_impl>(cx, args);
|
return CallNonGenericMethod<MapObject::is, MapObject::set_impl>(cx, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
MapObject::delete_(JSContext *cx, HandleObject obj, HandleValue key, bool *rval)
|
||||||
|
{
|
||||||
|
ValueMap &map = extract(obj);
|
||||||
|
AutoHashableValueRooter k(cx);
|
||||||
|
|
||||||
|
if (!k.setValue(cx, key))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!map.remove(k, rval)) {
|
||||||
|
ReportOutOfMemory(cx);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MapObject::delete_impl(JSContext *cx, CallArgs args)
|
MapObject::delete_impl(JSContext *cx, CallArgs args)
|
||||||
{
|
{
|
||||||
@ -2159,6 +2175,14 @@ JS::MapHas(JSContext* cx, HandleObject obj, HandleValue key, bool* rval)
|
|||||||
return MapObject::has(cx, obj, key, rval);
|
return MapObject::has(cx, obj, key, rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS_PUBLIC_API(bool)
|
||||||
|
JS::MapDelete(JSContext *cx, HandleObject obj, HandleValue key, bool *rval)
|
||||||
|
{
|
||||||
|
CHECK_REQUEST(cx);
|
||||||
|
assertSameCompartment(cx, key);
|
||||||
|
return MapObject::delete_(cx, obj, key, rval);
|
||||||
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
JS::MapSet(JSContext *cx, HandleObject obj,
|
JS::MapSet(JSContext *cx, HandleObject obj,
|
||||||
HandleValue key, HandleValue val)
|
HandleValue key, HandleValue val)
|
||||||
|
@ -101,6 +101,7 @@ class MapObject : public NativeObject {
|
|||||||
static uint32_t size(JSContext *cx, HandleObject obj);
|
static uint32_t size(JSContext *cx, HandleObject obj);
|
||||||
static bool get(JSContext *cx, HandleObject obj, HandleValue key, MutableHandleValue rval);
|
static bool get(JSContext *cx, HandleObject obj, HandleValue key, MutableHandleValue rval);
|
||||||
static bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
static bool has(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||||
|
static bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||||
static bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
|
static bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
|
||||||
static bool clear(JSContext *cx, HandleObject obj);
|
static bool clear(JSContext *cx, HandleObject obj);
|
||||||
static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj, MutableHandleValue iter);
|
static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj, MutableHandleValue iter);
|
||||||
|
@ -4709,6 +4709,9 @@ MapHas(JSContext* cx, HandleObject obj, HandleValue key, bool* rval);
|
|||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
MapSet(JSContext* cx, HandleObject obj, HandleValue key, HandleValue val);
|
MapSet(JSContext* cx, HandleObject obj, HandleValue key, HandleValue val);
|
||||||
|
|
||||||
|
extern JS_PUBLIC_API(bool)
|
||||||
|
MapDelete(JSContext *cx, HandleObject obj, HandleValue key, bool *rval);
|
||||||
|
|
||||||
extern JS_PUBLIC_API(bool)
|
extern JS_PUBLIC_API(bool)
|
||||||
MapClear(JSContext* cx, HandleObject obj);
|
MapClear(JSContext* cx, HandleObject obj);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user