From f182cfb7bea29ae08626156005fc728076b47241 Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Tue, 21 Jun 2016 11:14:45 +0200 Subject: [PATCH] Bug 1271653 - DebuggerObject.global should return a DebuggerObject;r=fitzgen --- js/src/vm/Debugger.cpp | 13 +++++++++---- js/src/vm/Debugger.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index abc83b48216c..967702ff9ece 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -8128,7 +8128,7 @@ DebuggerObject::globalGetter(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGOBJECT(cx, argc, vp, "get global", args, object) - RootedObject result(cx); + Rooted result(cx); if (!DebuggerObject::global(cx, object, &result)) return false; @@ -8882,13 +8882,18 @@ DebuggerObject::className(JSContext* cx, Handle object, } /* static */ bool -DebuggerObject::global(JSContext* cx, Handle object, MutableHandleObject result) +DebuggerObject::global(JSContext* cx, Handle object, + MutableHandle result) { RootedObject referent(cx, object->referent()); Debugger* dbg = object->owner(); - result.set(&referent->global()); - return dbg->wrapDebuggeeObject(cx, result); + RootedObject global(cx, &referent->global()); + if (!dbg->wrapDebuggeeObject(cx, &global)) + return false; + + result.set(&global->as()); + return true; } /* static */ bool diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 5533de53a337..4241674c4c11 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -1072,7 +1072,7 @@ class DebuggerObject : public NativeObject static MOZ_MUST_USE bool className(JSContext* cx, Handle object, MutableHandleString result); static MOZ_MUST_USE bool global(JSContext* cx, Handle object, - MutableHandleObject result); + MutableHandle result); static MOZ_MUST_USE bool name(JSContext* cx, Handle object, MutableHandleString result); static MOZ_MUST_USE bool displayName(JSContext* cx, Handle object,