[dotnet] Fix JavaScriptEngine.ScriptCallbackBindings not containing new bindings - #15221
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
Failures are not related to changes in this PR: //dotnet/test/common:BiDi/Network/NetworkEventsTest-firefox
//java/test/org/openqa/selenium/mobile:NetworkConnectionTest
//java/test/org/openqa/selenium/remote:RemoteWebDriverScreenshotTest
//java/test/org/openqa/selenium/remote:RemoteWebDriverScreenshotTest-firefox-beta |
… new bindings (SeleniumHQ#15221) * [dotnet] Fix `JavaScriptEngine.ScriptCallbackBindings` not containing new bindings * Add tests * Implement IEquatable on `InitializationScript` * Remove implementation of IEquatable, override normal `Equals` * Override InitializationScript.GetHashCode
… new bindings (SeleniumHQ#15221) * [dotnet] Fix `JavaScriptEngine.ScriptCallbackBindings` not containing new bindings * Add tests * Implement IEquatable on `InitializationScript` * Remove implementation of IEquatable, override normal `Equals` * Override InitializationScript.GetHashCode
User description
… new bindings
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.
Motivation and Context
If a use accesses
JavaScriptEngine.ScriptCallbackBindings, the list will always be empty.Types of changes
Checklist
PR Type
Bug fix, Tests
Description
Fixed
JavaScriptEngine.ScriptCallbackBindingsto correctly track bindings.Replaced
List<string>withHashSet<string>for bindings to ensure uniqueness.Added comprehensive tests for initialization scripts and script callback bindings.
Improved resource management with
usingstatements in tests.Changes walkthrough 📝
JavaScriptEngine.cs
Refactor bindings to use `HashSet` for uniquenessdotnet/src/webdriver/JavaScriptEngine.cs
bindingsfromListtoHashSetfor uniqueness.AddScriptCallbackBindingto useHashSet.Addfor validation.RemoveScriptCallbackBindingto discard the result ofRemove.ExecutingJavascriptTest.cs
Add tests for script bindings and initialization scriptsdotnet/test/common/ExecutingJavascriptTest.cs
usingforJavaScriptEngine.