| Index: extensions/renderer/api_binding.cc
|
| diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc
|
| index 2f585a0f6bb291223cec129a1a38c375ea57156d..a1351b833c4d48355178f0fffdcb1c6070e664b2 100644
|
| --- a/extensions/renderer/api_binding.cc
|
| +++ b/extensions/renderer/api_binding.cc
|
| @@ -290,6 +290,9 @@ v8::Local<v8::Object> APIBinding::CreateInstance(
|
| DCHECK(success.FromJust());
|
| }
|
|
|
| + if (binding_hooks_)
|
| + binding_hooks_->InitializeInContext(context, api_name_);
|
| +
|
| return object;
|
| }
|
|
|
| @@ -300,10 +303,14 @@ void APIBinding::HandleCall(const std::string& name,
|
| v8::Isolate* isolate = arguments->isolate();
|
| v8::HandleScope handle_scope(isolate);
|
|
|
| + // Since this is called synchronously from the JS entry point,
|
| + // GetCurrentContext() should always be correct.
|
| + v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
| +
|
| if (binding_hooks_) {
|
| // Check for a custom hook to handle the method.
|
| APIBindingHooks::HandleRequestHook handler =
|
| - binding_hooks_->GetHandleRequest(name);
|
| + binding_hooks_->GetHandleRequest(api_name_, name, context);
|
| if (!handler.is_null()) {
|
| handler.Run(signature, arguments);
|
| return;
|
| @@ -327,10 +334,8 @@ void APIBinding::HandleCall(const std::string& name,
|
| return;
|
| }
|
|
|
| - // Since this is called synchronously from the JS entry point,
|
| - // GetCurrentContext() should always be correct.
|
| method_callback_.Run(name, std::move(parsed_arguments), isolate,
|
| - isolate->GetCurrentContext(), callback);
|
| + context, callback);
|
| }
|
|
|
| } // namespace extensions
|
|
|