Commit 14e8ee07 authored by jochen's avatar jochen Committed by Commit bot

Always load data for access check callbacks

R=verwaest@chromium.org
BUG=none
LOG=n

Review URL: https://codereview.chromium.org/1677483002

Cr-Commit-Position: refs/heads/master@{#33771}
parent 8a2d5717
...@@ -828,11 +828,11 @@ bool Isolate::MayAccess(Handle<Context> accessing_context, ...@@ -828,11 +828,11 @@ bool Isolate::MayAccess(Handle<Context> accessing_context,
if (!access_check_info) return false; if (!access_check_info) return false;
Object* fun_obj = access_check_info->callback(); Object* fun_obj = access_check_info->callback();
callback = v8::ToCData<v8::AccessCheckCallback>(fun_obj); callback = v8::ToCData<v8::AccessCheckCallback>(fun_obj);
data = handle(access_check_info->data(), this);
if (!callback) { if (!callback) {
fun_obj = access_check_info->named_callback(); fun_obj = access_check_info->named_callback();
named_callback = v8::ToCData<v8::NamedSecurityCallback>(fun_obj); named_callback = v8::ToCData<v8::NamedSecurityCallback>(fun_obj);
if (!named_callback) return false; if (!named_callback) return false;
data = handle(access_check_info->data(), this);
} }
} }
......
...@@ -8942,6 +8942,8 @@ static bool SecurityTestCallback(Local<v8::Context> accessing_context, ...@@ -8942,6 +8942,8 @@ static bool SecurityTestCallback(Local<v8::Context> accessing_context,
Local<v8::Object> accessed_object, Local<v8::Object> accessed_object,
Local<v8::Value> data) { Local<v8::Value> data) {
printf("a\n"); printf("a\n");
CHECK(!data.IsEmpty() && data->IsInt32());
CHECK_EQ(42, data->Int32Value(accessing_context).FromJust());
return g_security_callback_result; return g_security_callback_result;
} }
...@@ -8952,7 +8954,7 @@ TEST(SecurityHandler) { ...@@ -8952,7 +8954,7 @@ TEST(SecurityHandler) {
v8::HandleScope scope0(isolate); v8::HandleScope scope0(isolate);
v8::Local<v8::ObjectTemplate> global_template = v8::Local<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate); v8::ObjectTemplate::New(isolate);
global_template->SetAccessCheckCallback(SecurityTestCallback); global_template->SetAccessCheckCallback(SecurityTestCallback, v8_num(42));
// Create an environment // Create an environment
v8::Local<Context> context0 = Context::New(isolate, NULL, global_template); v8::Local<Context> context0 = Context::New(isolate, NULL, global_template);
context0->Enter(); context0->Enter();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment