Diff
Modified: trunk/LayoutTests/ChangeLog (221385 => 221386)
--- trunk/LayoutTests/ChangeLog 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/LayoutTests/ChangeLog 2017-08-30 18:45:15 UTC (rev 221386)
@@ -1,3 +1,13 @@
+2017-08-22 Matt Rajca <mra...@apple.com>
+
+ Opt all Mac clients into document-level media user gesture quirks.
+ https://bugs.webkit.org/show_bug.cgi?id=175831
+
+ Reviewed by Eric Carlson.
+
+ * media/document-level-media-user-gesture-quirk-expected.txt: Added.
+ * media/document-level-media-user-gesture-quirk.html: Added.
+
2017-08-30 Matt Lewis <jlew...@apple.com>
Rebaseline js/dom/global-constructors-attributes.html for High Sierra after r221302.
Added: trunk/LayoutTests/media/document-level-media-user-gesture-quirk-expected.txt (0 => 221386)
--- trunk/LayoutTests/media/document-level-media-user-gesture-quirk-expected.txt (rev 0)
+++ trunk/LayoutTests/media/document-level-media-user-gesture-quirk-expected.txt 2017-08-30 18:45:15 UTC (rev 221386)
@@ -0,0 +1,13 @@
+
+RUN(internals.setMediaElementRestrictions(video1, "RequireUserGestureForAudioRateChange"))
+RUN(internals.setMediaElementRestrictions(video2, "RequireUserGestureForAudioRateChange"))
+RUN(internals.settings.setNeedsSiteSpecificQuirks(true))
+Trying to play the first video without a user gesture
+RUN(video1.play().then(failTest).catch(playFirstVideoWithUserGesture))
+Playback was denied - trying to play the first video with a user gesture
+RUN(video1.play().then(playedFirstVideo).catch(failTest))
+The first video played with a user gesture - trying to play the second video
+The second video should play unconditionally on Mac with quirks enabled
+RUN(video2.play().then(endTest).catch(failTest))
+END OF TEST
+
Added: trunk/LayoutTests/media/document-level-media-user-gesture-quirk.html (0 => 221386)
--- trunk/LayoutTests/media/document-level-media-user-gesture-quirk.html (rev 0)
+++ trunk/LayoutTests/media/document-level-media-user-gesture-quirk.html 2017-08-30 18:45:15 UTC (rev 221386)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>document-level-media-user-gesture-quirk</title>
+ <script src=""
+ <script src=""
+ <script>
+ function runTest() {
+ var video1 = document.getElementById('video1');
+ var video2 = document.getElementById('video2');
+
+ run('internals.setMediaElementRestrictions(video1, "RequireUserGestureForAudioRateChange")');
+ run('internals.setMediaElementRestrictions(video2, "RequireUserGestureForAudioRateChange")');
+ run('internals.settings.setNeedsSiteSpecificQuirks(true)');
+
+ consoleWrite("Trying to play the first video without a user gesture");
+ run('video1.play().then(failTest).catch(playFirstVideoWithUserGesture)');
+ }
+
+ function playFirstVideoWithUserGesture() {
+ consoleWrite("Playback was denied - trying to play the first video with a user gesture");
+ runWithKeyDown(() => {
+ run('video1.play().then(playedFirstVideo).catch(failTest)');
+ });
+ }
+
+ function playedFirstVideo() {
+ consoleWrite("The first video played with a user gesture - trying to play the second video");
+ consoleWrite("The second video should play unconditionally on Mac with quirks enabled");
+ run('video2.play().then(endTest).catch(failTest)');
+ }
+ </script>
+</head>
+<body _onload_="runTest()">
+ <video id="video1" src=""
+ <video id="video2" src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (221385 => 221386)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2017-08-30 18:45:15 UTC (rev 221386)
@@ -1031,6 +1031,9 @@
# Media controls tests are OS X only
media/controls [ Skip ]
+# This test relies on Mac-specific quirks
+media/document-level-media-user-gesture-quirk.html [ Skip ]
+
# WIRELESS_PLAYBACK_TARGET not enabled.
media/airplay-target-availability.html
Modified: trunk/LayoutTests/platform/ios/TestExpectations (221385 => 221386)
--- trunk/LayoutTests/platform/ios/TestExpectations 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2017-08-30 18:45:15 UTC (rev 221386)
@@ -2558,6 +2558,7 @@
webkit.org/b/136708 media/media-fullscreen-not-in-document.html
+media/document-level-media-user-gesture-quirk.html
media/media-controls-accessibility.html [ Timeout ]
media/media-fullscreen-return-to-inline.html
media/no-autoplay-with-user-gesture-requirement.html
Modified: trunk/LayoutTests/platform/win/TestExpectations (221385 => 221386)
--- trunk/LayoutTests/platform/win/TestExpectations 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/LayoutTests/platform/win/TestExpectations 2017-08-30 18:45:15 UTC (rev 221386)
@@ -3988,6 +3988,9 @@
# Only Mac has implemented DictionaryLookup
fast/layers/prevent-hit-test-during-layout.html [ Skip ]
+# This test relies on Mac-specific quirks
+media/document-level-media-user-gesture-quirk.html [ Skip ]
+
# webrtc not supported
imported/w3c/web-platform-tests/webrtc [ Skip ]
webrtc [ Skip ]
Modified: trunk/LayoutTests/platform/wpe/TestExpectations (221385 => 221386)
--- trunk/LayoutTests/platform/wpe/TestExpectations 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/LayoutTests/platform/wpe/TestExpectations 2017-08-30 18:45:15 UTC (rev 221386)
@@ -314,6 +314,9 @@
# These are Mac specific for now.
fast/url/user-visible [ Skip ]
+# This test relies on Mac-specific quirks
+media/document-level-media-user-gesture-quirk.html [ Skip ]
+
Bug(WPE) fast/viewport/ios [ Failure ]
Bug(WPE) fast/viewport/viewport-legacy-handheldfriendly.html [ Failure ]
Bug(WPE) fast/viewport/viewport-legacy-mobileoptimized-2.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (221385 => 221386)
--- trunk/Source/WebCore/ChangeLog 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/Source/WebCore/ChangeLog 2017-08-30 18:45:15 UTC (rev 221386)
@@ -1,3 +1,18 @@
+2017-08-22 Matt Rajca <mra...@apple.com>
+
+ Opt all Mac clients into document-level media user gesture quirks.
+ https://bugs.webkit.org/show_bug.cgi?id=175831
+
+ This un-breaks many of the sites that take a long time to load video ad elements on-demand.
+
+ Reviewed by Eric Carlson.
+
+ Test: media/document-level-media-user-gesture-quirk.html
+
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::playbackPermitted const):
+ (WebCore::needsDocumentLevelMediaUserGestureQuirk): Deleted.
+
2017-08-22 Filip Pizlo <fpi...@apple.com>
Strings need to be in some kind of gigacage
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (221385 => 221386)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2017-08-30 18:29:07 UTC (rev 221385)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2017-08-30 18:45:15 UTC (rev 221386)
@@ -148,26 +148,6 @@
m_restrictions &= ~restriction;
}
-#if PLATFORM(MAC)
-static bool needsDocumentLevelMediaUserGestureQuirk(Document& document)
-{
- if (!document.settings().needsSiteSpecificQuirks())
- return false;
-
- String host = document.topDocument().url().host();
- if (equalLettersIgnoringASCIICase(host, "slate.com") || host.endsWithIgnoringASCIICase(".slate.com"))
- return true;
-
- if (equalLettersIgnoringASCIICase(host, "ign.com") || host.endsWithIgnoringASCIICase(".ign.com"))
- return true;
-
- if (equalLettersIgnoringASCIICase(host, "washingtonpost.com") || host.endsWithIgnoringASCIICase(".washingtonpost.com"))
- return true;
-
- return false;
-}
-#endif // PLATFORM(MAC)
-
SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted(const HTMLMediaElement& element) const
{
if (element.document().isMediaDocument() && !element.document().ownerElement())
@@ -194,7 +174,9 @@
#endif
#if PLATFORM(MAC)
- if (element.document().topDocument().mediaState() & MediaProducer::HasUserInteractedWithMediaElement && needsDocumentLevelMediaUserGestureQuirk(element.document()))
+ // FIXME <https://webkit.org/b/175856>: Make this dependent on a runtime flag for desktop autoplay restrictions.
+ const auto& topDocument = element.document().topDocument();
+ if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && topDocument.settings().needsSiteSpecificQuirks())
return { };
#endif