| Index: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
|
| index ccd7a6f1f3efd7f276404ceecb5153aba848bd6e..6117ad46d8f0acfdf01748eeb04666b91d31ad83 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
|
| @@ -458,11 +458,16 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f
|
| }
|
| if (!depth)
|
| TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", InspectorFunctionCallEvent::data(context, function));
|
| - v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks);
|
| - ThreadDebugger::willExecuteScript(isolate, function->ScriptId());
|
| - v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext(), receiver, argc, args);
|
| - crashIfIsolateIsDead(isolate);
|
| - ThreadDebugger::didExecuteScript(isolate);
|
| + v8::MaybeLocal<v8::Value> result;
|
| + {
|
| + // Create an extra block so FunctionCall trace event end phase is recorded after
|
| + // v8::MicrotasksScope destructor, as the latter is running microtasks.
|
| + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks);
|
| + ThreadDebugger::willExecuteScript(isolate, function->ScriptId());
|
| + result = function->Call(isolate->GetCurrentContext(), receiver, argc, args);
|
| + crashIfIsolateIsDead(isolate);
|
| + ThreadDebugger::didExecuteScript(isolate);
|
| + }
|
| if (!depth)
|
| TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
|
| return result;
|
|
|