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
Review URL: https://chromiumcodereview.appspot.com/9425048

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10764 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
fschneider@chromium.org 2012-02-20 15:34:08 +00:00
parent d180039f9c
commit b90a8ec851
3 changed files with 15 additions and 16 deletions

View File

@ -775,10 +775,12 @@ void Isolate::ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type) {
HandleScope scope;
Handle<JSObject> receiver_handle(receiver);
Handle<Object> data(AccessCheckInfo::cast(data_obj)->data());
{ VMState state(this, EXTERNAL);
thread_local_top()->failed_access_check_callback_(
v8::Utils::ToLocal(receiver_handle),
type,
v8::Utils::ToLocal(data));
}
}

View File

@ -52,9 +52,6 @@ test-profile-generator/RecordStackTraceAtStartProfiling: PASS || FAIL
# 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 ]

View File

@ -11050,27 +11050,27 @@ THREADED_TEST(TurnOnAccessCheck) {
}
v8::Handle<v8::String> a;
v8::Handle<v8::String> h;
static const char* kPropertyA = "a";
static const char* kPropertyH = "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;
i::Handle<i::String> name_handle =
v8::Utils::OpenHandle(String::Cast(*name));
return !name_handle->IsEqualTo(i::CStrVector(kPropertyA))
&& !name_handle->IsEqualTo(i::CStrVector(kPropertyH));
}
// 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,