RESOLVED DUPLICATE of bug 167355 167132
Pass down website autoplay policies to media elements
https://bugs.webkit.org/show_bug.cgi?id=167132
Summary Pass down website autoplay policies to media elements
Matt Rajca
Reported 2017-01-17 12:51:08 PST
Website autoplay policies passed to the web frame loader should be respected by media elements.
Attachments
Patch (1.85 KB, patch)
2017-01-17 13:13 PST, Matt Rajca
no flags
Archive of layout-test-results from ews102 for mac-elcapitan (714.46 KB, application/zip)
2017-01-17 14:13 PST, Build Bot
no flags
Patch (11.22 KB, patch)
2017-01-17 15:26 PST, Matt Rajca
no flags
Archive of layout-test-results from ews102 for mac-elcapitan (717.37 KB, application/zip)
2017-01-17 17:00 PST, Build Bot
no flags
Patch (11.00 KB, patch)
2017-01-19 13:39 PST, Matt Rajca
no flags
Archive of layout-test-results from ews125 for ios-simulator-wk2 (9.38 MB, application/zip)
2017-01-19 14:55 PST, Build Bot
no flags
Patch (10.88 KB, patch)
2017-01-19 15:06 PST, Matt Rajca
no flags
Patch (10.91 KB, patch)
2017-01-19 16:12 PST, Matt Rajca
no flags
Patch (10.81 KB, patch)
2017-01-23 12:26 PST, Matt Rajca
no flags
Patch (10.90 KB, patch)
2017-01-23 13:39 PST, Matt Rajca
no flags
Matt Rajca
Comment 1 2017-01-17 13:13:59 PST
Build Bot
Comment 2 2017-01-17 14:13:20 PST
Comment on attachment 299054 [details] Patch Attachment 299054 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2905646 New failing tests: imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html
Build Bot
Comment 3 2017-01-17 14:13:22 PST
Created attachment 299059 [details] Archive of layout-test-results from ews102 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Matt Rajca
Comment 4 2017-01-17 15:26:00 PST
Matt Rajca
Comment 5 2017-01-17 15:26:46 PST
(In reply to comment #4) > Created attachment 299073 [details] > Patch I don't think that bot failure is related. That test was added just a few hours ago.
Build Bot
Comment 6 2017-01-17 17:00:15 PST
Comment on attachment 299073 [details] Patch Attachment 299073 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2906401 New failing tests: imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html
Build Bot
Comment 7 2017-01-17 17:00:18 PST
Created attachment 299087 [details] Archive of layout-test-results from ews102 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Matt Rajca
Comment 8 2017-01-17 19:40:13 PST
Working on a new patch with tests that also run on iOS.
Alex Christensen
Comment 9 2017-01-18 09:48:43 PST
Comment on attachment 299073 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299073&action=review > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:821 > + if (coreFrame && !websitePolicies.autoplayEnabled) { I don't think we need to check coreFrame. It was dereferenced on line 804, so if it were null we would have already crashed. > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:824 > + settings.setVideoPlaybackRequiresUserGesture(true); > + settings.setAudioPlaybackRequiresUserGesture(true); Are these values set back to their default value for the next navigation? Add a test that sets autoplayEnabled back to true and does another navigation to make sure that it behaves as expected. > Tools/TestWebKitAPI/Tests/WebKit2/autoplayCheck.html:12 > + }, 100) Is 100ms enough time for the video to have always started playing when it is allowed to?
Matt Rajca
Comment 10 2017-01-19 13:38:25 PST
(In reply to comment #9) > Comment on attachment 299073 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299073&action=review > > > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:821 > > + if (coreFrame && !websitePolicies.autoplayEnabled) { > > I don't think we need to check coreFrame. It was dereferenced on line 804, > so if it were null we would have already crashed. Removed. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:824 > > + settings.setVideoPlaybackRequiresUserGesture(true); > > + settings.setAudioPlaybackRequiresUserGesture(true); > > Are these values set back to their default value for the next navigation? > Add a test that sets autoplayEnabled back to true and does another > navigation to make sure that it behaves as expected. Good catch. I polished this up and added a test. > > > Tools/TestWebKitAPI/Tests/WebKit2/autoplayCheck.html:12 > > + }, 100) > > Is 100ms enough time for the video to have always started playing when it is > allowed to? It should be, given the video file is around 100 KB and loaded locally.
Matt Rajca
Comment 11 2017-01-19 13:39:47 PST
Build Bot
Comment 12 2017-01-19 14:55:19 PST
Comment on attachment 299267 [details] Patch Attachment 299267 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2916574 New failing tests: media/ios/autoplay-only-in-main-document.html
Build Bot
Comment 13 2017-01-19 14:55:23 PST
Created attachment 299272 [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.11.6
Matt Rajca
Comment 14 2017-01-19 15:06:11 PST
Matt Rajca
Comment 15 2017-01-19 16:12:50 PST
Alex Christensen
Comment 16 2017-01-23 11:46:36 PST
Comment on attachment 299278 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299278&action=review > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:821 > + coreFrame->settings().setAudioPlaybackRequiresUserGesture(!websitePolicies.autoplayEnabled); This overrides the existing settings.setAudioPlaybackRequiresUserGesture. We should remove that if it no longer works.
WebKit Commit Bot
Comment 17 2017-01-23 12:13:08 PST
Comment on attachment 299278 [details] Patch Rejecting attachment 299278 [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-01', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: TestWebKitAPI/Tests/WebKit2/ForceRepaint.cpp -o /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWebKitAPILibrary.build/Objects-normal/x86_64/ForceRepaint.o ** BUILD FAILED ** The following build commands failed: CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWebKitAPILibrary.build/Objects-normal/x86_64/WebsitePolicies.o Tests/WebKit2Cocoa/WebsitePolicies.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure) Full output: http://webkit-queues.webkit.org/results/2936483
Matt Rajca
Comment 18 2017-01-23 12:26:37 PST
Matt Rajca
Comment 19 2017-01-23 13:39:59 PST
WebKit Commit Bot
Comment 20 2017-01-23 14:27:17 PST
Comment on attachment 299537 [details] Patch Clearing flags on attachment: 299537 Committed r211062: <http://trac.webkit.org/changeset/211062>
WebKit Commit Bot
Comment 21 2017-01-23 14:27:22 PST
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 22 2017-01-23 15:09:32 PST
This change appears to have caused 4 API test failures: Tests that failed: RequiresUserActionForPlaybackTest.DeprecatedRequiresUserActionForAudioAndVideoPlayback RequiresUserActionForPlaybackTest.DeprecatedRequiresUserActionForAudioButNotVideoPlayback RequiresUserActionForPlaybackTest.RequiresUserActionForAudioAndVideoPlayback RequiresUserActionForPlaybackTest.RequiresUserActionForAudioButNotVideoPlayback https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK1%20(Tests)/builds/3030
Matt Rajca
Comment 23 2017-01-23 15:33:32 PST
(In reply to comment #22) > This change appears to have caused 4 API test failures: > > Tests that failed: > > RequiresUserActionForPlaybackTest. > DeprecatedRequiresUserActionForAudioAndVideoPlayback > > RequiresUserActionForPlaybackTest. > DeprecatedRequiresUserActionForAudioButNotVideoPlayback > > RequiresUserActionForPlaybackTest.RequiresUserActionForAudioAndVideoPlayback > > RequiresUserActionForPlaybackTest. > RequiresUserActionForAudioButNotVideoPlayback > > https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK1%20(Tests)/ > builds/3030 A follow-up patch that addresses these is almost ready.
Matt Rajca
Comment 24 2017-01-23 17:42:52 PST
https://bugs.webkit.org/show_bug.cgi?id=167346 is tracking a fix. Just waiting for one other patch to land on the commit queue. Thanks for the heads up!
WebKit Commit Bot
Comment 25 2017-01-23 18:19:07 PST
Re-opened since this is blocked by bug 167354
Matt Rajca
Comment 26 2017-01-24 13:12:49 PST
Take 2 of this work has landed with regressions fixed: https://bugs.webkit.org/show_bug.cgi?id=167355 *** This bug has been marked as a duplicate of bug 167355 ***
Note You need to log in before you can comment on or make changes to this bug.