Jeremy Apthorp 2019-01-09 11:17:05 -08:00
parent 7d5cd2051a
commit d01db5a656
26 changed files with 94 additions and 46 deletions

View file

@ -106,7 +106,9 @@ class Dictionary {
bool SetMethod(const base::StringPiece& key, const T& callback) {
return GetHandle()->Set(
StringToV8(isolate_, key),
CallbackTraits<T>::CreateTemplate(isolate_, callback)->GetFunction());
CallbackTraits<T>::CreateTemplate(isolate_, callback)
->GetFunction(isolate_->GetCurrentContext())
.ToLocalChecked());
}
bool Delete(const base::StringPiece& key) {

View file

@ -39,7 +39,8 @@ void WrappableBase::InitWith(v8::Isolate* isolate,
// Call object._init if we have one.
v8::Local<v8::Function> init;
if (Dictionary(isolate, wrapper).Get("_init", &init))
init->Call(wrapper, 0, nullptr);
init->Call(isolate->GetCurrentContext(), wrapper, 0, nullptr)
.ToLocalChecked();
AfterInit(isolate);
}