зеркало из 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 JSObject::deleteGeneric(cx, proto, id, succeeded);
|
||||
return DeleteProperty(cx, proto, id, succeeded);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -3178,7 +3178,7 @@ JS_DeletePropertyById2(JSContext *cx, HandleObject obj, HandleId id, bool *resul
|
|||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj, id);
|
||||
|
||||
return JSObject::deleteGeneric(cx, obj, id, result);
|
||||
return DeleteProperty(cx, obj, id, result);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
@ -3188,7 +3188,7 @@ JS_DeleteElement2(JSContext *cx, HandleObject obj, uint32_t index, bool *result)
|
|||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
|
||||
return JSObject::deleteElement(cx, obj, index, result);
|
||||
return DeleteElement(cx, obj, index, result);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
@ -3201,7 +3201,7 @@ JS_DeleteProperty2(JSContext *cx, HandleObject obj, const char *name, bool *resu
|
|||
if (!atom)
|
||||
return false;
|
||||
RootedId id(cx, AtomToId(atom));
|
||||
return JSObject::deleteGeneric(cx, obj, id, result);
|
||||
return DeleteProperty(cx, obj, id, result);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
@ -3215,7 +3215,7 @@ JS_DeleteUCProperty2(JSContext *cx, HandleObject obj, const char16_t *name, size
|
|||
if (!atom)
|
||||
return false;
|
||||
RootedId id(cx, AtomToId(atom));
|
||||
return JSObject::deleteGeneric(cx, obj, id, result);
|
||||
return DeleteProperty(cx, obj, id, result);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
|
|
@ -410,7 +410,7 @@ DeleteArrayElement(JSContext *cx, HandleObject obj, double index, bool *succeede
|
|||
RootedId id(cx);
|
||||
if (!ToId(cx, index, &id))
|
||||
return false;
|
||||
return JSObject::deleteGeneric(cx, obj, id, succeeded);
|
||||
return DeleteProperty(cx, obj, id, succeeded);
|
||||
}
|
||||
|
||||
/* ES6 20130308 draft 9.3.5 */
|
||||
|
@ -628,7 +628,7 @@ js::ArraySetLength(JSContext *cx, Handle<ArrayObject*> arr, HandleId id,
|
|||
|
||||
/* Steps 15b-d. */
|
||||
bool deleteSucceeded;
|
||||
if (!JSObject::deleteElement(cx, arr, oldLen, &deleteSucceeded))
|
||||
if (!DeleteElement(cx, arr, oldLen, &deleteSucceeded))
|
||||
return false;
|
||||
if (!deleteSucceeded) {
|
||||
newLen = oldLen + 1;
|
||||
|
@ -688,7 +688,7 @@ js::ArraySetLength(JSContext *cx, Handle<ArrayObject*> arr, HandleId id,
|
|||
|
||||
/* Steps 15b-d. */
|
||||
bool deleteSucceeded;
|
||||
if (!JSObject::deleteElement(cx, arr, index, &deleteSucceeded))
|
||||
if (!DeleteElement(cx, arr, index, &deleteSucceeded))
|
||||
return false;
|
||||
if (!deleteSucceeded) {
|
||||
newLen = index + 1;
|
||||
|
|
|
@ -2498,7 +2498,7 @@ bad:
|
|||
if (named) {
|
||||
bool succeeded;
|
||||
RootedId id(cx, AtomToId(atom));
|
||||
JSObject::deleteGeneric(cx, obj, id, &succeeded);
|
||||
DeleteProperty(cx, obj, id, &succeeded);
|
||||
}
|
||||
if (cached)
|
||||
ClearClassObject(obj, key);
|
||||
|
|
|
@ -573,11 +573,6 @@ class JSObject : public js::gc::Cell
|
|||
static inline bool setGenericAttributes(JSContext *cx, js::HandleObject obj,
|
||||
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,
|
||||
JS::HandleObject callable);
|
||||
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,
|
||||
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 ***************************************************/
|
||||
|
||||
|
|
|
@ -35,26 +35,6 @@ JSObject::setGenericAttributes(JSContext *cx, js::HandleObject obj,
|
|||
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
|
||||
JSObject::watch(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
|
||||
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);
|
||||
}
|
||||
|
||||
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()) {
|
||||
/* Step 2a(iii)(2). */
|
||||
bool succeeded;
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
||||
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||
return false;
|
||||
} else {
|
||||
/* Step 2a(iii)(3). */
|
||||
|
@ -740,7 +740,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
|||
if (newElement.isUndefined()) {
|
||||
/* Step 2b(ii)(2). */
|
||||
bool succeeded;
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
||||
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||
return false;
|
||||
} else {
|
||||
/* Step 2b(ii)(3). */
|
||||
|
|
|
@ -59,7 +59,7 @@ DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool
|
|||
{
|
||||
assertEnteredPolicy(cx, proxy, id, SET);
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return JSObject::deleteGeneric(cx, target, id, bp);
|
||||
return DeleteProperty(cx, target, id, bp);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -6702,7 +6702,7 @@ DebuggerObject_deleteProperty(JSContext *cx, unsigned argc, Value *vp)
|
|||
ErrorCopier ec(ac);
|
||||
|
||||
bool succeeded;
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
||||
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||
return false;
|
||||
args.rval().setBoolean(succeeded);
|
||||
return true;
|
||||
|
|
|
@ -2287,7 +2287,7 @@ CASE(JSOP_STRICTDELPROP)
|
|||
FETCH_OBJECT(cx, -1, obj);
|
||||
|
||||
bool succeeded;
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
||||
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||
goto error;
|
||||
if (!succeeded && JSOp(*REGS.pc) == JSOP_STRICTDELPROP) {
|
||||
obj->reportNotConfigurable(cx, id);
|
||||
|
@ -2314,7 +2314,7 @@ CASE(JSOP_STRICTDELELEM)
|
|||
RootedId &id = rootId0;
|
||||
if (!ValueToId<CanGC>(cx, propval, &id))
|
||||
goto error;
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, &succeeded))
|
||||
if (!DeleteProperty(cx, obj, id, &succeeded))
|
||||
goto error;
|
||||
if (!succeeded && JSOp(*REGS.pc) == JSOP_STRICTDELELEM) {
|
||||
obj->reportNotConfigurable(cx, id);
|
||||
|
@ -3786,7 +3786,7 @@ js::DeleteProperty(JSContext *cx, HandleValue v, HandlePropertyName name, bool *
|
|||
return false;
|
||||
|
||||
RootedId id(cx, NameToId(name));
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, bp))
|
||||
if (!DeleteProperty(cx, obj, id, bp))
|
||||
return false;
|
||||
|
||||
if (strict && !*bp) {
|
||||
|
@ -3810,7 +3810,7 @@ js::DeleteElement(JSContext *cx, HandleValue val, HandleValue index, bool *bp)
|
|||
RootedId id(cx);
|
||||
if (!ValueToId<CanGC>(cx, index, &id))
|
||||
return false;
|
||||
if (!JSObject::deleteGeneric(cx, obj, id, bp))
|
||||
if (!DeleteProperty(cx, obj, id, bp))
|
||||
return false;
|
||||
|
||||
if (strict && !*bp) {
|
||||
|
@ -3922,7 +3922,7 @@ js::DeleteNameOperation(JSContext *cx, HandlePropertyName name, HandleObject sco
|
|||
|
||||
bool succeeded;
|
||||
RootedId id(cx, NameToId(name));
|
||||
if (!JSObject::deleteGeneric(cx, scope, id, &succeeded))
|
||||
if (!DeleteProperty(cx, scope, id, &succeeded))
|
||||
return false;
|
||||
res.setBoolean(succeeded);
|
||||
return true;
|
||||
|
|
|
@ -580,7 +580,7 @@ static bool
|
|||
with_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded)
|
||||
{
|
||||
RootedObject actual(cx, &obj->as<DynamicWithObject>().object());
|
||||
return JSObject::deleteGeneric(cx, actual, id, succeeded);
|
||||
return DeleteProperty(cx, actual, id, succeeded);
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
|
|
Загрузка…
Ссылка в новой задаче