Propagating media only user gesture through Fetch ReadableStream. A follow up from Bug 214444.
Created attachment 405439 [details] WIP
The WIP patch is not completed. It is uploaded here for Youenn to review such that we could continue our discussion off line.
Created attachment 405460 [details] WIP
Created attachment 405563 [details] Patch
Current patch allows using async appropriately with keeping user gesture until a timeout: // within click event handler, so user gesture active const response = await fetch('blo'); // user gesture should still be active if fetch token is not expired const reader = response.body.getReader(); const chunk = await reader.read(); // user gesture should still be active if fetch token is not expired ... This seems fine to me but we should probably discuss this, see how the spec is defining this and if not defining this, make sure to start discussion there. With the current patch, a click event handler doing the following would be like: // within click event handler, so user gesture active const promise = fetch('blabla'); ... // promise not yet resolved, may be out of the click event handler promise.then(callback1) ... // promise gets resolved before fetch token is expired. ... // promise is now resolved but fetch token is not expired. promise.then(callback2) I believe callback1 would get user gesture priviledges, not callback2.
Created attachment 405573 [details] Patch
(In reply to youenn fablet from comment #5) > Current patch allows using async appropriately with keeping user gesture > until a timeout: > // within click event handler, so user gesture active > const response = await fetch('blo'); > // user gesture should still be active if fetch token is not expired > const reader = response.body.getReader(); > const chunk = await reader.read(); > // user gesture should still be active if fetch token is not expired > ... > > This seems fine to me but we should probably discuss this, see how the spec > is defining this and if not defining this, make sure to start discussion > there. > > With the current patch, a click event handler doing the following would be > like: > > // within click event handler, so user gesture active > const promise = fetch('blabla'); > ... > // promise not yet resolved, may be out of the click event handler > promise.then(callback1) > ... > // promise gets resolved before fetch token is expired. > ... > // promise is now resolved but fetch token is not expired. > promise.then(callback2) > > I believe callback1 would get user gesture priviledges, not callback2. As far I can tell, the user activation spec Google is proposing has deprecated a token base user gesture model with a producer-consumer model. https://developers.google.com/web/updates/2019/01/user-activation
Comment on attachment 405573 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405573&action=review LGTM. r=me. Youenn, thanks for making the patch. > Source/WebCore/Modules/fetch/FetchBodySource.cpp:105 > + // We asynchronously call the callback so that any promise that got resolved can be thened by the page before the promise got settled with user gesture priviledge. 'thened' doesn't seem to be an English word. It's unclear to me why doing it synchronously doesn't have the benefit.
<rdar://problem/66367691>