Commit 49013198 authored by jochen's avatar jochen Committed by Commit bot

Remove deprecated access check callbacks

BUG=chromium:618305
R=verwaest@chromium.org

Review-Url: https://codereview.chromium.org/2045273002
Cr-Commit-Position: refs/heads/master@{#36827}
parent 0d4983fb
...@@ -4383,28 +4383,6 @@ enum AccessType { ...@@ -4383,28 +4383,6 @@ enum AccessType {
typedef bool (*AccessCheckCallback)(Local<Context> accessing_context, typedef bool (*AccessCheckCallback)(Local<Context> accessing_context,
Local<Object> accessed_object, Local<Object> accessed_object,
Local<Value> data); Local<Value> data);
typedef bool (*DeprecatedAccessCheckCallback)(Local<Context> accessing_context,
Local<Object> accessed_object);
/**
* Returns true if cross-context access should be allowed to the named
* property with the given key on the host object.
*/
typedef bool (*NamedSecurityCallback)(Local<Object> host,
Local<Value> key,
AccessType type,
Local<Value> data);
/**
* Returns true if cross-context access should be allowed to the indexed
* property with the given index on the host object.
*/
typedef bool (*IndexedSecurityCallback)(Local<Object> host,
uint32_t index,
AccessType type,
Local<Value> data);
/** /**
* A FunctionTemplate is used to create functions at runtime. There * A FunctionTemplate is used to create functions at runtime. There
...@@ -4814,17 +4792,6 @@ class V8_EXPORT ObjectTemplate : public Template { ...@@ -4814,17 +4792,6 @@ class V8_EXPORT ObjectTemplate : public Template {
*/ */
void SetAccessCheckCallback(AccessCheckCallback callback, void SetAccessCheckCallback(AccessCheckCallback callback,
Local<Value> data = Local<Value>()); Local<Value> data = Local<Value>());
V8_DEPRECATED(
"Use SetAccessCheckCallback with new AccessCheckCallback signature.",
void SetAccessCheckCallback(DeprecatedAccessCheckCallback callback,
Local<Value> data = Local<Value>()));
V8_DEPRECATED(
"Use SetAccessCheckCallback instead",
void SetAccessCheckCallbacks(NamedSecurityCallback named_handler,
IndexedSecurityCallback indexed_handler,
Local<Value> data = Local<Value>()));
/** /**
* Gets the number of internal fields for objects generated from * Gets the number of internal fields for objects generated from
* this template. * this template.
......
...@@ -1531,8 +1531,6 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback, ...@@ -1531,8 +1531,6 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback,
i::Handle<i::AccessCheckInfo>::cast(struct_info); i::Handle<i::AccessCheckInfo>::cast(struct_info);
SET_FIELD_WRAPPED(info, set_callback, callback); SET_FIELD_WRAPPED(info, set_callback, callback);
SET_FIELD_WRAPPED(info, set_named_callback, nullptr);
SET_FIELD_WRAPPED(info, set_indexed_callback, nullptr);
if (data.IsEmpty()) { if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
...@@ -1543,39 +1541,6 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback, ...@@ -1543,39 +1541,6 @@ void ObjectTemplate::SetAccessCheckCallback(AccessCheckCallback callback,
cons->set_needs_access_check(true); cons->set_needs_access_check(true);
} }
void ObjectTemplate::SetAccessCheckCallback(
DeprecatedAccessCheckCallback callback, Local<Value> data) {
SetAccessCheckCallback(reinterpret_cast<AccessCheckCallback>(callback), data);
}
void ObjectTemplate::SetAccessCheckCallbacks(
NamedSecurityCallback named_callback,
IndexedSecurityCallback indexed_callback, Local<Value> data) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
auto cons = EnsureConstructor(isolate, this);
EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallbacks");
i::Handle<i::Struct> struct_info =
isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE);
i::Handle<i::AccessCheckInfo> info =
i::Handle<i::AccessCheckInfo>::cast(struct_info);
SET_FIELD_WRAPPED(info, set_callback, nullptr);
SET_FIELD_WRAPPED(info, set_named_callback, named_callback);
SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback);
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
info->set_data(*Utils::OpenHandle(*data));
cons->set_access_check_info(*info);
cons->set_needs_access_check(true);
}
void ObjectTemplate::SetHandler( void ObjectTemplate::SetHandler(
const IndexedPropertyHandlerConfiguration& config) { const IndexedPropertyHandlerConfiguration& config) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
......
...@@ -881,18 +881,12 @@ bool Isolate::MayAccess(Handle<Context> accessing_context, ...@@ -881,18 +881,12 @@ bool Isolate::MayAccess(Handle<Context> accessing_context,
HandleScope scope(this); HandleScope scope(this);
Handle<Object> data; Handle<Object> data;
v8::AccessCheckCallback callback = nullptr; v8::AccessCheckCallback callback = nullptr;
v8::NamedSecurityCallback named_callback = nullptr;
{ DisallowHeapAllocation no_gc; { DisallowHeapAllocation no_gc;
AccessCheckInfo* access_check_info = GetAccessCheckInfo(this, receiver); AccessCheckInfo* access_check_info = GetAccessCheckInfo(this, receiver);
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); data = handle(access_check_info->data(), this);
if (!callback) {
fun_obj = access_check_info->named_callback();
named_callback = v8::ToCData<v8::NamedSecurityCallback>(fun_obj);
if (!named_callback) return false;
}
} }
LOG(this, ApiSecurityCheck()); LOG(this, ApiSecurityCheck());
...@@ -900,14 +894,9 @@ bool Isolate::MayAccess(Handle<Context> accessing_context, ...@@ -900,14 +894,9 @@ bool Isolate::MayAccess(Handle<Context> accessing_context,
{ {
// Leaving JavaScript. // Leaving JavaScript.
VMState<EXTERNAL> state(this); VMState<EXTERNAL> state(this);
if (callback) {
return callback(v8::Utils::ToLocal(accessing_context), return callback(v8::Utils::ToLocal(accessing_context),
v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(data)); v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(data));
} }
Handle<Object> key = factory()->undefined_value();
return named_callback(v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(key),
v8::ACCESS_HAS, v8::Utils::ToLocal(data));
}
} }
......
...@@ -931,8 +931,6 @@ void AccessorPair::AccessorPairVerify() { ...@@ -931,8 +931,6 @@ void AccessorPair::AccessorPairVerify() {
void AccessCheckInfo::AccessCheckInfoVerify() { void AccessCheckInfo::AccessCheckInfoVerify() {
CHECK(IsAccessCheckInfo()); CHECK(IsAccessCheckInfo());
VerifyPointer(named_callback());
VerifyPointer(indexed_callback());
VerifyPointer(callback()); VerifyPointer(callback());
VerifyPointer(data()); VerifyPointer(data());
} }
......
...@@ -5520,8 +5520,6 @@ ACCESSORS(SloppyBlockWithEvalContextExtension, extension, JSObject, ...@@ -5520,8 +5520,6 @@ ACCESSORS(SloppyBlockWithEvalContextExtension, extension, JSObject,
ACCESSORS(AccessorPair, getter, Object, kGetterOffset) ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
ACCESSORS(AccessorPair, setter, Object, kSetterOffset) ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset)
ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset)
ACCESSORS(AccessCheckInfo, callback, Object, kCallbackOffset) ACCESSORS(AccessCheckInfo, callback, Object, kCallbackOffset)
ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
......
...@@ -1036,8 +1036,6 @@ void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT ...@@ -1036,8 +1036,6 @@ void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT
void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) { // NOLINT void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AccessCheckInfo"); HeapObject::PrintHeader(os, "AccessCheckInfo");
os << "\n - named_callback: " << Brief(named_callback());
os << "\n - indexed_callback: " << Brief(indexed_callback());
os << "\n - callback: " << Brief(callback()); os << "\n - callback: " << Brief(callback());
os << "\n - data: " << Brief(data()); os << "\n - data: " << Brief(data());
os << "\n"; os << "\n";
......
...@@ -10371,8 +10371,6 @@ class AccessorPair: public Struct { ...@@ -10371,8 +10371,6 @@ class AccessorPair: public Struct {
class AccessCheckInfo: public Struct { class AccessCheckInfo: public Struct {
public: public:
DECL_ACCESSORS(named_callback, Object)
DECL_ACCESSORS(indexed_callback, Object)
DECL_ACCESSORS(callback, Object) DECL_ACCESSORS(callback, Object)
DECL_ACCESSORS(data, Object) DECL_ACCESSORS(data, Object)
...@@ -10382,9 +10380,7 @@ class AccessCheckInfo: public Struct { ...@@ -10382,9 +10380,7 @@ class AccessCheckInfo: public Struct {
DECLARE_PRINTER(AccessCheckInfo) DECLARE_PRINTER(AccessCheckInfo)
DECLARE_VERIFIER(AccessCheckInfo) DECLARE_VERIFIER(AccessCheckInfo)
static const int kNamedCallbackOffset = HeapObject::kHeaderSize; static const int kCallbackOffset = HeapObject::kHeaderSize;
static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize;
static const int kCallbackOffset = kIndexedCallbackOffset + kPointerSize;
static const int kDataOffset = kCallbackOffset + kPointerSize; static const int kDataOffset = kCallbackOffset + kPointerSize;
static const int kSize = kDataOffset + kPointerSize; static const int kSize = kDataOffset + kPointerSize;
......
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