New issue
Advanced search Search tips

Issue 905117 link

Starred by 3 users

Issue metadata

Status: Untriaged
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

<input type=file webkitdirectory> doesn't work in Android WebView

Project Member Reported by tkent@chromium.org, Nov 14

Issue description

Chrome Version: ToT
OS: Android

What happens?

'webkitdirecotry' attribute doesn't work.

- if webkitdirecotry is specified, AwWebContentsDelegate::RunFileChooser() [1] is called with params.mode==FileChooserParams::Mode::kUploadFolder.
- It sets mode_flags to kFileChooserModeOpenMultiple | kFileChooserModeOpenFolder, that is 3.
- WebChromeClient.FileChooserParams is passed to an embedder with getMode()==3, that is MODE_SAVE, not MODE_OPEN_FOLDER(2)

MODE_OPEN_FOLDER has @hide [2], and the AW implementation passes a wrong mode.


How to fix it?

You might think a straight-forward fix would be:
 - Sets mode_flags to 2, and 
 - Expose MODE_OPEN_FOLDER.

It's not enough.
Javadoc for the current MODE_OPEN_FOLDER says "The implementation should enumerate all files selected by this operation."  In order to support webkitdirectory attribute correctly, Blink needs a directory path which a user selected as well as enumerated files.  So we need to do:
- Change the callback so that it returns both of the selected directory and files, or
- Change the semantics of MODE_OPEN_FOLDER so that the callback returns a single Uri representing the directory, and AW implementation enumerates descendant files.


[1] https://cs.chromium.org/chromium/src/android_webview/browser/aw_web_contents_delegate.cc?type=cs&q=AwWebContentsDelegate::RunFileChooser&sq=package:chromium&g=0&l=91
[2] https://cs.chromium.org/chromium/src/third_party/android_tools/sdk/sources/android-25/android/webkit/WebChromeClient.java?type=cs&q=WebChromeClient+FileChooserParams&sq=package:chromium&g=0&l=439

 
webkitdirecotry isn't standard, so I wouldn't assume that it would work. What are you trying to accomplish with this? Is there some previous WebView version where it did work?
Labels: Needs-Feedback
We're standardizing webkitdirecotry now, and Edge, Firefox, and Safari support it.
https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory

This is just a missing web-platform feature which is available on everywhere except Android WebView.

Summary: <input type=file webkitdirectory> doesn't work in Android WebView (was: <input type=file webkitdirecotry> doesn't work in Android WebView)

Sign in to add a comment