Bug 174373

Summary: Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: MediaAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, eric.carlson, jlewis3, mrajca, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=174591
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
Patch for landing
none
Patch for landing none

Description Jer Noble 2017-07-11 10:49:57 PDT
Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
Comment 1 Jer Noble 2017-07-11 10:51:29 PDT
<rdar://problem/33205939>
Comment 2 Jer Noble 2017-07-11 10:52:09 PDT
Created attachment 315131 [details]
Patch
Comment 3 Build Bot 2017-07-11 13:05:40 PDT
Comment on attachment 315131 [details]
Patch

Attachment 315131 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4102447

New failing tests:
media/video-add-autoplay-user-gesture.html
Comment 4 Build Bot 2017-07-11 13:05:41 PDT
Created attachment 315148 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 5 Matt Rajca 2017-07-11 13:40:40 PDT
(In reply to Build Bot from comment #3)
> Comment on attachment 315131 [details]
> Patch
> 
> Attachment 315131 [details] did not pass ios-sim-ews (ios-simulator-wk2):
> Output: http://webkit-queues.webkit.org/results/4102447
> 
> New failing tests:
> media/video-add-autoplay-user-gesture.html

Do we need the playsinline attribute for the test to work on iOS?
Comment 6 Jer Noble 2017-07-11 13:49:37 PDT
(In reply to Matt Rajca from comment #5)
> (In reply to Build Bot from comment #3)
> > Comment on attachment 315131 [details]
> > Patch
> > 
> > Attachment 315131 [details] did not pass ios-sim-ews (ios-simulator-wk2):
> > Output: http://webkit-queues.webkit.org/results/4102447
> > 
> > New failing tests:
> > media/video-add-autoplay-user-gesture.html
> 
> Do we need the playsinline attribute for the test to work on iOS?

Not for the LayoutTests; those shouldn't require the playsinline attribute. (Because that would break almost every media test.)
Comment 7 Jer Noble 2017-07-14 09:08:39 PDT
(In reply to Jer Noble from comment #6)
> (In reply to Matt Rajca from comment #5)
> > (In reply to Build Bot from comment #3)
> > > Comment on attachment 315131 [details]
> > > Patch
> > > 
> > > Attachment 315131 [details] did not pass ios-sim-ews (ios-simulator-wk2):
> > > Output: http://webkit-queues.webkit.org/results/4102447
> > > 
> > > New failing tests:
> > > media/video-add-autoplay-user-gesture.html
> > 
> > Do we need the playsinline attribute for the test to work on iOS?
> 
> Not for the LayoutTests; those shouldn't require the playsinline attribute.
> (Because that would break almost every media test.)

Turns out the problem with iOS is that the WKTR EventSender is basically unwritten. It doesn't support sending mouse, key, or touch events, so our "do this during a user gesture" helper in video-test.js doesn't work.
Comment 8 Jer Noble 2017-07-14 09:08:57 PDT
I'll just skip this new test on iOS and land.
Comment 9 Jer Noble 2017-07-14 09:33:28 PDT
Created attachment 315433 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2017-07-14 10:11:13 PDT
Comment on attachment 315433 [details]
Patch for landing

Rejecting attachment 315433 [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-02', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 315433, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
tform/ios/TestExpectations']" exit_code: 1

ERROR: LayoutTests/platform/ios/TestExpectations:2566:  Path does not exist.  [test/expectations] [5]
Total errors found: 1 in 1 files

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/platform/ios/TestExpectations']" exit_code: 1
Updating OpenSource
Current branch master is up to date.
ERROR: LayoutTests/platform/ios/TestExpectations:2566:  Path does not exist.  [test/expectations] [5]
Total errors found: 1 in 1 files

Full output: http://webkit-queues.webkit.org/results/4120036
Comment 11 Jer Noble 2017-07-14 10:20:16 PDT
Created attachment 315440 [details]
Patch for landing
Comment 12 WebKit Commit Bot 2017-07-14 10:33:32 PDT
Comment on attachment 315440 [details]
Patch for landing

Clearing flags on attachment: 315440

Committed r219509: <http://trac.webkit.org/changeset/219509>
Comment 13 WebKit Commit Bot 2017-07-14 10:33:33 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Matt Lewis 2017-07-17 11:29:40 PDT
The test added in the revision is a flaky failure.

It looks to have been flaky since being added.
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=media%2Fvideo-add-autoplay-user-gesture.html

https://build.webkit.org/results/Apple%20Sierra%20Release%20WK2%20(Tests)/r219562%20(2990)/results.html


Diff:
--- /Volumes/Data/slave/sierra-release-tests-wk2/build/layout-test-results/media/video-add-autoplay-user-gesture-expected.txt
+++ /Volumes/Data/slave/sierra-release-tests-wk2/build/layout-test-results/media/video-add-autoplay-user-gesture-actual.txt
@@ -3,6 +3,6 @@
 RUN(video.src = findMediaFile("video", "content/test"))
 RUN(video.setAttribute("autoplay", ""))
 RUN(document.body.appendChild(video))
-EVENT(playing)
+FAIL: did not end fast enough
 END OF TEST