[html5] Launch does not handle usernames with spaces correctly

When attempting to launch a html5 build from the editor, the editor states that the launch is successful, but I get the following error from Firefox:

Your Firefox profile cannot be loaded. It may be missing or inaccessible.

I believe this might be caused by incorrect handling of spaces in usernames as I noticed the following section in the output log:

LogPlayLevel: CommandUtils.Run: Run: C:\Program Files\Epic Games\4.11\Engine\Binaries\DotNET\HTML5LaunchHelper.exe  -Browser="C:/Program Files/Mozilla Firefox/firefox.exe" + -BrowserCommandLine="http://localhost:53501/LudumDare35.html  -no-remote -profile "C:\Users\Arne Bezuijen\AppData\Local\UE4_HTML5\user\firefox"" -ServerPort="53501" -ServerRoot="D:\Ludum
Dare35\Binaries\HTML5"
LogPlayLevel: HTML5LaunchHelper: Name: -Browser= C:/Program Files/Mozilla Firefox/firefox.exe
LogPlayLevel: HTML5LaunchHelper: Name: -ServerRoot= D:\LudumDare35\Binaries\HTML5
LogPlayLevel: HTML5LaunchHelper: Name: -ServerPort= 53501
LogPlayLevel: HTML5LaunchHelper: Name: -BrowserCommandLine= http://localhost:53501/LudumDare35.html  -no-remote -profile C:\Users\Arne
LogPlayLevel: HTML5LaunchHelper: Name: -UseAllPrefixes= FALSE
LogPlayLevel: HTML5LaunchHelper: Starting Server at http://localhost:53501/
LogPlayLevel: HTML5LaunchHelper: Spawning Browser Process C:/Program Files/Mozilla Firefox/firefox.exe with args http://localhost:53501/LudumDare35.html  -no-remote -profile C:\Users\Arne
LogPlayLevel: HTML5LaunchHelper:
LogPlayLevel: HTML5LaunchHelper: All processes being watched have exited.
LogPlayLevel: HTML5LaunchHelper:
LogPlayLevel: BuildCookRun.DoBuildCookRun: ********** RUN COMMAND COMPLETED **********

This seems to indicate the the command line arguments set by HTML5LaunchHelper get truncated at the space in my username.

Arnage,

When opening the HTML5Launchhelper, are you opening up a web browser and typing in: http://localhost:8000/PROJECTNAME.html? If not, this is how you’d have to set it up if you’re testing it locally.

Please provide your complete reproduction steps.

Thanks!

I think the issue occurs when he tries to launch the web browser on the page directly from the UE4 editor, and his user profile name on Windows has a space in it, e.g. “Firstname Lastname”. It might also occur when he double-clicks directly on HTML5LaunchHelper.exe in the output directory, though not quite sure about that.

Looking at line 9 of the paste, this does look like missing quotes " " around the temporary profile filename that is passed to Firefox.

However searching in UE4 source tree for that piece of code, it has

BrowserCommandline += " " + String.Format("-no-remote -profile “{0}”", Path.Combine(ProfileDirectory, “firefox”));

in \UnrealEngine\Engine\Source\Programs\AutomationTool\HTML5 line 471, which does clearly have escaping. Perhaps some interaction with Windows shell later strips that escaping, or it’s needed in another place as well. Not quite sure…

Anyways, there some ways to avoid this for a somewhat comfortable workflow:

  1. If you are using Firefox to develop, then you can just drag and drop the main .html page to Firefox on top of the Firefox browser window to run.
  2. Chrome doesn’t allow XHRs to succeed if running via file://, so for that, you can launch “python -m SimpleHTTPServer” from command line in the output directory, and navigate to http://localhost:8000/ to run the page.
  3. Neigher of the above methods method have the ability to handle pre-gzipped content (the .jsgz etc. files). (HTML5LaunchHelper does). One way to fix this for local testing of pre-gzipped content is to get the GzipSimpleHTTPServer module from GitHub - ksmith97/GzipSimpleHTTPServer: A modification of the very useful SimpleHTTPServer python script to add gzip compression. that patches the support in.
  4. Another way to enable support for pre-gzipped content is to use the emrun.py tool from GitHub - juj/emrun: Self-sufficient tools for command line automation of browser and Firefox OS tasks. Often used with Emscripten.. This has been improved to support gzipped transfer for UE4-generated files, and similar to SimpleHTTPServer, one can run “python emrun.py --no_browser .” to serve the current directory via a web server.

As stated by juj I was indeed launching directly from the editor. So there are not that many reproduction steps, it’s just clicking on that one button.

Manually launching with other methods works, but are more involved and slow down the iteration process compared to simply clicking launch in the editor.

seems that the escape quote needs to be escaped itself.

i just did a test and replicated the bug. to fix this:

edit

  • EngineSource/Programs/AutomationTool/HTML5/HTML5Platform.Automation.cs

line 471: (thanks juj!)

BUT! change it to:

BrowserCommandline += " " + String.Format("-no-remote -profile \"{0}\"", Path.Combine(ProfileDirectory, “firefox”));

yes, that’s 3 slashes…

argh… wished i looked at this sooner – we just “locked-down” 4.12 - and this fix needs to go in… maybe for 4.12.1 hotfix… :slight_smile: