Don't crash on checking meta-data for non-object exceptions
Bug: chromium:1213393 Change-Id: I56817237424bb83aa9e5d06a47187f245c3cae0e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2983200 Commit-Queue: Sigurd Schneider <sigurds@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#75349}
This commit is contained in:
parent
0f471e8213
commit
79b1646753
@ -507,6 +507,9 @@ bool V8InspectorImpl::associateExceptionData(v8::Local<v8::Context>,
|
|||||||
v8::Local<v8::Value> exception,
|
v8::Local<v8::Value> exception,
|
||||||
v8::Local<v8::Name> key,
|
v8::Local<v8::Name> key,
|
||||||
v8::Local<v8::Value> value) {
|
v8::Local<v8::Value> value) {
|
||||||
|
if (!exception->IsObject()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
v8::Local<v8::Context> context;
|
v8::Local<v8::Context> context;
|
||||||
if (!exceptionMetaDataContext().ToLocal(&context)) return false;
|
if (!exceptionMetaDataContext().ToLocal(&context)) return false;
|
||||||
v8::Context::Scope contextScope(context);
|
v8::Context::Scope contextScope(context);
|
||||||
@ -535,6 +538,9 @@ bool V8InspectorImpl::associateExceptionData(v8::Local<v8::Context>,
|
|||||||
|
|
||||||
v8::MaybeLocal<v8::Object> V8InspectorImpl::getAssociatedExceptionData(
|
v8::MaybeLocal<v8::Object> V8InspectorImpl::getAssociatedExceptionData(
|
||||||
v8::Local<v8::Value> exception) {
|
v8::Local<v8::Value> exception) {
|
||||||
|
if (!exception->IsObject()) {
|
||||||
|
return v8::MaybeLocal<v8::Object>();
|
||||||
|
}
|
||||||
v8::EscapableHandleScope scope(m_isolate);
|
v8::EscapableHandleScope scope(m_isolate);
|
||||||
v8::Local<v8::Context> context;
|
v8::Local<v8::Context> context;
|
||||||
if (m_exceptionMetaData.IsEmpty() ||
|
if (m_exceptionMetaData.IsEmpty() ||
|
||||||
|
@ -103,3 +103,32 @@ Check that exceptionThrown is supported by test runner.
|
|||||||
timestamp : <timestamp>
|
timestamp : <timestamp>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
method : Runtime.exceptionThrown
|
||||||
|
params : {
|
||||||
|
exceptionDetails : {
|
||||||
|
columnNumber : 2
|
||||||
|
exception : {
|
||||||
|
description : 2
|
||||||
|
type : number
|
||||||
|
value : 2
|
||||||
|
}
|
||||||
|
exceptionId : <exceptionId>
|
||||||
|
executionContextId : <executionContextId>
|
||||||
|
lineNumber : 1
|
||||||
|
stackTrace : {
|
||||||
|
callFrames : [
|
||||||
|
[0] : {
|
||||||
|
columnNumber : 2
|
||||||
|
functionName :
|
||||||
|
lineNumber : 1
|
||||||
|
scriptId : <scriptId>
|
||||||
|
url :
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
text : Uncaught 2
|
||||||
|
}
|
||||||
|
timestamp : <timestamp>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -8,4 +8,5 @@ Protocol.Runtime.enable();
|
|||||||
Protocol.Runtime.onExceptionThrown(message => InspectorTest.logMessage(message));
|
Protocol.Runtime.onExceptionThrown(message => InspectorTest.logMessage(message));
|
||||||
contextGroup.addScript("throw inspector.newExceptionWithMetaData('myerror', 'foo', 'bar');");
|
contextGroup.addScript("throw inspector.newExceptionWithMetaData('myerror', 'foo', 'bar');");
|
||||||
Protocol.Runtime.evaluate({ expression: "setTimeout(() => { \n throw inspector.newExceptionWithMetaData('myerror2', 'foo2', 'bar2'); }, 0)" });
|
Protocol.Runtime.evaluate({ expression: "setTimeout(() => { \n throw inspector.newExceptionWithMetaData('myerror2', 'foo2', 'bar2'); }, 0)" });
|
||||||
|
Protocol.Runtime.evaluate({ expression: "setTimeout(() => { \n throw 2; }, 0)" });
|
||||||
InspectorTest.waitForPendingTasks().then(InspectorTest.completeTest);
|
InspectorTest.waitForPendingTasks().then(InspectorTest.completeTest);
|
||||||
|
Loading…
Reference in New Issue
Block a user