@@ -58,8 +58,7 @@ class ContextifyContext {
5858 Persistent<Context> context_;
5959
6060 public:
61- explicit ContextifyContext (Environment* env, Local<Object> sandbox_obj)
62- : env_(env) {
61+ ContextifyContext (Environment* env, Local<Object> sandbox_obj) : env_(env) {
6362 Local<Context> v8_context = CreateV8Context (env, sandbox_obj);
6463 context_.Reset (env->isolate (), v8_context);
6564
@@ -122,14 +121,15 @@ class ContextifyContext {
122121 Local<Context> context = PersistentToLocal (env ()->isolate (), context_);
123122 Local<Object> global =
124123 context->Global ()->GetPrototype ()->ToObject (env ()->isolate ());
124+ Local<Object> sandbox_obj = sandbox ();
125125
126126 Local<Function> clone_property_method;
127127
128128 Local<Array> names = global->GetOwnPropertyNames ();
129129 int length = names->Length ();
130130 for (int i = 0 ; i < length; i++) {
131131 Local<String> key = names->Get (i)->ToString (env ()->isolate ());
132- bool has = sandbox () ->HasOwnProperty (context, key).FromJust ();
132+ bool has = sandbox_obj ->HasOwnProperty (context, key).FromJust ();
133133 if (!has) {
134134 // Could also do this like so:
135135 //
@@ -161,7 +161,7 @@ class ContextifyContext {
161161 clone_property_method = Local<Function>::Cast (script->Run ());
162162 CHECK (clone_property_method->IsFunction ());
163163 }
164- Local<Value> args[] = { global, key, sandbox () };
164+ Local<Value> args[] = { global, key, sandbox_obj };
165165 clone_property_method->Call (global, ARRAY_SIZE (args), args);
166166 }
167167 }
@@ -336,16 +336,18 @@ class ContextifyContext {
336336 if (ctx->context_ .IsEmpty ())
337337 return ;
338338
339+ Local<Context> context = ctx->context ();
340+ Local<Object> sandbox = ctx->sandbox ();
339341 MaybeLocal<Value> maybe_rv =
340- ctx-> sandbox () ->GetRealNamedProperty (ctx-> context () , property);
342+ sandbox->GetRealNamedProperty (context, property);
341343 if (maybe_rv.IsEmpty ()) {
342344 maybe_rv =
343- ctx->global_proxy ()->GetRealNamedProperty (ctx-> context () , property);
345+ ctx->global_proxy ()->GetRealNamedProperty (context, property);
344346 }
345347
346348 Local<Value> rv;
347349 if (maybe_rv.ToLocal (&rv)) {
348- if (rv == ctx-> sandbox () )
350+ if (rv == sandbox)
349351 rv = ctx->global_proxy ();
350352
351353 args.GetReturnValue ().Set (rv);
@@ -378,14 +380,14 @@ class ContextifyContext {
378380 if (ctx->context_ .IsEmpty ())
379381 return ;
380382
383+ Local<Context> context = ctx->context ();
381384 Maybe<PropertyAttribute> maybe_prop_attr =
382- ctx->sandbox ()->GetRealNamedPropertyAttributes (ctx->context (),
383- property);
385+ ctx->sandbox ()->GetRealNamedPropertyAttributes (context, property);
384386
385387 if (maybe_prop_attr.IsNothing ()) {
386388 maybe_prop_attr =
387- ctx->global_proxy ()->GetRealNamedPropertyAttributes (ctx-> context () ,
388- property);
389+ ctx->global_proxy ()->GetRealNamedPropertyAttributes (context,
390+ property);
389391 }
390392
391393 if (maybe_prop_attr.IsJust ()) {
0 commit comments