Bug 973566, part 1 - Fix "Assertion failure: offsetsv.isUndefined()" with elements on Object.prototype. r=jimb.

This commit is contained in:
Jason Orendorff 2014-02-26 08:55:35 -06:00
parent c4600431ae
commit 55256bef4f
4 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,7 @@
Object.prototype[1] = 'peek';
var g = newGlobal();
var dbg = Debugger(g);
dbg.onEnterFrame = function (frame) {
var lines = frame.script.getAllOffsets();
};
g.eval("1;");

View File

@ -4275,6 +4275,18 @@ js::HasOwnProperty<NoGC>(JSContext *cx, LookupGenericOp lookup,
JSObject *obj, jsid id,
FakeMutableHandle<JSObject*> objp, FakeMutableHandle<Shape*> propp);
bool
js::HasOwnProperty(JSContext *cx, HandleObject obj, HandleId id, bool *resultp)
{
RootedObject pobj(cx);
RootedShape shape(cx);
if (!HasOwnProperty<CanGC>(cx, obj->getOps()->lookupGeneric, obj, id, &pobj, &shape))
return false;
*resultp = (shape != nullptr);
return true;
}
template <AllowGC allowGC>
static MOZ_ALWAYS_INLINE bool
NativeGetInline(JSContext *cx,

View File

@ -1286,6 +1286,9 @@ DenseRangeRef::mark(JSTracer *trc)
}
#endif
bool
HasOwnProperty(JSContext *cx, HandleObject obj, HandleId id, bool *resultp);
template <AllowGC allowGC>
extern bool
HasOwnProperty(JSContext *cx, LookupGenericOp lookup,

View File

@ -3370,7 +3370,7 @@ DebuggerScript_getAllOffsets(JSContext *cx, unsigned argc, Value *vp)
RootedId id(cx, INT_TO_JSID(lineno));
bool found;
if (!JSObject::hasProperty(cx, result, id, &found))
if (!js::HasOwnProperty(cx, result, id, &found))
return false;
if (found && !JSObject::getGeneric(cx, result, result, id, &offsetsv))
return false;