Title: [198609] trunk
Revision
198609
Author
[email protected]
Date
2016-03-23 17:43:39 -0700 (Wed, 23 Mar 2016)

Log Message

Media elements allowed to play without a user gesture, but requiring fullscreen playback, should not be allowed to autoplay.
https://bugs.webkit.org/show_bug.cgi?id=155599

Reviewed by Darin Adler.

Test: media/video-autoplay-allowed-but-fullscreen-required.html

Entering fullscreen should always require a user gesture.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted):

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required-expected.txt (0 => 198609)


--- trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required-expected.txt	2016-03-24 00:43:39 UTC (rev 198609)
@@ -0,0 +1,5 @@
+RUN(internals.settings.setAllowsInlineMediaPlayback(false))
+EVENT(canplaythrough)
+Video did not begin playing OK
+END OF TEST
+

Added: trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required.html (0 => 198609)


--- trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-autoplay-allowed-but-fullscreen-required.html	2016-03-24 00:43:39 UTC (rev 198609)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>video-main-content-allow</title>
+    <script src=""
+    <script src=""
+    <script>
+    function go() {
+        run('internals.settings.setAllowsInlineMediaPlayback(false)');
+        video = document.createElement('video');
+        document.body.appendChild(video);
+
+        video.src = "" 'content/test');
+        waitForEvent('canplaythrough', canPlayThrough);
+    }
+
+    function canPlayThrough() {
+        video.play();
+        waitForEventAndFail('playing');
+        setTimeout(didNotPlay, 100);
+    }
+
+    function didNotPlay() {
+        logResult(true, "Video did not begin playing");
+        endTest();
+    }
+    </script>
+</head>
+<body _onload_="go()">
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (198608 => 198609)


--- trunk/Source/WebCore/ChangeLog	2016-03-24 00:42:04 UTC (rev 198608)
+++ trunk/Source/WebCore/ChangeLog	2016-03-24 00:43:39 UTC (rev 198609)
@@ -1,3 +1,17 @@
+2016-03-23  Jer Noble  <[email protected]>
+
+        Media elements allowed to play without a user gesture, but requiring fullscreen playback, should not be allowed to autoplay.
+        https://bugs.webkit.org/show_bug.cgi?id=155599
+
+        Reviewed by Darin Adler.
+
+        Test: media/video-autoplay-allowed-but-fullscreen-required.html
+
+        Entering fullscreen should always require a user gesture.
+
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::playbackPermitted):
+
 2016-03-23  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r198538.

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (198608 => 198609)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2016-03-24 00:42:04 UTC (rev 198608)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2016-03-24 00:43:39 UTC (rev 198609)
@@ -146,6 +146,11 @@
     if (pageExplicitlyAllowsElementToAutoplayInline(element))
         return true;
 
+    if (requiresFullscreenForVideoPlayback(element) && !ScriptController::processingUserGestureForMedia()) {
+        LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE");
+        return false;
+    }
+
     if (m_restrictions & OverrideUserGestureRequirementForMainContent && updateIsMainContent())
         return true;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to