зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1112778, part 8 - Rename JSObject::deleteGeneric -> js::DeleteProperty. r=Waldo.
--HG-- extra : rebase_source : 30894944a6c8c577e30a5beb20b6318dbd429ed3
This commit is contained in:
Родитель
44b02f2962
Коммит
61cf004ed2
|
@ -2084,7 +2084,7 @@ TypedObject::obj_deleteGeneric(JSContext *cx, HandleObject obj, HandleId id, boo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSObject::deleteGeneric(cx, proto, id, succeeded);
|
return DeleteProperty(cx, proto, id, succeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -3178,7 +3178,7 @@ JS_DeletePropertyById2(JSContext *cx, HandleObject obj, HandleId id, bool *resul
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
assertSameCompartment(cx, obj, id);
|
assertSameCompartment(cx, obj, id);
|
||||||
|
|
||||||
return JSObject::deleteGeneric(cx, obj, id, result);
|
return DeleteProperty(cx, obj, id, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
|
@ -3188,7 +3188,7 @@ JS_DeleteElement2(JSContext *cx, HandleObject obj, uint32_t index, bool *result)
|
||||||
CHECK_REQUEST(cx);
|
CHECK_REQUEST(cx);
|
||||||
assertSameCompartment(cx, obj);
|
assertSameCompartment(cx, obj);
|
||||||
|
|
||||||
return JSObject::deleteElement(cx, obj, index, result);
|
return DeleteElement(cx, obj, index, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
|
@ -3201,7 +3201,7 @@ JS_DeleteProperty2(JSContext *cx, HandleObject obj, const char *name, bool *resu
|
||||||
if (!atom)
|
if (!atom)
|
||||||
return false;
|
return false;
|
||||||
RootedId id(cx, AtomToId(atom));
|
RootedId id(cx, AtomToId(atom));
|
||||||
return JSObject::deleteGeneric(cx, obj, id, result);
|
return DeleteProperty(cx, obj, id, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
|
@ -3215,7 +3215,7 @@ JS_DeleteUCProperty2(JSContext *cx, HandleObject obj, const char16_t *name, size
|
||||||
if (!atom)
|
if (!atom)
|
||||||
return false;
|
return false;
|
||||||
RootedId id(cx, AtomToId(atom));
|
RootedId id(cx, AtomToId(atom));
|
||||||
return JSObject::deleteGeneric(cx, obj, id, result);
|
return DeleteProperty(cx, obj, id, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
|
|
|
@ -410,7 +410,7 @@ DeleteArrayElement(JSContext *cx, HandleObject obj, double index, bool *succeede
|
||||||
RootedId id(cx);
|
RootedId id(cx);
|
||||||
if (!ToId(cx, index, &id))
|
if (!ToId(cx, index, &id))
|
||||||
return false;
|
return false;
|
||||||
return JSObject::deleteGeneric(cx, obj, id, succeeded);
|
return DeleteProperty(cx, obj, id, succeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ES6 20130308 draft 9.3.5 */
|
/* ES6 20130308 draft 9.3.5 */
|
||||||
|
@ -628,7 +628,7 @@ js::ArraySetLength(JSContext *cx, Handle<ArrayObject*> arr, HandleId id,
|
||||||
|
|
||||||
/* Steps 15b-d. */
|
/* Steps 15b-d. */
|
||||||
bool deleteSucceeded;
|
bool deleteSucceeded;
|
||||||
if (!JSObject::deleteElement(cx, arr, oldLen, &deleteSucceeded))
|
if (!DeleteElement(cx, arr, oldLen, &deleteSucceeded))
|
||||||
return false;
|
return false;
|
||||||
if (!deleteSucceeded) {
|
if (!deleteSucceeded) {
|
||||||
newLen = oldLen + 1;
|
newLen = oldLen + 1;
|
||||||
|
@ -688,7 +688,7 @@ js::ArraySetLength(JSContext *cx, Handle<ArrayObject*> arr, HandleId id,
|
||||||
|
|
||||||
/* Steps 15b-d. */
|
/* Steps 15b-d. */
|
||||||
bool deleteSucceeded;
|
bool deleteSucceeded;
|
||||||
if (!JSObject::deleteElement(cx, arr, index, &deleteSucceeded))
|
if (!DeleteElement(cx, arr, index, &deleteSucceeded))
|
||||||
return false;
|
return false;
|
||||||
if (!deleteSucceeded) {
|
if (!deleteSucceeded) {
|
||||||
newLen = index + 1;
|
newLen = index + 1;
|
||||||
|
|
|
@ -2498,7 +2498,7 @@ bad:
|
||||||
if (named) {
|
if (named) {
|
||||||
bool succeeded;
|
bool succeeded;
|
||||||
RootedId id(cx, AtomToId(atom));
|
RootedId id(cx, AtomToId(atom));
|
||||||
JSObject::deleteGeneric(cx, obj, id, &succeeded);
|
DeleteProperty(cx, obj, id, &succeeded);
|
||||||
}
|
}
|
||||||
if (cached)
|
if (cached)
|
||||||
ClearClassObject(obj, key);
|
ClearClassObject(obj, key);
|
||||||
|
|
|
@ -573,11 +573,6 @@ class JSObject : public js::gc::Cell
|
||||||
static inline bool setGenericAttributes(JSContext *cx, js::HandleObject obj,
|
static inline bool setGenericAttributes(JSContext *cx, js::HandleObject obj,
|
||||||
js::HandleId id, unsigned *attrsp);
|
js::HandleId id, unsigned *attrsp);
|
||||||
|
|
||||||
static inline bool deleteGeneric(JSContext *cx, js::HandleObject obj, js::HandleId id,
|
|
||||||
bool *succeeded);
|
|
||||||
static inline bool deleteElement(JSContext *cx, js::HandleObject obj, uint32_t index,
|
|
||||||
bool *succeeded);
|
|
||||||
|
|
||||||
static inline bool watch(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
static inline bool watch(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
||||||
JS::HandleObject callable);
|
JS::HandleObject callable);
|
||||||
static inline bool unwatch(JSContext *cx, JS::HandleObject obj, JS::HandleId id);
|
static inline bool unwatch(JSContext *cx, JS::HandleObject obj, JS::HandleId id);
|
||||||
|
@ -978,6 +973,15 @@ inline bool
|
||||||
SetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
|
SetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index,
|
||||||
MutableHandleValue vp, bool strict);
|
MutableHandleValue vp, bool strict);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ES6 [[Delete]]. Equivalent to the JS code `delete obj[id]`.
|
||||||
|
*/
|
||||||
|
inline bool
|
||||||
|
DeleteProperty(JSContext *cx, js::HandleObject obj, js::HandleId id, bool *succeeded);
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
DeleteElement(JSContext *cx, js::HandleObject obj, uint32_t index, bool *succeeded);
|
||||||
|
|
||||||
|
|
||||||
/*** SpiderMonkey nonstandard internal methods ***************************************************/
|
/*** SpiderMonkey nonstandard internal methods ***************************************************/
|
||||||
|
|
||||||
|
|
|
@ -35,26 +35,6 @@ JSObject::setGenericAttributes(JSContext *cx, js::HandleObject obj,
|
||||||
return js::NativeSetPropertyAttributes(cx, obj.as<js::NativeObject>(), id, attrsp);
|
return js::NativeSetPropertyAttributes(cx, obj.as<js::NativeObject>(), id, attrsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ inline bool
|
|
||||||
JSObject::deleteGeneric(JSContext *cx, js::HandleObject obj, js::HandleId id,
|
|
||||||
bool *succeeded)
|
|
||||||
{
|
|
||||||
js::types::MarkTypePropertyNonData(cx, obj, id);
|
|
||||||
js::DeleteGenericOp op = obj->getOps()->deleteGeneric;
|
|
||||||
if (op)
|
|
||||||
return op(cx, obj, id, succeeded);
|
|
||||||
return js::NativeDeleteProperty(cx, obj.as<js::NativeObject>(), id, succeeded);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ inline bool
|
|
||||||
JSObject::deleteElement(JSContext *cx, js::HandleObject obj, uint32_t index, bool *succeeded)
|
|
||||||
{
|
|
||||||
JS::RootedId id(cx);
|
|
||||||
if (!js::IndexToId(cx, index, &id))
|
|
||||||
return false;
|
|
||||||
return deleteGeneric(cx, obj, id, succeeded);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ inline bool
|
/* static */ inline bool
|
||||||
JSObject::watch(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
JSObject::watch(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
||||||
JS::HandleObject callable)
|
JS::HandleObject callable)
|
||||||
|
@ -236,6 +216,24 @@ js::GetElementNoGC(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t in
|
||||||
return GetPropertyNoGC(cx, obj, receiver, INT_TO_JSID(index), vp);
|
return GetPropertyNoGC(cx, obj, receiver, INT_TO_JSID(index), vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
js::DeleteProperty(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
|
||||||
|
{
|
||||||
|
types::MarkTypePropertyNonData(cx, obj, id);
|
||||||
|
if (DeleteGenericOp op = obj->getOps()->deleteGeneric)
|
||||||
|
return op(cx, obj, id, succeeded);
|
||||||
|
return NativeDeleteProperty(cx, obj.as<NativeObject>(), id, succeeded);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
js::DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *succeeded)
|
||||||
|
{
|
||||||
|
RootedId id(cx);
|
||||||
|
if (!IndexToId(cx, index, &id))
|
||||||
|
return false;
|
||||||
|
return DeleteProperty(cx, obj, id, succeeded);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* * */
|
/* * */
|
||||||
|
|
||||||
|
|
|
@ -712,7 +712,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
||||||
if (newElement.isUndefined()) {
|
if (newElement.isUndefined()) {
|
||||||
/* Step 2a(iii)(2). */
|
/* Step 2a(iii)(2). */
|
||||||
bool succeeded;
|
bool succeeded;
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
/* Step 2a(iii)(3). */
|
/* Step 2a(iii)(3). */
|
||||||
|
@ -740,7 +740,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
||||||
if (newElement.isUndefined()) {
|
if (newElement.isUndefined()) {
|
||||||
/* Step 2b(ii)(2). */
|
/* Step 2b(ii)(2). */
|
||||||
bool succeeded;
|
bool succeeded;
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
/* Step 2b(ii)(3). */
|
/* Step 2b(ii)(3). */
|
||||||
|
|
|
@ -59,7 +59,7 @@ DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, proxy, id, SET);
|
assertEnteredPolicy(cx, proxy, id, SET);
|
||||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||||
return JSObject::deleteGeneric(cx, target, id, bp);
|
return DeleteProperty(cx, target, id, bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -6702,7 +6702,7 @@ DebuggerObject_deleteProperty(JSContext *cx, unsigned argc, Value *vp)
|
||||||
ErrorCopier ec(ac);
|
ErrorCopier ec(ac);
|
||||||
|
|
||||||
bool succeeded;
|
bool succeeded;
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||||
return false;
|
return false;
|
||||||
args.rval().setBoolean(succeeded);
|
args.rval().setBoolean(succeeded);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2287,7 +2287,7 @@ CASE(JSOP_STRICTDELPROP)
|
||||||
FETCH_OBJECT(cx, -1, obj);
|
FETCH_OBJECT(cx, -1, obj);
|
||||||
|
|
||||||
bool succeeded;
|
bool succeeded;
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||||
goto error;
|
goto error;
|
||||||
if (!succeeded && JSOp(*REGS.pc) == JSOP_STRICTDELPROP) {
|
if (!succeeded && JSOp(*REGS.pc) == JSOP_STRICTDELPROP) {
|
||||||
obj->reportNotConfigurable(cx, id);
|
obj->reportNotConfigurable(cx, id);
|
||||||
|
@ -2314,7 +2314,7 @@ CASE(JSOP_STRICTDELELEM)
|
||||||
RootedId &id = rootId0;
|
RootedId &id = rootId0;
|
||||||
if (!ValueToId<CanGC>(cx, propval, &id))
|
if (!ValueToId<CanGC>(cx, propval, &id))
|
||||||
goto error;
|
goto error;
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||||
goto error;
|
goto error;
|
||||||
if (!succeeded && JSOp(*REGS.pc) == JSOP_STRICTDELELEM) {
|
if (!succeeded && JSOp(*REGS.pc) == JSOP_STRICTDELELEM) {
|
||||||
obj->reportNotConfigurable(cx, id);
|
obj->reportNotConfigurable(cx, id);
|
||||||
|
@ -3786,7 +3786,7 @@ js::DeleteProperty(JSContext *cx, HandleValue v, HandlePropertyName name, bool *
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RootedId id(cx, NameToId(name));
|
RootedId id(cx, NameToId(name));
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, bp))
|
if (!DeleteProperty(cx, obj, id, bp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (strict && !*bp) {
|
if (strict && !*bp) {
|
||||||
|
@ -3810,7 +3810,7 @@ js::DeleteElement(JSContext *cx, HandleValue val, HandleValue index, bool *bp)
|
||||||
RootedId id(cx);
|
RootedId id(cx);
|
||||||
if (!ValueToId<CanGC>(cx, index, &id))
|
if (!ValueToId<CanGC>(cx, index, &id))
|
||||||
return false;
|
return false;
|
||||||
if (!JSObject::deleteGeneric(cx, obj, id, bp))
|
if (!DeleteProperty(cx, obj, id, bp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (strict && !*bp) {
|
if (strict && !*bp) {
|
||||||
|
@ -3922,7 +3922,7 @@ js::DeleteNameOperation(JSContext *cx, HandlePropertyName name, HandleObject sco
|
||||||
|
|
||||||
bool succeeded;
|
bool succeeded;
|
||||||
RootedId id(cx, NameToId(name));
|
RootedId id(cx, NameToId(name));
|
||||||
if (!JSObject::deleteGeneric(cx, scope, id, &succeeded))
|
if (!DeleteProperty(cx, scope, id, &succeeded))
|
||||||
return false;
|
return false;
|
||||||
res.setBoolean(succeeded);
|
res.setBoolean(succeeded);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -580,7 +580,7 @@ static bool
|
||||||
with_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
|
with_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
|
||||||
{
|
{
|
||||||
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
|
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
|
||||||
return JSObject::deleteGeneric(cx, actual, id, succeeded);
|
return DeleteProperty(cx, actual, id, succeeded);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSObject *
|
static JSObject *
|
||||||
|
|
Загрузка…
Ссылка в новой задаче