[inspector] Provide more details about destroyed context

Runtime.executionContextCreated provides many details in
ExecutionContextDescription structure while
Runtime.executionContextDestroyed provides only executionContextId. This
information is insufficient for the clients that use uniqueContextId.

Bug: v8:12896
Change-Id: I31df0ed618dc1c8b55c7eba8f96eeaef2d4de6c8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3657439
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Vladimir Nechaev <nechaev@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85110}
This commit is contained in:
Vladimir Nechaev 2023-01-04 18:14:42 +00:00 committed by V8 LUCI CQ
parent d333e5b5aa
commit ca3a939da8
5 changed files with 11 additions and 3 deletions

View File

@ -1741,7 +1741,9 @@ domain Runtime
event executionContextDestroyed
parameters
# Id of the destroyed context
ExecutionContextId executionContextId
deprecated ExecutionContextId executionContextId
# Unique Id of the destroyed context
experimental string executionContextUniqueId
# Issued when all executionContexts were cleared in browser
event executionContextsCleared

View File

@ -997,7 +997,8 @@ void V8RuntimeAgentImpl::reportExecutionContextDestroyed(
InspectedContext* context) {
if (m_enabled && context->isReported(m_session->sessionId())) {
context->setReported(m_session->sessionId(), false);
m_frontend.executionContextDestroyed(context->contextId());
m_frontend.executionContextDestroyed(context->contextId(),
context->uniqueId().toString());
}
}

View File

@ -36,7 +36,8 @@ InspectorTest.logMessage = function(originalMessage) {
const nonStableFields = new Set([
'objectId', 'scriptId', 'exceptionId', 'timestamp', 'executionContextId',
'callFrameId', 'breakpointId', 'bindRemoteObjectFunctionId',
'formatterObjectId', 'debuggerId', 'bodyGetterId', 'uniqueId'
'formatterObjectId', 'debuggerId', 'bodyGetterId', 'uniqueId',
'executionContextUniqueId'
]);
const message = JSON.parse(JSON.stringify(originalMessage, replacer.bind(null, Symbol(), nonStableFields)));
if (message.id)

View File

@ -3,5 +3,6 @@ Tests that contextDesrtoyed nofitication is fired when context is collected.
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}

View File

@ -70,6 +70,7 @@ From session 2
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}
id matching: true
@ -78,6 +79,7 @@ From session 1
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}
id matching: true
@ -86,6 +88,7 @@ From session 3
method : Runtime.executionContextDestroyed
params : {
executionContextId : <executionContextId>
executionContextUniqueId : <executionContextUniqueId>
}
}
id matching: true