Skip to content

Commit 174e09f

Browse files
authored
Update CDPSessionIdSupport.md
1 parent 5375fbe commit 174e09f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

specs/CDPSessionIdSupport.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ There is also some nuance for DevToolsProtocol's target management. If you are i
2525

2626
However, dedicated web workers are not returned from `'Target.getTargets'`, and you have to call DevToolsProtocol method `Target.setAutoAttach` to be able to attach to them.
2727

28-
Shared worker is separate from any page or iframe target, and therefore will not be auto attached. You have to call `Target.attachToTarget` to attach to them. The shared workers are enumerated with 'Target.getTargets'. They are also discoverable, that is, you can call `Target.setDiscoverTargets` to receive `Target.targetCreated` event for them.
28+
And shared worker is separate from any page or iframe target, and therefore will not be auto attached. You have to call `Target.attachToTarget` to attach to them. The shared workers can be enumerated with `Target.getTargets`. They are also discoverable, that is, you can call `Target.setDiscoverTargets` to receive `Target.targetCreated` event when a shared worker is created.
2929

3030
# Examples
3131

@@ -44,6 +44,7 @@ void MyApp::HandleDevToolsProtocalPTargets()
4444
// GetJSONStringField is a helper function that can retrieve a string field from a json message.
4545

4646
wil::com_ptr<ICoreWebView2DevToolsProtocolEventReceiver> receiver;
47+
// Listen to Runtime.consoleAPICalled event which is triggered when console.log is called by script code.
4748
CHECK_FAILURE(
4849
m_webView->GetDevToolsProtocolEventReceiver(L"Runtime.consoleAPICalled", &receiver));
4950
CHECK_FAILURE(receiver->add_DevToolsProtocolEventReceived(
@@ -52,7 +53,7 @@ void MyApp::HandleDevToolsProtocalPTargets()
5253
ICoreWebView2* sender,
5354
ICoreWebView2DevToolsProtocolEventReceivedEventArgs* args) -> HRESULT
5455
{
55-
// Get related target and details for the console.log
56+
// Get console.log message details and which target it comes from
5657
wil::unique_cotaskmem_string parameterObjectAsJson;
5758
CHECK_FAILURE(args->get_ParameterObjectAsJson(&parameterObjectAsJson));
5859
std::wstring eventSource;
@@ -175,7 +176,7 @@ void MyApp::HandleDevToolsProtocalPTargets()
175176
176177
private void CoreWebView2_ConsoleAPICalled(CoreWebView2 sender, CoreWebView2DevToolsProtocolEventReceivedEventArgs args)
177178
{
178-
// Retrieve target info and details for the console.log.
179+
// Figure out which target the console.log comes from
179180
string eventSource;
180181
string sessionId = args.SessionId;
181182
if (sessionId.Length > 0)

0 commit comments

Comments
 (0)