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
@ -1469,7 +1469,23 @@ MapObject::set(JSContext* cx, unsigned argc, Value* vp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MapObject::delete_impl(JSContext* cx, CallArgs args)
|
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
|
||||||
|
MapObject::delete_impl(JSContext *cx, CallArgs args)
|
||||||
{
|
{
|
||||||
// MapObject::mark does not mark deleted entries. Incremental GC therefore
|
// MapObject::mark does not mark deleted entries. Incremental GC therefore
|
||||||
// requires that no RelocatableValue objects pointing to heap values be
|
// requires that no RelocatableValue objects pointing to heap values be
|
||||||
@ -2160,7 +2176,15 @@ JS::MapHas(JSContext* cx, HandleObject obj, HandleValue key, bool* rval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
JS::MapSet(JSContext* cx, HandleObject obj,
|
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::MapSet(JSContext *cx, HandleObject obj,
|
||||||
HandleValue key, HandleValue val)
|
HandleValue key, HandleValue val)
|
||||||
{
|
{
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
|
@ -98,12 +98,13 @@ class MapObject : public NativeObject {
|
|||||||
static bool has(JSContext* cx, unsigned argc, Value* vp);
|
static bool has(JSContext* cx, unsigned argc, Value* vp);
|
||||||
static MapObject* create(JSContext* cx);
|
static MapObject* create(JSContext* cx);
|
||||||
|
|
||||||
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 set(JSContext* cx, HandleObject obj, HandleValue key, HandleValue val);
|
static bool delete_(JSContext *cx, HandleObject obj, HandleValue key, bool* rval);
|
||||||
static bool clear(JSContext* cx, HandleObject obj);
|
static bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val);
|
||||||
static bool iterator(JSContext* cx, IteratorKind kind, HandleObject obj, MutableHandleValue iter);
|
static bool clear(JSContext *cx, HandleObject obj);
|
||||||
|
static bool iterator(JSContext *cx, IteratorKind kind, HandleObject obj, MutableHandleValue iter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const JSPropertySpec properties[];
|
static const JSPropertySpec properties[];
|
||||||
|
@ -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