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

[5.x] Bugfix quoting for InteractsWithElements::value #735

Merged
merged 3 commits into from
Feb 13, 2020
Merged

[5.x] Bugfix quoting for InteractsWithElements::value #735

merged 3 commits into from
Feb 13, 2020

Conversation

DasRed
Copy link
Contributor

@DasRed DasRed commented Feb 13, 2020

This handles JS quoting a little bit better.

We found the bug for quoting of JS by calling the method InteractsWithElements::value.
If you call this method with following arguments

  • '#selector'
  • 'abc'def'
    will break the generated JS code.

Then we found this pull request: #693
But the pull request does not fully fix this problem. If you us an value, which has an line break, then the generated JS Code will break again.

This pull request fix this completely.
No breaking changes

The value function does not correctly escape the contents of $value variable as a result if someone passes a string even with a escaped single quote, the code breaks because value is assigned using single quotes on line 69 argument passed to executeScript,
"document.querySelector('{$selector}').value = '{$value}';"

$browser->value('my'Field', "long text\nwith line breaks");
Current output of the script:

document.querySelector('my\'Field').value = 'Field
s Name';

Expected output of the script:

document.querySelector("my'Field").value ="long text\nwith line breaks";

Please take also a closer look at #734

@driesvints driesvints changed the title Bugfix quoting for InteractsWithElements::value [5.x] Bugfix quoting for InteractsWithElements::value Feb 13, 2020
@driesvints
Copy link
Member

Heya thanks. How is this different from #734?

@DasRed
Copy link
Contributor Author

DasRed commented Feb 13, 2020

Heya thanks. How is this different from #734?

Hey, there is no difference between this PR and #734. I made this PR, because we need the fix into v5.x for our testing ;)

A new dusk release would be nice with this PR in next days :)

@driesvints
Copy link
Member

@DasRed releases are done weekly on Tuesdays so if this gets merged it'll be in the release of next Tuesday.

@taylorotwell taylorotwell merged commit 986f808 into laravel:5.0 Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants