diff --git a/src/node_perf.cc b/src/node_perf.cc index 5f1b70a5c4db6c..d3ee881f59d257 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -310,7 +310,7 @@ void TimerFunctionCall(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); - CHECK_NOT_NULL(env); // TODO(addaleax): Verify that this is correct. + CHECK_NOT_NULL(env); Local context = env->context(); Local fn = args.Data().As(); size_t count = args.Length(); diff --git a/test/addons/non-node-context/binding.cc b/test/addons/non-node-context/binding.cc new file mode 100644 index 00000000000000..324f5c5a1ef16f --- /dev/null +++ b/test/addons/non-node-context/binding.cc @@ -0,0 +1,55 @@ +#include +#include + +namespace { + +using v8::Context; +using v8::Function; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::MaybeLocal; +using v8::NewStringType; +using v8::Object; +using v8::Script; +using v8::String; +using v8::Value; + +inline void RunInNewContext( + const v8::FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = Context::New(isolate); + Context::Scope context_scope(context); + + context->Global()->Set( + context, + String::NewFromUtf8(isolate, "data", NewStringType::kNormal) + .ToLocalChecked(), + args[1]).FromJust(); + + assert(args[0]->IsString()); // source code + Local