зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1043281 - Remove JS_ClearNonGlobalObject; r=luke
This has always been a somewhat wonky API, which only existed because of existing consumers in the DOM. The last consumer went away in bug 660237.
This commit is contained in:
Родитель
5a014d3b2b
Коммит
728327cc1b
|
@ -3594,49 +3594,6 @@ JS_DeleteProperty(JSContext *cx, HandleObject obj, const char *name)
|
|||
return JS_DeleteProperty2(cx, obj, name, &junk);
|
||||
}
|
||||
|
||||
static Shape *
|
||||
LastConfigurableShape(JSObject *obj)
|
||||
{
|
||||
for (Shape::Range<NoGC> r(obj->lastProperty()); !r.empty(); r.popFront()) {
|
||||
Shape *shape = &r.front();
|
||||
if (shape->configurable())
|
||||
return shape;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_ClearNonGlobalObject(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, obj);
|
||||
|
||||
JS_ASSERT(!obj->is<GlobalObject>());
|
||||
|
||||
if (!obj->isNative())
|
||||
return;
|
||||
|
||||
/* Remove all configurable properties from obj. */
|
||||
RootedShape shape(cx);
|
||||
while ((shape = LastConfigurableShape(obj))) {
|
||||
if (!obj->removeProperty(cx, shape->propid()))
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set all remaining writable plain data properties to undefined. */
|
||||
for (Shape::Range<NoGC> r(obj->lastProperty()); !r.empty(); r.popFront()) {
|
||||
Shape *shape = &r.front();
|
||||
if (shape->isDataDescriptor() &&
|
||||
shape->writable() &&
|
||||
shape->hasDefaultSetter() &&
|
||||
shape->hasSlot())
|
||||
{
|
||||
obj->nativeSetSlot(shape->slot(), UndefinedValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetAllNonReservedSlotsToUndefined(JSContext *cx, JSObject *objArg)
|
||||
{
|
||||
|
|
|
@ -3228,13 +3228,6 @@ JS_DeleteElement(JSContext *cx, JS::HandleObject obj, uint32_t index);
|
|||
extern JS_PUBLIC_API(bool)
|
||||
JS_DeleteElement2(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *succeeded);
|
||||
|
||||
/*
|
||||
* Remove all configurable properties from the given (non-global) object and
|
||||
* assign undefined to all writable data properties.
|
||||
*/
|
||||
JS_PUBLIC_API(void)
|
||||
JS_ClearNonGlobalObject(JSContext *cx, JS::HandleObject obj);
|
||||
|
||||
/*
|
||||
* Assign 'undefined' to all of the object's non-reserved slots. Note: this is
|
||||
* done for all slots, regardless of the associated property descriptor.
|
||||
|
|
Загрузка…
Ссылка в новой задаче