Skip to content

Commit a4e7224

Browse files
authored
Update CDPSessionIdSupport.md
1 parent 4d63f80 commit a4e7224

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

specs/CDPSessionIdSupport.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ However, dedicated web workers are not returned from `'Target.getTargets'`, and
2727

2828
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

30+
To summarize, there are two ways of finding the targets and neither covers all 3 scenarios.
31+
32+
| | Web pages | Dedicated web workers | Shared workers |
33+
| --- | --- | --- | --- |
34+
| Target.getTargets, Target.setDiscoverTargets, Target.targetCreated, Target.attachToTarget || ||
35+
| Target.setAutoAttach, Target.attachedToTarget ||| |
36+
3037
# Examples
3138

3239
The example below illustrates how to collect messages logged by console.log calls by JavaScipt code from various parts of the web page, including dedicated web worker.
@@ -264,7 +271,7 @@ interface ICoreWebView2_10 : IUnknown {
264271
/// For more information about available methods, navigate to
265272
/// \[DevTools Protocol Viewer\]\[GithubChromedevtoolsDevtoolsProtocolTot\]
266273
/// The `sessionId` parameter is the sessionId for an attached target.
267-
/// nullptr or empty string is treated as the session for the default target.
274+
/// nullptr or empty string is treated as the session for the default target for the top page.
268275
/// The `methodName` parameter is the full name of the method in the
269276
/// `{domain}.{method}` format. The `parametersAsJson` parameter is a JSON
270277
/// formatted string containing the parameters for the corresponding method.
@@ -285,7 +292,7 @@ interface ICoreWebView2_10 : IUnknown {
285292
interface ICoreWebView2DevToolsProtocolEventReceivedEventArgs2 : IUnknown {
286293
287294
/// The sessionId of the target where the event originates from.
288-
/// Empty string is returned as sessionId if the event comes from the default session.
295+
/// Empty string is returned as sessionId if the event comes from the default session for the top page.
289296
/// \snippet ScriptComponent.cpp DevToolsProtocolEventReceivedSessionId
290297
[propget] HRESULT SessionId([out, retval] LPWSTR* sessionId);
291298
}
@@ -299,8 +306,12 @@ namespace Microsoft.Web.WebView2.Core
299306
{
300307
// ...
301308
302-
// This is an overload for: public async Task<string> CallDevToolsProtocolMethodAsync(string methodName, string parametersAsJson);
303-
public async Task<string> CallDevToolsProtocolMethodAsync(string sessionId, string methodName, string parametersAsJson);
309+
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2_10")]
310+
{
311+
// ICoreWebView2_10 members
312+
// This is an overload for: public async Task<string> CallDevToolsProtocolMethodAsync(string methodName, string parametersAsJson);
313+
public async Task<string> CallDevToolsProtocolMethodAsync(string sessionId, string methodName, string parametersAsJson);
314+
}
304315
}
305316

306317
runtimeclass CoreWebView2DevToolsProtocolEventReceivedEventArgs

0 commit comments

Comments
 (0)