WICG / entries-api

Spec defining browser support for file/directory upload by drag-and-drop
https://wicg.github.io/entries-api/
Other
41 stars 9 forks source link

Use callback functions instead of callback interfaces? #3

Closed foolip closed 6 years ago

foolip commented 8 years ago

https://wicg.github.io/entries-api/#callbackdef-errorcallback https://wicg.github.io/entries-api/#callbackdef-entrycallback https://wicg.github.io/entries-api/#callbackdef-entriescallback https://wicg.github.io/entries-api/#callbackdef-filecallback

These looks like callback interfaces in Blink's IDL files, but probably don't actually work like that, see https://bugs.chromium.org/p/chromium/issues/detail?id=630986

Even if it currently works like callback interfaces in Blink, it's probably worth attempting to switch to callback functions, because it's a quirk that it's unlikely that content depends on and handleEvent makes no sense as a name here.

inexorabletash commented 8 years ago

I had them as callback functions until https://github.com/WICG/entries-api/commit/34fc21ff4abe66caa204626ea0cf7d95a71231e1 but smaug____ requested changing them to callback interfaces. Perhaps there was a good reason...

foolip commented 8 years ago

It would be well worth testing if these actually behave like callback interfaces in Chrome/Blink, I suspect that they do not. I've tried to do it myself, but I'm honestly unable to figure out how to get to one of these APIs using <input type=file multiple webkitdirectory> or <div webkitdropzone>.

inexorabletash commented 8 years ago

@foolip - I added slightly more fleshed out examples for webkitEntries and webkitRelativePath.

Part of the weirdness is that webkitEntries is only populated in Chrome if you D&D onto an HTMLInputElement without webkitdirectory. If you click/select instead it doesn't populate it, and if you have webkitdirectory it doesn't populate it either (but it does fill in webkitRelativePath on the File instances). Wheee.

inexorabletash commented 8 years ago

Per IRC (#whatwg), smaug____ indicates the change was requested just to match Blink. I guess the onus is on Blink to try changing.

inexorabletash commented 8 years ago

re: testing - per @domenic Blink doesn't actually support callback interfaces (except for event handlers and nodeFilter). Matches my local testing.

marsjaninzmarsa commented 7 years ago

Promises please. :x Always.

inexorabletash commented 7 years ago

Promises please.

For a new API, obviously. But this is documenting an existing API. The question is how to accurately describe the existing behavior to support interop.

foolip commented 6 years ago

Ping this issue? Other implementers looking at the current IDL would probably think that window.ErrorCallback should exist, but it actually shouldn't.

inexorabletash commented 6 years ago

PRs welcome (spec and test). :)

Seriously though - remind me after the US holiday if I forget again. Easy change to spec/test/Blink impl.