Suppress exceptions due to exception meta-data

Associating exception meta-data may throw an exception if the
browser is under memory pressure. This CL adds a try-catch
scope to prevent surfacing of said exceptions in Chrome.

Bug: chromium:1226360
Change-Id: Ide969273b2ac6dc109370ba2adcb20586ef30bff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3008214
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75580}
This commit is contained in:
Sigurd Schneider 2021-07-06 09:39:08 +02:00 committed by V8 LUCI CQ
parent dc6acd1533
commit 668e48bd49
2 changed files with 2 additions and 0 deletions

View File

@ -402,6 +402,7 @@ V8ConsoleMessage::getAssociatedExceptionData(
inspector->getAssociatedExceptionData(exception); inspector->getAssociatedExceptionData(exception);
v8::Local<v8::Object> data; v8::Local<v8::Object> data;
if (!maybe_data.ToLocal(&data)) return nullptr; if (!maybe_data.ToLocal(&data)) return nullptr;
v8::TryCatch tryCatch(isolate);
v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope microtasksScope(isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Context::Scope contextScope(context); v8::Context::Scope contextScope(context);

View File

@ -512,6 +512,7 @@ bool V8InspectorImpl::associateExceptionData(v8::Local<v8::Context>,
} }
v8::Local<v8::Context> context; v8::Local<v8::Context> context;
if (!exceptionMetaDataContext().ToLocal(&context)) return false; if (!exceptionMetaDataContext().ToLocal(&context)) return false;
v8::TryCatch tryCatch(m_isolate);
v8::Context::Scope contextScope(context); v8::Context::Scope contextScope(context);
v8::HandleScope handles(m_isolate); v8::HandleScope handles(m_isolate);
if (m_exceptionMetaData.IsEmpty()) if (m_exceptionMetaData.IsEmpty())