Allow "Await Debugger" in V8 at any time, rather than just on startup #121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In our application we execute a lot of global/system scripts before we get to the "user" scripts, and most of the time its only those later scripts that we care about debugging, and normally only specific methods inside those user scripts, so pausing execution on startup is a little "heavy handed". Currently I am working around this by manually poking the flag in the V8ScriptEngine with reflection:
This works fine, but thought it would be nice to make this a supported thing to do, so this PR adds a single method to V8ScriptEngine that lets you set this flag on demand. Its a method rather than just setting the property directly because using a property setter feels like the caller has the responsibility to flip it back afterwards, but the script engine does that itself on next execution.
I haven't added any tests for this because I couldn't see how (other than changing the visibility of the field, which felt icky), but its only a 3 line method so hopefully that's ok :)