From f9a3e6a6aacd53f13a1571a55bbb066b223295ff Mon Sep 17 00:00:00 2001 From: yangguo Date: Thu, 13 Aug 2015 03:19:55 -0700 Subject: [PATCH] Debugger: do not expose global object. Review URL: https://codereview.chromium.org/1290063002 Cr-Commit-Position: refs/heads/master@{#30149} --- src/debug/debug-scopes.cc | 2 +- src/runtime/runtime-debug.cc | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/debug/debug-scopes.cc b/src/debug/debug-scopes.cc index 948183814..62b78b472 100644 --- a/src/debug/debug-scopes.cc +++ b/src/debug/debug-scopes.cc @@ -228,7 +228,7 @@ MaybeHandle ScopeIterator::ScopeObject() { DCHECK(!failed_); switch (Type()) { case ScopeIterator::ScopeTypeGlobal: - return Handle(CurrentContext()->global_object()); + return Handle(CurrentContext()->global_proxy()); case ScopeIterator::ScopeTypeScript: return MaterializeScriptScope(); case ScopeIterator::ScopeTypeLocal: diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc index fcce24ff8..97c3ff48a 100644 --- a/src/runtime/runtime-debug.cc +++ b/src/runtime/runtime-debug.cc @@ -1399,6 +1399,11 @@ static int DebugReferencedBy(HeapIterator* iterator, JSObject* target, } } + // Do not expose the global object directly. + if (obj->IsJSGlobalObject()) { + obj = JSGlobalObject::cast(obj)->global_proxy(); + } + if (obj != NULL) { // Valid reference found add to instance array if supplied an update // count. -- 2.34.1