w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Clarify when files set with "input.setFiles" command should be considered equal to the selected files #678

Open lutien opened 4 months ago

lutien commented 4 months ago

In input.setFiles command algorithm(https://w3c.github.io/webdriver-bidi/#command-input-setFiles) in the step 12, we have to identify intersection of files argument and the selected files of input element, for this we have to check if the files are equal, but the spec is not specific in which cases we should consider files equal. Maybe the spec should be more specific here.

jgraham commented 4 months ago

So, looking at this, the spec is trying to compare a set of path strings to a set of selected files, which are structs with a filename, a file type and a body. That's obviously not going to work in the way it intends.

I can't see any way to get the full filesystem path from what's in the HTML spec, so it would take quite some effort to make that possible spec wise.

Since the only use case here is triggering a cancel event, I wonder if we shouldn't just have a specific input that always triggers the cancel event without updating the files list (e.g. just not providing a files array or maybe something more explicit).

css-meeting-bot commented 3 months ago

The Browser Testing and Tools Working Group just discussed Clarify when files set with "input.setFiles" command should be considered equal to the selected files.

The full IRC log of that discussion <AutomatedTester> Topic: Clarify when files set with "input.setFiles" command should be considered equal to the selected files
<AutomatedTester> github: https://github.com/w3c/webdriver-bidi/issues/678
<AutomatedTester> sasha: The first thing is when we should fire the cancel event
<jrandolf> q+
<AutomatedTester> ... there are also cases where we are putting info into in and when we try retrieve it we don't get the same information and there are cases where we cant get this info from the HTML spec as it forbids it
<AutomatedTester> ack next
<jgraham> q+
<AutomatedTester> jrandolf: I created the spec the way it is as it is for what the user would expected. I am not so picky in how we do this by adding a flag. I don't think an empty file list makes sense
<AutomatedTester> ... in the CDDL we have have it cancel or files
<AutomatedTester> ... we don';t want to influence the HTML spec here too much
<AutomatedTester> q?
<AutomatedTester> ack next
<AutomatedTester> jgraham (IRC): I think the actual behaviour here is different between gecko/webkit/chromium
<AutomatedTester> ... a cancel event isn't fired in gecko but it does in chromium/webkit
<AutomatedTester> ... and a flag seems a natural way to do it
<AutomatedTester> ... we can have type attribute where it is a type cancel and type files but I haven't thought about it much
<AutomatedTester> q?