@@ -58,8 +58,7 @@ class ContextifyContext {
58
58
Persistent<Context> context_;
59
59
60
60
public:
61
- explicit ContextifyContext (Environment* env, Local<Object> sandbox_obj)
62
- : env_(env) {
61
+ ContextifyContext (Environment* env, Local<Object> sandbox_obj) : env_(env) {
63
62
Local<Context> v8_context = CreateV8Context (env, sandbox_obj);
64
63
context_.Reset (env->isolate (), v8_context);
65
64
@@ -122,14 +121,15 @@ class ContextifyContext {
122
121
Local<Context> context = PersistentToLocal (env ()->isolate (), context_);
123
122
Local<Object> global =
124
123
context->Global ()->GetPrototype ()->ToObject (env ()->isolate ());
124
+ Local<Object> sandbox_obj = sandbox ();
125
125
126
126
Local<Function> clone_property_method;
127
127
128
128
Local<Array> names = global->GetOwnPropertyNames ();
129
129
int length = names->Length ();
130
130
for (int i = 0 ; i < length; i++) {
131
131
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 ();
133
133
if (!has) {
134
134
// Could also do this like so:
135
135
//
@@ -161,7 +161,7 @@ class ContextifyContext {
161
161
clone_property_method = Local<Function>::Cast (script->Run ());
162
162
CHECK (clone_property_method->IsFunction ());
163
163
}
164
- Local<Value> args[] = { global, key, sandbox () };
164
+ Local<Value> args[] = { global, key, sandbox_obj };
165
165
clone_property_method->Call (global, ARRAY_SIZE (args), args);
166
166
}
167
167
}
@@ -335,16 +335,18 @@ class ContextifyContext {
335
335
if (ctx->context_ .IsEmpty ())
336
336
return ;
337
337
338
+ Local<Context> context = ctx->context ();
339
+ Local<Object> sandbox = ctx->sandbox ();
338
340
MaybeLocal<Value> maybe_rv =
339
- ctx-> sandbox () ->GetRealNamedProperty (ctx-> context () , property);
341
+ sandbox->GetRealNamedProperty (context, property);
340
342
if (maybe_rv.IsEmpty ()) {
341
343
maybe_rv =
342
- ctx->global_proxy ()->GetRealNamedProperty (ctx-> context () , property);
344
+ ctx->global_proxy ()->GetRealNamedProperty (context, property);
343
345
}
344
346
345
347
Local<Value> rv;
346
348
if (maybe_rv.ToLocal (&rv)) {
347
- if (rv == ctx-> sandbox () )
349
+ if (rv == sandbox)
348
350
rv = ctx->global_proxy ();
349
351
350
352
args.GetReturnValue ().Set (rv);
@@ -377,14 +379,14 @@ class ContextifyContext {
377
379
if (ctx->context_ .IsEmpty ())
378
380
return ;
379
381
382
+ Local<Context> context = ctx->context ();
380
383
Maybe<PropertyAttribute> maybe_prop_attr =
381
- ctx->sandbox ()->GetRealNamedPropertyAttributes (ctx->context (),
382
- property);
384
+ ctx->sandbox ()->GetRealNamedPropertyAttributes (context, property);
383
385
384
386
if (maybe_prop_attr.IsNothing ()) {
385
387
maybe_prop_attr =
386
- ctx->global_proxy ()->GetRealNamedPropertyAttributes (ctx-> context () ,
387
- property);
388
+ ctx->global_proxy ()->GetRealNamedPropertyAttributes (context,
389
+ property);
388
390
}
389
391
390
392
if (maybe_prop_attr.IsJust ()) {
0 commit comments