Reviewers: Benedikt Meurer,

Message:
This is necessary for https://codereview.chromium.org/1287243002, because we
can't use global objects as map keys.

Description:
Debugger: do not expose global object.

Please review this at https://codereview.chromium.org/1290063002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+6, -1 lines):
  M src/debug/debug-scopes.cc
  M src/runtime/runtime-debug.cc


Index: src/debug/debug-scopes.cc
diff --git a/src/debug/debug-scopes.cc b/src/debug/debug-scopes.cc
index 948183814e10db23fe283eac489c53b68612f914..62b78b472833e8fe996a00b771a4378f07716363 100644
--- a/src/debug/debug-scopes.cc
+++ b/src/debug/debug-scopes.cc
@@ -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: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index fcce24ff8ea4e559a9a4ed7156c0c990df4280ad..97c3ff48a9a6535208c91ceb733e3f7ae3fa5af4 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.


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to