Skip access checks for hidden properties.
authorvitalyr@chromium.org <vitalyr@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 14 Oct 2009 11:19:55 +0000 (11:19 +0000)
committervitalyr@chromium.org <vitalyr@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 14 Oct 2009 11:19:55 +0000 (11:19 +0000)
Hidden properties are used like internal fields which do not have
access checks. The checks can cause problems because there may be no
current context. See http://crbug.com/24200.

Review URL: http://codereview.chromium.org/271080

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3062 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/top.cc

index e40fc11..bb2dea4 100644 (file)
@@ -494,11 +494,17 @@ static MayAccessDecision MayAccessPreCheck(JSObject* receiver,
 
 bool Top::MayNamedAccess(JSObject* receiver, Object* key, v8::AccessType type) {
   ASSERT(receiver->IsAccessCheckNeeded());
+
+  // The callers of this method are not expecting a GC.
+  AssertNoAllocation no_gc;
+
+  // Skip checks for hidden properties access.  Note, we do not
+  // require existence of a context in this case.
+  if (key == Heap::hidden_symbol()) return true;
+
   // Check for compatibility between the security tokens in the
   // current lexical context and the accessed object.
   ASSERT(Top::context());
-  // The callers of this method are not expecting a GC.
-  AssertNoAllocation no_gc;
 
   MayAccessDecision decision = MayAccessPreCheck(receiver, type);
   if (decision != UNKNOWN) return decision == YES;