Bug 172859 - getUserMedia is prompting too often
Summary: getUserMedia is prompting too often
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks: 172989
  Show dependency treegraph
 
Reported: 2017-06-02 09:36 PDT by youenn fablet
Modified: 2017-06-07 16:27 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.28 KB, patch)
2017-06-02 09:42 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (31.29 KB, patch)
2017-06-06 10:51 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (1.09 MB, application/zip)
2017-06-06 11:58 PDT, Build Bot
no flags Details
Patch (35.90 KB, patch)
2017-06-06 18:24 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (36.28 KB, patch)
2017-06-07 08:38 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (36.28 KB, patch)
2017-06-07 13:47 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2017-06-02 09:36:55 PDT
It should not reprompt when access is already given to the page
Comment 1 youenn fablet 2017-06-02 09:42:37 PDT
Created attachment 311832 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2017-06-06 09:06:27 PDT
<rdar://problem/32589950>
Comment 3 Radar WebKit Bug Importer 2017-06-06 09:06:30 PDT
<rdar://problem/32589947>
Comment 4 youenn fablet 2017-06-06 10:51:40 PDT
Created attachment 312089 [details]
Patch
Comment 5 Build Bot 2017-06-06 11:58:35 PDT
Comment on attachment 312089 [details]
Patch

Attachment 312089 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3882848

New failing tests:
fast/mediastream/getUserMedia-grant-persistency.html
http/tests/media/media-stream/get-user-media-prompt.html
Comment 6 Build Bot 2017-06-06 11:58:36 PDT
Created attachment 312099 [details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 7 youenn fablet 2017-06-06 13:59:01 PDT
Looking at the test failures, the patch seems good.
I will need to rebase one test and change another one which is too sensitive.
Comment 8 youenn fablet 2017-06-06 18:24:30 PDT
Created attachment 312151 [details]
Patch
Comment 9 Eric Carlson 2017-06-07 06:32:55 PDT
Comment on attachment 312151 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=312151&action=review

> Source/WebKit2/ChangeLog:14
> +        A granted request is now keeping its mainFrameID.

Nit: "is now keeping" => "now keeps"

> Source/WebKit2/ChangeLog:15
> +        Whenever the document of the main frame is changing, the granted requests for that mainFrameID will be removed.

Nit: "main frame is changing" => "main frame changes"

> Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:241
> -        if (!m_page.isValid())
> +        if (!m_page.isValid() || !m_page.mainFrame())

Why is this change necessary?

> LayoutTests/fast/mediastream/getUserMedia-grant-persistency.html:48
> +    }).then(() => {
> +        if (!window.internals)
> +            return;
> +        assert_true(internals.pageMediaState().includes("HasActiveVideoCaptureDevice"), "Check active video");
> +        assert_true(internals.pageMediaState().includes("HasActiveAudioCaptureDevice"), "Check active audio");
> +    });

This seems wrong. Why would we allow a call to getUserMedia not triggered by a user gesture to un-mute capture?

> LayoutTests/fast/mediastream/getUserMedia-grant-persistency.html:59
> +    }).then(() => {
> +    }).then(() => {

Nit: are both of these needed?

> LayoutTests/http/tests/media/media-stream/get-user-media-prompt-expected.txt:20
>  ** Request a stream with video and audio, the user should be prompted again **

Nit: this comment should be updated, the user is NOT prompted again.
Comment 10 youenn fablet 2017-06-07 08:38:43 PDT
Created attachment 312187 [details]
Patch for landing
Comment 11 WebKit Commit Bot 2017-06-07 09:55:43 PDT
Comment on attachment 312187 [details]
Patch for landing

Rejecting attachment 312187 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 312187, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.

Full output: http://webkit-queues.webkit.org/results/3888548
Comment 12 youenn fablet 2017-06-07 13:47:57 PDT
Created attachment 312220 [details]
Patch for landing
Comment 13 WebKit Commit Bot 2017-06-07 16:27:17 PDT
Comment on attachment 312220 [details]
Patch for landing

Clearing flags on attachment: 312220

Committed r217910: <http://trac.webkit.org/changeset/217910>
Comment 14 WebKit Commit Bot 2017-06-07 16:27:19 PDT
All reviewed patches have been landed.  Closing bug.