Commandline bug for webview

922 views
Skip to first unread message

Matthew Ng

unread,
Nov 11, 2014, 6:30:26 PM11/11/14
to android-w...@chromium.org, Srikumar Bonda

Hello,

 

I am Matthew from NVIDIA and I am currently looking into running command lines from the “/data/local/tmp/webview-command-line” file. However after testing it on Android L, webview does not reflect the switches that were placed in that file. I looked around /chromium_org/base/android/java/src/org/chromium/base/CommandLine.java and found that the function appendSwitchesInternal does not set the arguments to the mSwitches  and when webview asks if the command line has a certain switch, it will not return true even if that switch is in the mArgs. I am wondering if this is intentional or a bug. I believe that line 335 should replace mArgs.add(arg); with appendSwitchWithValue(arg, null);.

 

Thank you for your help,

 

Matt


This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

Hui Shu

unread,
Nov 11, 2014, 6:34:23 PM11/11/14
to Matthew Ng, android-w...@chromium.org, Srikumar Bonda
Hi,
Did you restart your webview application after you updated the commandline file?
Also what commandline options are you adding?

--
You received this message because you are subscribed to the Google Groups "android-webview-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-webview...@chromium.org.
To post to this group, send email to android-w...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/android-webview-dev/1a5f0d1c2ebb4adfa4dbf95ea5582a6d%40HQMAIL108.nvidia.com.

Bo Liu

unread,
Nov 11, 2014, 6:38:20 PM11/11/14
to Hui Shu, Matthew Ng, android-w...@chromium.org, Srikumar Bonda
Switch starts with "--", whereas arguments do not. Did you forget to add "--" to /data/local/tmp/webview-command-line?

Primiano Tucci

unread,
Nov 11, 2014, 6:40:37 PM11/11/14
to bo...@chromium.org, Hui Shu, Matthew Ng, android-w...@chromium.org, Srikumar Bonda
Also remember that the command line is loaded only on userdebug/eng builds but not on user images.

  1. public WebViewChromiumFactoryProvider() {
  2. if (Build.IS_DEBUGGABLE) {
  3. CommandLine.initFromFile(COMMAND_LINE_FILE);
  4. } else {
  5. CommandLine.init(null);
  6. }

Martin Kosiba

unread,
Nov 11, 2014, 6:41:03 PM11/11/14
to Hui Shu, Matthew Ng, android-w...@chromium.org, Srikumar Bonda
Hi Matthew,
  The command line is ignored on non-debuggable builds (we look at Build.IS_DEBUGGABLE), is this what you're running into?

On Tue, Nov 11, 2014 at 3:34 PM, 'Hui Shu' via android-webview-dev <android-w...@chromium.org> wrote:

Matthew Ng

unread,
Nov 11, 2014, 7:07:24 PM11/11/14
to Martin Kosiba, Hui Shu, android-w...@chromium.org, Srikumar Bonda

Hello,

 

Thank you for your help. I indeed formatted the file incorrectly.

 

Matt

Primiano Tucci

unread,
Nov 11, 2014, 8:26:13 PM11/11/14
to Matthew Ng, Martin Kosiba, Hui Shu, android-w...@chromium.org, Srikumar Bonda
My advice would be to use this script:

instead of changing the command line file manually. One of the reasons is that chromium's code swallows the first argument (because that is typically argv[0] == process name). So if you just write "--foo --bar --baz" in webview-command-line, --foo will have no effect.

In fact, If you look into the script I linked above, you'll see that it pushes an extra "webview" argument before the actual args (webview --foo --bar --baz, so "webview" gets swallowed as argv[0]).

In summary what you want to do is:
$ adb root && adb wait-for-device
$ ./webview_command_line --foo --bar --baz
and 
$ ./webview_command_line "" # to delete the file and reset the command line to the default value.


Reply all
Reply to author
Forward
0 new messages