Bug 264325

Summary: run-minibrowser --help seems incorrect about url-loading
Product: WebKit Reporter: Karl Dubost <karlcow>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: g_squelart, mcatanzaro, philn, webkit-bug-importer
Priority: P2 Keywords: GoodFirstBug, InRadar
Version: Safari 17   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=255962
https://bugs.webkit.org/show_bug.cgi?id=256086
https://bugs.webkit.org/show_bug.cgi?id=247378

Description Karl Dubost 2023-11-06 23:59:29 PST
Currently the help indicates that you can do 
   run-minibrowser http://example.org/

That is not true. 
It requires 
   run-minibrowser --url http://example.org/

This is an easy fix.
Comment 1 Karl Dubost 2023-11-06 23:59:55 PST
<rdar://117554821>
Comment 2 Karl Dubost 2023-11-07 02:50:52 PST
% run-minibrowser http://example.com 
options Namespace(platform='mac', configuration=None, architecture=None, model=None, url='http://example.com')

% run-minibrowser --url http://example.com
options Namespace(platform='mac', configuration=None, architecture=None, model=None, url='http://example.com')


so far so good. But the example of the help menu says:

MiniBrowser options:    Pass them after two dashes.
  Example:              run-minibrowser --wpe -- --platform=drm http://url.com

Let's try:

% run-minibrowser --wpe -- --platform=drm http://example.com
options Namespace(platform='wpe', configuration=None, architecture=None, model=None, url='--platform=drm')

This is not good. This is not what we are expecting.

same with --url
% run-minibrowser --wpe -- --platform=drm --url http://example.com
options Namespace(platform='wpe', configuration=None, architecture=None, model=None, url='--platform=drm')

This is slightly better
% run-minibrowser http://example.com -- --platform=drm
options Namespace(platform='mac', configuration=None, architecture=None, model=None, url='http://example.com')

% run-minibrowser http://example.com -- --platform=drm
options Namespace(platform='mac', configuration=None, architecture=None, model=None, url='http://example.com')

% run-minibrowser http://example.com --platform=drm 
options Namespace(platform='drm', configuration=None, architecture=None, model=None, url='http://example.com')


So there are issues with the current parsing of arguments. 



Note: Replace url.com by example.org in all examples.
Comment 3 Karl Dubost 2023-11-07 03:11:07 PST
See also https://github.com/WebKit/WebKit/pull/6049
Comment 4 Philippe Normand 2023-11-07 14:08:43 PST
run-minibrowser --wpe http://example.com  -- --platform=drm

?
Comment 5 Philippe Normand 2023-11-07 14:10:28 PST
>   Example:              run-minibrowser --wpe -- --platform=drm http://url.com


That example looks incorrect. The url should be before --
Comment 6 Michael Catanzaro 2023-11-07 15:51:17 PST
(In reply to Philippe Normand from comment #5) 
> That example looks incorrect. The url should be before --

I guess the -- is used to indicate the end of the list of arguments to run-minibrowser and start the list of arguments to MiniBrowser itself. And the URL to load is surely an argument for MiniBrowser. So I think Karl is probably right that the example matches the intended behavior?
Comment 7 Karl Dubost 2023-11-07 17:40:51 PST
(In reply to Philippe Normand from comment #5)
> >   Example:              run-minibrowser --wpe -- --platform=drm http://url.com
> 
> 
> That example looks incorrect. The url should be before --

Yes. Exactly, 
https://github.com/WebKit/WebKit/commit/63d0be648fd8f20ec94cadbb884a358bc6eba18b

but that also means the code is not very robust to this kind of mistakes. If I have a bit of bandwidth, I will fix a couple of things there, but if someone else wants to do it.