| Index: extensions/renderer/script_context.cc
|
| diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
|
| index f611ddebf7112e9d6fb6b63aa5d993fb77fc4c07..01e0b297f751faf4df171bd2c918421b12b8962d 100644
|
| --- a/extensions/renderer/script_context.cc
|
| +++ b/extensions/renderer/script_context.cc
|
| @@ -202,6 +202,22 @@ v8::Local<v8::Value> ScriptContext::CallFunction(
|
| function, global, argc, argv)));
|
| }
|
|
|
| +void ScriptContext::SafeCallFunction(const v8::Local<v8::Function>& function,
|
| + int argc,
|
| + v8::Local<v8::Value> argv[]) {
|
| + v8::HandleScope handle_scope(isolate());
|
| + v8::Context::Scope scope(v8_context());
|
| + v8::MicrotasksScope microtasks(isolate(),
|
| + v8::MicrotasksScope::kDoNotRunMicrotasks);
|
| + v8::Local<v8::Object> global = v8_context()->Global();
|
| + if (web_frame_) {
|
| + web_frame_->requestExecuteV8Function(function, global, argc, argv, nullptr);
|
| + } else {
|
| + // TODO(devlin): This probably isn't safe.
|
| + function->Call(global, argc, argv);
|
| + }
|
| +}
|
| +
|
| v8::Local<v8::Value> ScriptContext::CallFunction(
|
| const v8::Local<v8::Function>& function) const {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|