Debugger: do not expose global object.
authoryangguo <yangguo@chromium.org>
Thu, 13 Aug 2015 10:19:55 +0000 (03:19 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 13 Aug 2015 10:20:02 +0000 (10:20 +0000)
Review URL: https://codereview.chromium.org/1290063002

Cr-Commit-Position: refs/heads/master@{#30149}

src/debug/debug-scopes.cc
src/runtime/runtime-debug.cc

index 9481838..62b78b4 100644 (file)
@@ -228,7 +228,7 @@ MaybeHandle<JSObject> ScopeIterator::ScopeObject() {
   DCHECK(!failed_);
   switch (Type()) {
     case ScopeIterator::ScopeTypeGlobal:
-      return Handle<JSObject>(CurrentContext()->global_object());
+      return Handle<JSObject>(CurrentContext()->global_proxy());
     case ScopeIterator::ScopeTypeScript:
       return MaterializeScriptScope();
     case ScopeIterator::ScopeTypeLocal:
index fcce24f..97c3ff4 100644 (file)
@@ -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.