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

UFFI/TFFI call for WebBrowser with specific URL length adds strange characters to the URL #15980

Closed
astares opened this issue Jan 18, 2024 · 3 comments · Fixed by #16262
Closed

Comments

@astares
Copy link
Member

astares commented Jan 18, 2024

Bug description
Given a URL with a specific length to open in WebBrowser on Windows adds strange characters to the URL

To Reproduce

  • use Pharo 11 or 12 on Windows
  • Open Playground and run
WebBrowser openOn: 'https://pharo.org?abcdefghijklmnopqrstuvwxyz1234567890ok'.

you will see that strange characters added to the URL location in the webbrowser like

[https://pharo.org?abcdefghijklmnopqrstuvwxyz1234567890ok](https://pharo.org/?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa%C5%92()

Expected behavior
Expect the URL to stay the same as given and to correctly open on the web browser

Screenshots
image

Version information:

  • OS: Windows 10
  • Pharo Version 11 and 12, probably others too

Additional context

  • seems to be less a problem of URL content but more a problem of specific URL length. if you use other lenth it works
image

Using that URL in DOS just opens the correct location

image

Might possibly be an issue of UFFI/TFFI

@VincentBlondeau
Copy link
Contributor

The issue is in the FFI call. The WBWindowsWebBrowser is doing a call with String* which doesn't make sense in this context since it is not made to be written on.
A simple fix would be:
image
PR incoming.

See doc on FFI for reference:
https://files.pharo.org/books-pdfs/booklet-uFFI/UFFIDRAFT.pdf
image

VincentBlondeau added a commit to lifeware-sa/pharo that referenced this issue Feb 27, 2024
@astares
Copy link
Member Author

astares commented Feb 27, 2024

But in Pharo 8 this was working using the String* definition.

image

Maybe there was a change between the newer TFFI in P12 and (back then) the UFFI in P8.

@astares
Copy link
Member Author

astares commented Feb 28, 2024

@demarey
A full fix is provided as a PR in #16262

Because as now UFFI seems to be more strict it is required to also have a type definiton for the first parameter (constant 0)

shellExecute: lpOperation file: lpFile parameters: lpParameters directory: lpDirectory show: nShowCmd

	^ self ffiCall: #(
			FFIConstantHandle ShellExecuteA(
     				int 0, "Operation is not associated with a window"
     				String lpOperation,
         			String lpFile,
     				String lpParameters,
     				String lpDirectory,
        			int nShowCmd)) module: #shell32

MarcusDenker added a commit that referenced this issue Mar 1, 2024
Fix for:  UFFI/TFFI call for WebBrowser with specific URL length adds strange characters to the URL #15980
carolahp added a commit to carolahp/pharo that referenced this issue Mar 6, 2024
MarcusDenker added a commit that referenced this issue Mar 7, 2024
…owser-with-specific-URL-length-adds-strange-characters-to-the-URL-P11

Fix for: UFFI/TFFI call for WebBrowser with specific URL length adds strange characters to the URL #15980
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 a pull request may close this issue.

2 participants