Index: test/cctest/test-decls.cc |
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc |
index 6216d67bd8889e183bfc60447fdb94198341688a..6be5303cde4643fd85b75b362d40f7905652f063 100644 |
--- a/test/cctest/test-decls.cc |
+++ b/test/cctest/test-decls.cc |
@@ -118,7 +118,8 @@ DeclarationContext::DeclarationContext() |
void DeclarationContext::InitializeIfNeeded() { |
if (is_initialized_) return; |
- HandleScope scope(Isolate::GetCurrent()); |
+ Isolate* isolate = Isolate::GetCurrent(); |
+ HandleScope scope(isolate); |
Local<FunctionTemplate> function = FunctionTemplate::New(); |
Local<Value> data = External::New(this); |
GetHolder(function)->SetNamedPropertyHandler(&HandleGet, |
@@ -126,10 +127,14 @@ void DeclarationContext::InitializeIfNeeded() { |
&HandleQuery, |
0, 0, |
data); |
- context_ = Context::New(0, function->InstanceTemplate(), Local<Value>()); |
+ context_.Reset(isolate, |
+ Context::New(isolate, |
+ 0, |
+ function->InstanceTemplate(), |
+ Local<Value>())); |
context_->Enter(); |
is_initialized_ = true; |
- PostInitializeContext(Local<Context>::New(Isolate::GetCurrent(), context_)); |
+ PostInitializeContext(Local<Context>::New(isolate, context_)); |
} |
@@ -699,14 +704,14 @@ TEST(ExistsInHiddenPrototype) { |
class SimpleContext { |
public: |
- SimpleContext() { |
- context_ = Context::New(); |
+ SimpleContext() |
+ : handle_scope_(Isolate::GetCurrent()), |
+ context_(Context::New(Isolate::GetCurrent())) { |
context_->Enter(); |
} |
- virtual ~SimpleContext() { |
+ ~SimpleContext() { |
context_->Exit(); |
- context_.Dispose(context_->GetIsolate()); |
} |
void Check(const char* source, |
@@ -737,7 +742,8 @@ class SimpleContext { |
} |
private: |
- Persistent<Context> context_; |
+ HandleScope handle_scope_; |
+ Local<Context> context_; |
}; |