diff options
Diffstat (limited to 'src/env-inl.h')
-rw-r--r-- | src/env-inl.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/env-inl.h b/src/env-inl.h index 3556458f9d7..e4a635c84d3 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -715,13 +715,15 @@ inline v8::Local<v8::FunctionTemplate> inline void Environment::SetMethod(v8::Local<v8::Object> that, const char* name, v8::FunctionCallback callback) { + v8::Local<v8::Context> context = isolate()->GetCurrentContext(); v8::Local<v8::Function> function = - NewFunctionTemplate(callback, - v8::Local<v8::Signature>(), + NewFunctionTemplate(callback, v8::Local<v8::Signature>(), // TODO(TimothyGu): Investigate if SetMethod is ever // used for constructors. v8::ConstructorBehavior::kAllow, - v8::SideEffectType::kHasSideEffect)->GetFunction(); + v8::SideEffectType::kHasSideEffect) + ->GetFunction(context) + .ToLocalChecked(); // kInternalized strings are created in the old space. const v8::NewStringType type = v8::NewStringType::kInternalized; v8::Local<v8::String> name_string = @@ -733,13 +735,15 @@ inline void Environment::SetMethod(v8::Local<v8::Object> that, inline void Environment::SetMethodNoSideEffect(v8::Local<v8::Object> that, const char* name, v8::FunctionCallback callback) { + v8::Local<v8::Context> context = isolate()->GetCurrentContext(); v8::Local<v8::Function> function = - NewFunctionTemplate(callback, - v8::Local<v8::Signature>(), + NewFunctionTemplate(callback, v8::Local<v8::Signature>(), // TODO(TimothyGu): Investigate if SetMethod is ever // used for constructors. v8::ConstructorBehavior::kAllow, - v8::SideEffectType::kHasNoSideEffect)->GetFunction(); + v8::SideEffectType::kHasNoSideEffect) + ->GetFunction(context) + .ToLocalChecked(); // kInternalized strings are created in the old space. const v8::NewStringType type = v8::NewStringType::kInternalized; v8::Local<v8::String> name_string = |