diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 357790e0a883..1a3d49d43ea2 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -450,11 +450,8 @@ Debugger::fromChildJSObject(JSObject *obj) } bool -Debugger::getScriptFrameWithIter(JSContext *cx, AbstractFramePtr frame, - const ScriptFrameIter *maybeIter, MutableHandleValue vp) +Debugger::getScriptFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleValue vp) { - MOZ_ASSERT_IF(maybeIter, maybeIter->abstractFramePtr() == frame); - FrameMap::AddPtr p = frames.lookupForAdd(frame); if (!p) { /* Create and populate the Debugger.Frame object. */ @@ -464,17 +461,7 @@ Debugger::getScriptFrameWithIter(JSContext *cx, AbstractFramePtr frame, if (!frameobj) return false; - // Eagerly copy ScriptFrameIter data if we've already walked the - // stack. - if (maybeIter) { - AbstractFramePtr data = maybeIter->copyDataAsAbstractFramePtr(); - if (!data) - return false; - frameobj->setPrivate(data.raw()); - } else { - frameobj->setPrivate(frame.raw()); - } - + frameobj->setPrivate(frame.raw()); frameobj->setReservedSlot(JSSLOT_DEBUGFRAME_OWNER, ObjectValue(*object)); if (!frames.add(p, frame, frameobj)) { diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 6eb8fd4d93e8..83f89c6d8a3b 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -370,13 +370,6 @@ class Debugger : private mozilla::LinkedListElement */ void fireNewScript(JSContext *cx, HandleScript script); - /* - * Gets a Debugger.Frame object. If maybeIter is non-null, we eagerly copy - * its data if we need to make a new Debugger.Frame. - */ - bool getScriptFrameWithIter(JSContext *cx, AbstractFramePtr frame, - const ScriptFrameIter *maybeIter, MutableHandleValue vp); - inline Breakpoint *firstBreakpoint() const; static inline Debugger *fromOnNewGlobalObjectWatchersLink(JSCList *link); @@ -490,9 +483,7 @@ class Debugger : private mozilla::LinkedListElement * Use this if you have already access to a frame pointer without having * to incur the cost of walking the stack. */ - bool getScriptFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleValue vp) { - return getScriptFrameWithIter(cx, frame, nullptr, vp); - } + bool getScriptFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleValue vp); /* * Store the Debugger.Frame object for iter in *vp. Eagerly copies a @@ -503,7 +494,11 @@ class Debugger : private mozilla::LinkedListElement * paid. */ bool getScriptFrame(JSContext *cx, const ScriptFrameIter &iter, MutableHandleValue vp) { - return getScriptFrameWithIter(cx, iter.abstractFramePtr(), &iter, vp); + AbstractFramePtr data = iter.copyDataAsAbstractFramePtr(); + if (!data || !getScriptFrame(cx, iter.abstractFramePtr(), vp)) + return false; + vp.toObject().setPrivate(data.raw()); + return true; } /*