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

Unified Diff: src/isolate.cc

Issue 1398093002: Pass the context from which a given receiver is accessed explicitly (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/isolate.h ('k') | src/lookup.cc » ('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 481cb42f05fb71b694662bceed417bbd6dfdd88b..c6a66cc44143793f162c8631bc74644d1b660d3a 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -782,12 +782,12 @@ bool Isolate::IsInternallyUsedPropertyName(Object* name) {
}
-bool Isolate::MayAccess(Handle<JSObject> receiver) {
+bool Isolate::MayAccess(Handle<Context> accessing_context,
+ Handle<JSObject> receiver) {
DCHECK(receiver->IsJSGlobalProxy() || receiver->IsAccessCheckNeeded());
// Check for compatibility between the security tokens in the
// current lexical context and the accessed object.
- DCHECK(context());
{
DisallowHeapAllocation no_gc;
@@ -801,7 +801,8 @@ bool Isolate::MayAccess(Handle<JSObject> receiver) {
// Get the native context of current top context.
// avoid using Isolate::native_context() because it uses Handle.
- Context* native_context = context()->global_object()->native_context();
+ Context* native_context =
+ accessing_context->global_object()->native_context();
if (receiver_context == native_context) return true;
if (Context::cast(receiver_context)->security_token() ==
@@ -824,11 +825,16 @@ bool Isolate::MayAccess(Handle<JSObject> receiver) {
LOG(this, ApiSecurityCheck());
- // Leaving JavaScript.
- VMState<EXTERNAL> state(this);
- Handle<Object> key = factory()->undefined_value();
- return callback(v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(key),
- v8::ACCESS_HAS, v8::Utils::ToLocal(data));
+ {
+ SaveContext save(this);
+ set_context(accessing_context->native_context());
+
+ // Leaving JavaScript.
+ VMState<EXTERNAL> state(this);
+ Handle<Object> key = factory()->undefined_value();
+ return callback(v8::Utils::ToLocal(receiver), v8::Utils::ToLocal(key),
+ v8::ACCESS_HAS, v8::Utils::ToLocal(data));
+ }
}
« no previous file with comments | « src/isolate.h ('k') | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698