-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dotnet] Added function to enable halting targets until runtime.runIfWaitingForDebugger is invoked #13330
Conversation
…of a command. typeof() determines the type compile time.
…s until runtime.runIfWaitingForDebugger is invoked.
…nterface. Marked old functions with only protocol version as obsolete.
Looks good to me, thank you @EdwinVanVliet . Last ask: can we create at least one test which demonstrates how to use this new feature in area of capturing network requests in newly opened browser tab? |
Sounds like a good idea, however with current setup that's not possible yet. When halting the tab an event is raised indicating a new target is created. To continue that target at least two commands need to be issued (runtime.runIfWaitingForDebugger and Network.enable). The problem here is that command will be blocked until runtime.runIfWaitingForDebugger is invoked. To workaround that we sent the commands in one batch without blocking each other. That will be introduced in the following PR and I will try to add a test case demonstrating the behavior with that. |
Thanks @EdwinVanVliet , looking forward your contribution. |
Description
This PR introduces
EnableWaitForDebuggerOnStart
function toDevToolsSession.cs
which enables halting new targets (tabs for instance) until theruntime.runIfWaitingForDebugger
command is invoked. For instance when wanting to capture the network traffic on a new target, the network domain should be instructed to do so before the target is doing any network traffic.In PR #13175 the datastructure for listening to the TargetAttached events was introduced.
In a follow up pull request I will introduce the ability to sent multiple DevTools commands in a single SendCommand function. This will allow proper handling of the TargetAttached event. The singular SendCommand function will get blocked because the commands running against that target will be blocked until
runtime.runIfWaitingForDebugger
is invoked. By bundling the commands we can get around that issue.Also see; #10603
Motivation and Context
When a new target (new tab for instance) is created DevTools continues execution based on the WaitForDebugger property set in the SetAutoAttach feature. When the WaitForDebugger property is set to false DevTools continues without waiting the consumer to properly enable all domains on the target. For instance when being interested in network events from the network domain we need to invoke Network.enable for that specific target. The current behavior causes some of the network events to be missing due to Selenium enabling the domains after the target already performed network requests.
By allowing consumers to enable the WaitForDebugger property we can enable all domains and tell DevTools whenever we are ready by using the Run.runIfWaitingForDebugger command.
Types of changes
Checklist