RESOLVED FIXED Bug 178754
[MediaStream] Clear cached gUM prompt state
https://bugs.webkit.org/show_bug.cgi?id=178754
Summary [MediaStream] Clear cached gUM prompt state
Eric Carlson
Reported 2017-10-24 15:06:35 PDT
Clear a page's cached gUM prompt state, so the user will be prompted again on the next call to getUserMedia, after: - a stream has been active for 24 hours - no stream has been active for a platform specific interval (defaults to 1 minute on iOS, 10 minutes on other platforms, settable with a WK2 setting)
Attachments
Proposed patch. (32.91 KB, patch)
2017-10-24 15:37 PDT, Eric Carlson
no flags
Rebased and updated patch. (33.35 KB, patch)
2017-10-25 11:56 PDT, Eric Carlson
no flags
Test fix. (3.83 KB, patch)
2017-10-26 10:51 PDT, Eric Carlson
no flags
Eric Carlson
Comment 1 2017-10-24 15:30:59 PDT
Eric Carlson
Comment 2 2017-10-24 15:37:23 PDT
Created attachment 324739 [details] Proposed patch.
youenn fablet
Comment 3 2017-10-24 16:37:54 PDT
Comment on attachment 324739 [details] Proposed patch. Patch lgtm, not applying so... View in context: https://bugs.webkit.org/attachment.cgi?id=324739&action=review > Source/WebKit/Shared/WebPreferencesDefinitions.h:315 > + macro(MediaCaptureInactiveStreamRepromptInterval, mediaCaptureInactiveStreamRepromptInterval, Double, double, DEFAULT_MEDIA_CAPTURE_INTERACTIVE_STREAM_REPROMPT_INTERVAL, "", "") \ Are we usually using minutes and not seconds for intervals/timeouts values? > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:414 > + interval = Seconds::fromHours(24); Shouldn't we try to put the default long timeout value in a better place, maybe in a macro in WebPreferenceDefinitions? > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:422 > + m_watchdogTimer.startOneShot(m_currentWatchdogInterval); Are there cases where we should stop the timer like in destructor or is it handled on its own? > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:434 > + ASSERT(!(m_captureState & activeCaptureMask)); Cannot this assertion happens if there is a live webrtc session for more than 24 hours? > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:437 > + m_pregrantedRequests.clear(); We should also clear m_deniedRequests. > Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:438 > + line not needed > Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h:444 > +// Defaults to 8 minutes. Is it still true?
Eric Carlson
Comment 4 2017-10-25 11:55:04 PDT
Comment on attachment 324739 [details] Proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=324739&action=review >> Source/WebKit/Shared/WebPreferencesDefinitions.h:315 >> + macro(MediaCaptureInactiveStreamRepromptInterval, mediaCaptureInactiveStreamRepromptInterval, Double, double, DEFAULT_MEDIA_CAPTURE_INTERACTIVE_STREAM_REPROMPT_INTERVAL, "", "") \ > > Are we usually using minutes and not seconds for intervals/timeouts values? I don't think there is a preference one way or the other, and I think expressing 5 minutes as "5*60" is helpful, but I changed the preference name to "inactiveMediaCaptureSteamRepromptIntervalInMinutes" to make the units obvious. >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:414 >> + interval = Seconds::fromHours(24); > > Shouldn't we try to put the default long timeout value in a better place, maybe in a macro in WebPreferenceDefinitions? I added a preference for it. >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:422 >> + m_watchdogTimer.startOneShot(m_currentWatchdogInterval); > > Are there cases where we should stop the timer like in destructor or is it handled on its own? A timer's destructor stops itself. >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:434 >> + ASSERT(!(m_captureState & activeCaptureMask)); > > Cannot this assertion happens if there is a live webrtc session for more than 24 hours? Indeed, removed! >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:437 >> + m_pregrantedRequests.clear(); > > We should also clear m_deniedRequests. I disagree. If a user disallows capture, we should remember that setting until the page is reloaded. >> Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:438 >> + > > line not needed Fixed. >> Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h:444 >> +// Defaults to 8 minutes. > > Is it still true? Nope, fixed.
Eric Carlson
Comment 5 2017-10-25 11:56:47 PDT
Created attachment 324860 [details] Rebased and updated patch.
youenn fablet
Comment 6 2017-10-25 14:50:00 PDT
Comment on attachment 324860 [details] Rebased and updated patch. LGTM. I am still not sure whether we should not remove the denied requests decisions after some timeouts. The timer will only fire if user granted either audio or video. So there will be a prompt for one or the other. Then, why not allowing the application to request both?
Eric Carlson
Comment 7 2017-10-25 14:53:55 PDT
(In reply to youenn fablet from comment #6) > Comment on attachment 324860 [details] > Rebased and updated patch. > > LGTM. > > I am still not sure whether we should not remove the denied requests > decisions after some timeouts. > The timer will only fire if user granted either audio or video. > So there will be a prompt for one or the other. > Then, why not allowing the application to request both? Lets land this and talk about the issue.
WebKit Commit Bot
Comment 8 2017-10-25 15:15:09 PDT
Comment on attachment 324860 [details] Rebased and updated patch. Clearing flags on attachment: 324860 Committed r223988: <https://trac.webkit.org/changeset/223988>
WebKit Commit Bot
Comment 9 2017-10-25 15:15:10 PDT
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 10 2017-10-26 09:15:06 PDT
The API test added with this change is failing: FAIL WebKit2.GetUserMediaReprompt /Volumes/Data/slave/sierra-release/build/Tools/TestWebKitAPI/Tests/WebKit/GetUserMediaReprompt.mm:80 Value of: [result boolValue] Actual: false Expected: true /Volumes/Data/slave/sierra-release/build/Tools/TestWebKitAPI/Tests/WebKit/GetUserMediaReprompt.mm:89 Value of: [result boolValue] Actual: false Expected: true https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK2%20(Tests)/builds/5281
Eric Carlson
Comment 11 2017-10-26 10:51:18 PDT
Created attachment 325029 [details] Test fix.
Ryan Haddad
Comment 12 2017-10-26 13:22:18 PDT
Comment on attachment 325029 [details] Test fix. Clearing flags on attachment: 325029 Committed r224044: <https://trac.webkit.org/changeset/224044>
Ryan Haddad
Comment 13 2017-10-26 13:22:19 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.