Reviewers: Vyacheslav Egorov,

Description:
Enable test-api/TurnOnAccessCheckAndRecompile and change it so it can't cause a
GC.

A GC in the access check callbacks NamedSecurityCallback and
IndexedSecurityCallback
violates the contract about these callbacks.

Added a EXTERNAL VMState scope around the call to FailedAccessCheckCallback to
be
consistent with the other callback invocations.

BUG=v8:1952
TEST=cctest/test-api/TurnOnAccessCheckAndRecompile

Please review this at https://chromiumcodereview.appspot.com/9425048/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/isolate.cc
  M     test/cctest/cctest.status
  M     test/cctest/test-api.cc


Index: src/isolate.cc
===================================================================
--- src/isolate.cc      (revision 10751)
+++ src/isolate.cc      (working copy)
@@ -775,10 +775,12 @@
   HandleScope scope;
   Handle<JSObject> receiver_handle(receiver);
   Handle<Object> data(AccessCheckInfo::cast(data_obj)->data());
-  thread_local_top()->failed_access_check_callback_(
-    v8::Utils::ToLocal(receiver_handle),
-    type,
-    v8::Utils::ToLocal(data));
+  { VMState state(this, EXTERNAL);
+    thread_local_top()->failed_access_check_callback_(
+      v8::Utils::ToLocal(receiver_handle),
+      type,
+      v8::Utils::ToLocal(data));
+  }
 }


Index: test/cctest/cctest.status
===================================================================
--- test/cctest/cctest.status   (revision 10751)
+++ test/cctest/cctest.status   (working copy)
@@ -52,9 +52,6 @@
 # We do not yet shrink weak maps after they have been emptied by the GC
 test-weakmaps/Shrinking: FAIL

-# BUG(1952): Temporarily disabled until issue is fixed.
-test-api/TurnOnAccessCheckAndRecompile: PASS || FAIL
-
##############################################################################
 [ $arch == arm ]

Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc     (revision 10751)
+++ test/cctest/test-api.cc     (working copy)
@@ -11050,27 +11050,26 @@
 }


-v8::Handle<v8::String> a;
-v8::Handle<v8::String> h;
+const char* a = "a";
+const char* h = "h";

 static bool NamedGetAccessBlockAandH(Local<v8::Object> obj,
                                        Local<Value> name,
                                        v8::AccessType type,
                                        Local<Value> data) {
-  return !(name->Equals(a) || name->Equals(h));
+  if (!name->IsString()) return false;
+  char buf[10];
+  Local<String>::Cast(name)->WriteAscii(buf, 0, 9);
+  return !(strcmp(a, buf) == 0 || strcmp(h, buf) == 0);
 }


-// TODO(1952): Enable this test for threading test once the underlying bug is
-// fixed.
-TEST(TurnOnAccessCheckAndRecompile) {
+THREADED_TEST(TurnOnAccessCheckAndRecompile) {
   v8::HandleScope handle_scope;

// Create an environment with access check to the global object disabled by // default. When the registered access checker will block access to properties
-  // a and h
-  a = v8_str("a");
-  h = v8_str("h");
+  // a and h.
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
   global_template->SetAccessCheckCallbacks(NamedGetAccessBlockAandH,
                                            IndexedGetAccessBlocker,


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to