Bug 214722

Summary: Propagating media only user gesture through Fetch ReadableStream
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebCore Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: NEW    
Severity: Normal CC: annulen, benjamin, calvaris, cdumez, dwaite, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, jiewen_tan, joepeck, kangil.han, kondapallykalyan, philipj, ryuan.choi, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=214444
Bug Depends on:    
Bug Blocks: 181943    
Attachments:
Description Flags
WIP
none
WIP
none
Patch
none
Patch jiewen_tan: review+

Jiewen Tan
Reported 2020-07-24 00:05:27 PDT
Propagating media only user gesture through Fetch ReadableStream. A follow up from Bug 214444.
Attachments
WIP (24.30 KB, patch)
2020-07-28 22:17 PDT, Jiewen Tan
no flags
WIP (28.47 KB, patch)
2020-07-29 08:43 PDT, youenn fablet
no flags
Patch (35.18 KB, patch)
2020-07-30 05:54 PDT, youenn fablet
no flags
Patch (35.94 KB, patch)
2020-07-30 09:00 PDT, youenn fablet
jiewen_tan: review+
Jiewen Tan
Comment 1 2020-07-28 22:17:02 PDT
Jiewen Tan
Comment 2 2020-07-28 22:22:04 PDT
The WIP patch is not completed. It is uploaded here for Youenn to review such that we could continue our discussion off line.
youenn fablet
Comment 3 2020-07-29 08:43:49 PDT
youenn fablet
Comment 4 2020-07-30 05:54:42 PDT
youenn fablet
Comment 5 2020-07-30 06:03:07 PDT
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.
youenn fablet
Comment 6 2020-07-30 09:00:41 PDT
Jiewen Tan
Comment 7 2020-07-30 11:23:36 PDT
(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
Jiewen Tan
Comment 8 2020-07-30 23:46:27 PDT
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.
Radar WebKit Bug Importer
Comment 9 2020-07-31 00:06:21 PDT
Note You need to log in before you can comment on or make changes to this bug.