Closed Bug 560556 Opened 10 years ago Closed 8 years ago

JS_ClearScope doesn't handle failure from JS_SetReservedSlot

Categories

(Core :: JavaScript Engine, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: timeless, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

3812 JS_PUBLIC_API(void)
3813 JS_ClearScope(JSContext *cx, JSObject *obj)
3814 {
3815     CHECK_REQUEST(cx);
3816 
3817     if (obj->map->ops->clear)
3818         obj->map->ops->clear(cx, obj);
3819 
3820     /* Clear cached class objects on the global object. */
3821     if (obj->getClass()->flags & JSCLASS_IS_GLOBAL) {
3822         int key;
3823 
3824         for (key = JSProto_Null; key < JSProto_LIMIT; key++)
3825             JS_SetReservedSlot(cx, obj, key, JSVAL_VOID);
3826     }
3827 }

In theory, JS_SetReservedSlot can fail for an object whose scope is shared. For JS_ClearScope where JSCLASS_IS_GLOBAL, we might know that the object's scope isn't shared.

I wonder if that means we can use a hypothetical private js_SetReservedSlot_will_not_fail()

Sadly this is too complicated for my tiny little mind at this hour.
Depends on: 637099
Depends on: 749371
This was fixed as part of bug 650369, in fact.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.