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 948183814e10db23fe283eac489c53b68612f914..62b78b472833e8fe996a00b771a4378f07716363 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 fcce24ff8ea4e559a9a4ed7156c0c990df4280ad..97c3ff48a9a6535208c91ceb733e3f7ae3fa5af4 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.