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