Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: src/isolate.cc

Issue 2087823002: Optionally invoke an interceptor on failed access checks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | src/keys.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index f9e87bfaba6e92d393701edc1f4037e55c4f8937..61227f916360bbc0087d7621f4b19bc213c3676a 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -802,21 +802,6 @@ void Isolate::SetFailedAccessCheckCallback(
}
-static inline AccessCheckInfo* GetAccessCheckInfo(Isolate* isolate,
- Handle<JSObject> receiver) {
- Object* maybe_constructor = receiver->map()->GetConstructor();
- if (!maybe_constructor->IsJSFunction()) return NULL;
- JSFunction* constructor = JSFunction::cast(maybe_constructor);
- if (!constructor->shared()->IsApiFunction()) return NULL;
-
- Object* data_obj =
- constructor->shared()->get_api_func_data()->access_check_info();
- if (data_obj->IsUndefined(isolate)) return NULL;
-
- return AccessCheckInfo::cast(data_obj);
-}
-
-
void Isolate::ReportFailedAccessCheck(Handle<JSObject> receiver) {
if (!thread_local_top()->failed_access_check_callback_) {
return ScheduleThrow(*factory()->NewTypeError(MessageTemplate::kNoAccess));
@@ -829,7 +814,7 @@ void Isolate::ReportFailedAccessCheck(Handle<JSObject> receiver) {
HandleScope scope(this);
Handle<Object> data;
{ DisallowHeapAllocation no_gc;
- AccessCheckInfo* access_check_info = GetAccessCheckInfo(this, receiver);
+ AccessCheckInfo* access_check_info = AccessCheckInfo::Get(this, receiver);
if (!access_check_info) {
AllowHeapAllocation doesnt_matter_anymore;
return ScheduleThrow(
@@ -878,7 +863,7 @@ bool Isolate::MayAccess(Handle<Context> accessing_context,
Handle<Object> data;
v8::AccessCheckCallback callback = nullptr;
{ DisallowHeapAllocation no_gc;
- AccessCheckInfo* access_check_info = GetAccessCheckInfo(this, receiver);
+ AccessCheckInfo* access_check_info = AccessCheckInfo::Get(this, receiver);
if (!access_check_info) return false;
Object* fun_obj = access_check_info->callback();
callback = v8::ToCData<v8::AccessCheckCallback>(fun_obj);
« no previous file with comments | « src/api.cc ('k') | src/keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698