-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] IJavascriptEngine implements IDisposable where available #11594
[dotnet] IJavascriptEngine implements IDisposable where available #11594
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test or something we can see the difference in behavior? The explanation makes sense, but I really don't understand Dispose
at all and don't see how the description results in that code?
This doesn't change behavior, it's just that there's an open session hanging around, beyond the lifespan of the
Sure, so the However, DevToolsSession is itself an However, as it stands, This PR passes that along to the |
This is the standard dispose pattern, where Dispose() is a sealed method, while Dispose(bool) can be overridden by a derived class. So if another class extends protected override void Dispose(bool disposing)
{
if (disposing)
{
// whatever additional disposal you need
}
base.Dispose(disposing);
} but users of the derived class still only need to call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation, makes sense. I will wait for the CI and then merge.
Looking forward to future contributions!
JavascriptExecutor takes an IWebDriver and, on a lazy basis, opens a DevToolsSession which it currently leaves open. This PR disposes on that DevToolsSession if it was instantiated.
After SeleniumHQ/selenium#11594 was merged in v4.8.1, IJavascriptEngine now implements IDisposable and should be disposed of with the `using` statement, as is standard practice.
After SeleniumHQ/selenium#11594 was merged in v4.8.1, IJavascriptEngine now implements IDisposable and should be disposed of with the `using` statement, as is standard practice.
After SeleniumHQ/selenium#11594 was merged in v4.8.1, IJavascriptEngine now implements IDisposable and should be disposed of with the `using` statement, as is standard practice.
After SeleniumHQ/selenium#11594 was merged in v4.8.1, IJavascriptEngine now implements IDisposable and should be disposed of with the `using` statement, as is standard practice. 0eeeeca
JavascriptExecutor takes an IWebDriver and, on a lazy basis, opens a DevToolsSession which it currently leaves open. This PR disposes on that DevToolsSession if it was instantiated.
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Closes the DevToolsSession in JavascriptEngine if it's been opened.
Motivation and Context
cq
Types of changes
Checklist