-
-
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
Issue 12549 fix atoms generation lowdash #15247
base: trunk
Are you sure you want to change the base?
Issue 12549 fix atoms generation lowdash #15247
Conversation
…xported function, also passing in entire window so that all pieces should have access to what they need.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
These suggestions could certainly be taken into account although they don't seem necessary or aid in further maintenance of the code. I am passing in window here as there have been issues brought forth where not everything was provided by the limited scope object passed in, using window would ensure everything is there. I am certainly not against using an even more specific name for the function, I figured mine was odd yet descriptive enough to not produce collisions, but this can be more specific certainly if necessary. I have only added the Skylark variable as the exported function name is used in two locations and I wanted to ensure it was easiest to deal with for future updates, previously there was no variable or validation of the exported function name (previously "_"). As there was no validation or explanation of the original, I'm uncertain it is necessary here (resulting JS errors should be sufficient). |
User description
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
The selenium atoms are used as part of the XCUITest iOS driver that is used in Appium, more specifically through appium-remote-debugger. The way they are currently generated is not working because of 2 issues, one where the window object passed in is not actually window, so it is missing some objects / properties that some atoms are expecting. The other issue is if window is actually used, it ends up overwriting "window._", causing projects that use lodash or underscore to break under automation.
This fix brings back using window itself, but also changes the exported function symbol to be something else so that "_" is not overwritten.
Types of changes
Checklist
Updated javascript/private/fragment.bzl file to use a new exported function name and also changed the wrapper to pass in window instead of just pieces of it. There is already a test added to verify injection of atoms clobbers "_" (selenium\java\test\org\openqa\selenium\AtomsInjectionTest.java), so I have not created any additional tests for this.
PR Type
Bug fix
Description
Fixed issue with atoms generation overwriting
window._
.Introduced
EXPORT_FUNCTION_NAME
to avoid conflicts with lodash/underscore.Updated wrapper to pass the entire
window
object for better compatibility.Changes walkthrough 📝
fragment.bzl
Refactored atoms export to avoid `window._` conflicts
javascript/private/fragment.bzl
EXPORT_FUNCTION_NAME
to define a unique exported function name.goog.exportSymbol
to useEXPORT_FUNCTION_NAME
.window
object.