Commit 8fd298d8 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

Check for an empty V8 context in memory measurement experiment

The timer that starts the memory measurement in the Finch experiment
can fire for a frame that was detached leading to a nullptr access.

Bug: 1105494
Change-Id: I37a2b067acb24303fc5da5a7b7d2855445f28847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2320672Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792253}
parent c5acf54d
......@@ -510,6 +510,10 @@ void WindowPerformance::MeasureMemoryExperimentTimerFired(TimerBase*) {
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context =
ToV8Context(GetFrame(), DOMWrapperWorld::MainWorld());
if (context.IsEmpty()) {
// The frame has been detached in the meantime.
return;
}
isolate->MeasureMemory(
std::make_unique<MeasureMemoryDelegate>(isolate, context),
v8::MeasureMemoryExecution::kDefault);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment