Skip to content
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

[java] removed the broken escape #11110

Merged
merged 1 commit into from
Oct 12, 2022
Merged

Conversation

joerg1985
Copy link
Member

Description

The escaping of javascript was broken, it replaced a quote with a identical quote to escape it.

I guess the original author tried to add a backslash to escape the quote, but the magic behind the String.replaceAll swallows the backslash. This will lead to a identical string before and after escaping the string.
(To get the assumed behavior it should have been script.replaceAll("\"", "\\\\\"") and not script.replaceAll("\"", "\\\"") )

The String.replaceAll call was dropped in this PR to get rid of this confusing code.

Motivation and Context

Overhead processing the RegEx / get rid of confusing code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

The quote marks were replaced by identical quote marks to escape them.
This is an unnecessary operation, as the resulting string will be
identical to the original string.
@codecov-commenter
Copy link

Codecov Report

Base: 52.31% // Head: 52.31% // No change to project coverage 👍

Coverage data is based on head (b723b53) compared to base (9e91560).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #11110   +/-   ##
=======================================
  Coverage   52.31%   52.31%           
=======================================
  Files          82       82           
  Lines        5503     5503           
  Branches      198      198           
=======================================
  Hits         2879     2879           
  Misses       2426     2426           
  Partials      198      198           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sonarcloud
Copy link

sonarcloud bot commented Oct 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @joerg1985!

@diemol diemol merged commit 7a20400 into SeleniumHQ:trunk Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants