WebKit Bugzilla
Attachment 358756 Details for
Bug 193301
: Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193301-20190109154926.patch (text/plain), 25.73 KB, created by
Matt Rajca
on 2019-01-09 15:49:27 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Matt Rajca
Created:
2019-01-09 15:49:27 PST
Size:
25.73 KB
patch
obsolete
>Subversion Revision: 239787 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 25c58e6284f286583363a9767e0c23cf0cee3809..4e9e3d374ffd36bd081386dae275b9289638a293 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2019-01-09 Matt Rajca <mrajca@apple.com> >+ >+ Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag >+ https://bugs.webkit.org/show_bug.cgi?id=193301 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Instead of unconditionally enabling this with a compile-time flag, let clients >+ enable the quirk on a per-load basis. >+ >+ Tests: added API tests in favor of the current layout test as this behavior is no >+ longer on by default unless a client opts in. >+ >+ * html/MediaElementSession.cpp: >+ (WebCore::needsPerDocumentAutoplayBehaviorQuirk): >+ (WebCore::MediaElementSession::playbackPermitted const): >+ * loader/DocumentLoader.h: >+ > 2019-01-09 Zalan Bujtas <zalan@apple.com> > > [Datalist] Crash when input with datalist is dynamically added. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index e1197ef54d65a5040dab010a48fba34029eb33c4..1a7a1abd1fa4de1b4b8f004dca4d951f7988fdbe 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,25 @@ >+2019-01-09 Matt Rajca <mrajca@apple.com> >+ >+ Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag >+ https://bugs.webkit.org/show_bug.cgi?id=193301 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Register a new quirk that can be configured per-load for per-document media >+ autoplay behaviors. >+ >+ * Shared/WebsiteAutoplayQuirk.h: >+ * Shared/WebsitePoliciesData.cpp: >+ (WebKit::WebsitePoliciesData::applyToDocumentLoader): >+ * UIProcess/API/C/WKWebsitePolicies.cpp: >+ (WKWebsitePoliciesSetAllowedAutoplayQuirks): >+ (WKWebsitePoliciesGetAllowedAutoplayQuirks): >+ * UIProcess/API/C/WKWebsitePolicies.h: >+ * UIProcess/API/Cocoa/_WKWebsitePolicies.h: >+ * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: >+ (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]): >+ (-[_WKWebsitePolicies allowedAutoplayQuirks]): >+ > 2019-01-09 Brent Fulgham <bfulgham@apple.com> > > [iOS] Update sandbox profile to use iconservices instead of lsdiconservice >diff --git a/Source/WebCore/html/MediaElementSession.cpp b/Source/WebCore/html/MediaElementSession.cpp >index eae608eee5df6742d3f4be866ad6334375daab80..be6203dd7dc0c5a642167598ab009557503f4b16 100644 >--- a/Source/WebCore/html/MediaElementSession.cpp >+++ b/Source/WebCore/html/MediaElementSession.cpp >@@ -255,6 +255,15 @@ static bool needsArbitraryUserGestureAutoplayQuirk(const Document& document) > } > #endif // PLATFORM(MAC) > >+static bool needsPerDocumentAutoplayBehaviorQuirk(const Document& document) >+{ >+ if (!document.settings().needsSiteSpecificQuirks()) >+ return false; >+ >+ auto loader = makeRefPtr(document.loader()); >+ return loader && loader->allowedAutoplayQuirks().contains(AutoplayQuirk::PerDocumentAutoplayBehavior); >+} >+ > SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted() const > { > if (m_element.isSuspended()) { >@@ -290,12 +299,11 @@ SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted() co > } > #endif > >-#if PLATFORM(MAC) >- // FIXME <https://webkit.org/b/175856>: Make this dependent on a runtime flag for desktop autoplay restrictions. > const auto& topDocument = document.topDocument(); >- if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && topDocument.settings().needsSiteSpecificQuirks()) >+ if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && needsPerDocumentAutoplayBehaviorQuirk(topDocument)) > return { }; > >+#if PLATFORM(MAC) > if (document.hasHadUserInteraction() && needsArbitraryUserGestureAutoplayQuirk(document)) > return { }; > #endif >diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h >index f4c637739a3594db19a3d5ded204fbd3ee2f70fe..804be9bd75eac205ffcf6bdb94487fd182c91c3d 100644 >--- a/Source/WebCore/loader/DocumentLoader.h >+++ b/Source/WebCore/loader/DocumentLoader.h >@@ -103,6 +103,7 @@ enum class AutoplayQuirk { > SynthesizedPauseEvents = 1 << 0, > InheritedUserGestures = 1 << 1, > ArbitraryUserGestures = 1 << 2, >+ PerDocumentAutoplayBehavior = 1 << 3, > }; > > enum class PopUpPolicy { >diff --git a/Source/WebKit/Shared/WebsiteAutoplayQuirk.h b/Source/WebKit/Shared/WebsiteAutoplayQuirk.h >index cd473e5b1955e062d736b608e58fc4b62f0f249a..df98be7d6126173a0fc5f7214758a5fd45286cb7 100644 >--- a/Source/WebKit/Shared/WebsiteAutoplayQuirk.h >+++ b/Source/WebKit/Shared/WebsiteAutoplayQuirk.h >@@ -31,6 +31,7 @@ enum class WebsiteAutoplayQuirk { > SynthesizedPauseEvents = 1 << 0, > InheritedUserGestures = 1 << 1, > ArbitraryUserGestures = 1 << 2, >+ PerDocumentAutoplayBehavior = 1 << 3, > }; > > } >diff --git a/Source/WebKit/Shared/WebsitePoliciesData.cpp b/Source/WebKit/Shared/WebsitePoliciesData.cpp >index b44c98653086d8b3c32ade2bba35c54b449c6fba..fb8e240599d8bb580a83e8d1b0fbf684b5e6714e 100644 >--- a/Source/WebKit/Shared/WebsitePoliciesData.cpp >+++ b/Source/WebKit/Shared/WebsitePoliciesData.cpp >@@ -130,6 +130,9 @@ void WebsitePoliciesData::applyToDocumentLoader(WebsitePoliciesData&& websitePol > if (allowedQuirks.contains(WebsiteAutoplayQuirk::ArbitraryUserGestures)) > quirks.add(WebCore::AutoplayQuirk::ArbitraryUserGestures); > >+ if (allowedQuirks.contains(WebsiteAutoplayQuirk::PerDocumentAutoplayBehavior)) >+ quirks.add(WebCore::AutoplayQuirk::PerDocumentAutoplayBehavior); >+ > documentLoader.setAllowedAutoplayQuirks(quirks); > > switch (websitePolicies.autoplayPolicy) { >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp b/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp >index 668edb25d5f29d03ffbd3e1bd37b7fcad97ac9a9..64dbef86ce3adee875404a7b5c2d4753cb41c7e7 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp >@@ -91,6 +91,9 @@ void WKWebsitePoliciesSetAllowedAutoplayQuirks(WKWebsitePoliciesRef websitePolic > if (allowedQuirks & kWKWebsiteAutoplayQuirkArbitraryUserGestures) > quirks.add(WebsiteAutoplayQuirk::ArbitraryUserGestures); > >+ if (allowedQuirks & kWKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior) >+ quirks.add(WebsiteAutoplayQuirk::PerDocumentAutoplayBehavior); >+ > toImpl(websitePolicies)->setAllowedAutoplayQuirks(quirks); > } > >@@ -108,6 +111,9 @@ WKWebsiteAutoplayQuirk WKWebsitePoliciesGetAllowedAutoplayQuirks(WKWebsitePolici > if (allowedQuirks.contains(WebsiteAutoplayQuirk::ArbitraryUserGestures)) > quirks |= kWKWebsiteAutoplayQuirkArbitraryUserGestures; > >+ if (allowedQuirks.contains(WebsiteAutoplayQuirk::PerDocumentAutoplayBehavior)) >+ quirks |= kWKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior; >+ > return quirks; > } > >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.h b/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.h >index afcf421fc342788704befeb1e2b15a28a543b65a..309648b329583bb7825f3df442cb37b6d70730f5 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.h >+++ b/Source/WebKit/UIProcess/API/C/WKWebsitePolicies.h >@@ -45,6 +45,7 @@ enum { > kWKWebsiteAutoplayQuirkSynthesizedPauseEvents = 1 << 0, > kWKWebsiteAutoplayQuirkInheritedUserGestures = 1 << 1, > kWKWebsiteAutoplayQuirkArbitraryUserGestures = 1 << 2, >+ kWKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior = 1 << 3, > }; > > enum WKWebsitePopUpPolicy { >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h >index 6a2d32f25cec49fe24b3a0d26baf7835480497b3..cb7c2d0a4b714c903f94d5c8b9635f2900a2cd26 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h >@@ -38,6 +38,7 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteAutoplayQuirk) { > _WKWebsiteAutoplayQuirkSynthesizedPauseEvents = 1 << 0, > _WKWebsiteAutoplayQuirkInheritedUserGestures = 1 << 1, > _WKWebsiteAutoplayQuirkArbitraryUserGestures = 1 << 2, >+ _WKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior = 1 << 3, > } WK_API_AVAILABLE(macosx(10.13), ios(11.0)); > > typedef NS_OPTIONS(NSUInteger, _WKWebsitePopUpPolicy) { >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm >index 46286cdbf9b2656ed5420d1bdff270bf96f715b3..3928e3949b6b4e4bdf8ea0722af3353d33d236d1 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm >@@ -82,6 +82,9 @@ - (void)setAllowedAutoplayQuirks:(_WKWebsiteAutoplayQuirk)allowedQuirks > if (allowedQuirks & _WKWebsiteAutoplayQuirkArbitraryUserGestures) > quirks.add(WebKit::WebsiteAutoplayQuirk::ArbitraryUserGestures); > >+ if (allowedQuirks & _WKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior) >+ quirks.add(WebKit::WebsiteAutoplayQuirk::PerDocumentAutoplayBehavior); >+ > _websitePolicies->setAllowedAutoplayQuirks(quirks); > } > >@@ -99,6 +102,9 @@ - (_WKWebsiteAutoplayQuirk)allowedAutoplayQuirks > if (allowedQuirks.contains(WebKit::WebsiteAutoplayQuirk::ArbitraryUserGestures)) > quirks |= _WKWebsiteAutoplayQuirkArbitraryUserGestures; > >+ if (allowedQuirks.contains(WebKit::WebsiteAutoplayQuirk::PerDocumentAutoplayBehavior)) >+ quirks |= _WKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior; >+ > return quirks; > } > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index dac4e62334e49a9551de4736118084ab527250bd..d9a98e52243ee98c3af0cde9789c1e5211f04a43 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-09 Matt Rajca <mrajca@apple.com> >+ >+ Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag >+ https://bugs.webkit.org/show_bug.cgi?id=193301 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added API tests. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm: >+ (TEST): >+ * TestWebKitAPI/Tests/WebKitCocoa/autoplaying-multiple-media-elements.html: Added. >+ > 2019-01-09 Aakash Jain <aakash_jain@apple.com> > > [ews-build] Add link to bug along with bug title >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 3bf2be690c08dbaa577fc701b8a8b1c2f5d32887..12d2a04aabeec19483c7caba35a7dbdb747f937a 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -739,6 +739,7 @@ > C9C60E661E53A9DC006DA181 /* autoplay-check-in-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C9C60E641E53A9BA006DA181 /* autoplay-check-in-iframe.html */; }; > C9C9A91B21DED28700FDE96E /* audio-with-play-button.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C9C9A91A21DED24D00FDE96E /* audio-with-play-button.html */; }; > C9C9A91D21DED7A000FDE96E /* video-with-play-button.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C9C9A91C21DED79400FDE96E /* video-with-play-button.html */; }; >+ C9C9CD4321E6A6860019DB96 /* autoplaying-multiple-media-elements.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C9C9CD4221E6A6670019DB96 /* autoplaying-multiple-media-elements.html */; }; > C9E6DD351EA97D0800DD78AA /* FirstResponderSuppression.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9E6DD311EA972D800DD78AA /* FirstResponderSuppression.mm */; }; > C9E8EE7521DED94300797765 /* long-test.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = C9E8EE7421DED91E00797765 /* long-test.mp4 */; }; > CA38459620AE17A900990D3B /* LocalStorageDatabaseTracker.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA38459520AE012E00990D3B /* LocalStorageDatabaseTracker.mm */; }; >@@ -1015,6 +1016,7 @@ > C95984F51E36BC6B002C0D45 /* autoplay-no-audio-check.html in Copy Resources */, > C99B675C1E39721A00FC6C80 /* autoplay-with-controls.html in Copy Resources */, > C99BDF891E80980400C7170E /* autoplay-zero-volume-check.html in Copy Resources */, >+ C9C9CD4321E6A6860019DB96 /* autoplaying-multiple-media-elements.html in Copy Resources */, > 2E14A5291D3FE96B0010F35B /* autoplaying-video-with-audio.html in Copy Resources */, > F41AB9A01EF4696B0083FA08 /* background-image-link-and-input.html in Copy Resources */, > 2DE71B001D49C3ED00904094 /* blinking-div.html in Copy Resources */, >@@ -2028,6 +2030,7 @@ > C9C60E641E53A9BA006DA181 /* autoplay-check-in-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "autoplay-check-in-iframe.html"; sourceTree = "<group>"; }; > C9C9A91A21DED24D00FDE96E /* audio-with-play-button.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "audio-with-play-button.html"; path = "Tests/WebKitCocoa/audio-with-play-button.html"; sourceTree = SOURCE_ROOT; }; > C9C9A91C21DED79400FDE96E /* video-with-play-button.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "video-with-play-button.html"; path = "Tests/WebKitCocoa/video-with-play-button.html"; sourceTree = SOURCE_ROOT; }; >+ C9C9CD4221E6A6670019DB96 /* autoplaying-multiple-media-elements.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "autoplaying-multiple-media-elements.html"; sourceTree = "<group>"; }; > C9E6DD311EA972D800DD78AA /* FirstResponderSuppression.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FirstResponderSuppression.mm; sourceTree = "<group>"; }; > C9E8EE7421DED91E00797765 /* long-test.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "long-test.mp4"; sourceTree = "<group>"; }; > CA38459520AE012E00990D3B /* LocalStorageDatabaseTracker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalStorageDatabaseTracker.mm; sourceTree = "<group>"; }; >@@ -2788,6 +2791,7 @@ > CD57779A211CE6B7001B371E /* audio-with-web-audio.html */, > F41AB9981EF4692C0083FA08 /* autofocus-contenteditable.html */, > 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */, >+ C9C9CD4221E6A6670019DB96 /* autoplaying-multiple-media-elements.html */, > 2E14A5281D3FE8B80010F35B /* autoplaying-video-with-audio.html */, > F41AB9971EF4692C0083FA08 /* background-image-link-and-input.html */, > 2DE71AFF1D49C2F000904094 /* blinking-div.html */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm >index 7b68f77da6ccf2e8e7bd5eeee80f21a791044e77..825ed10d2b2907b97a4d56c6ecf537352aa10b75 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm >@@ -741,6 +741,69 @@ TEST(WebKit, WebsitePoliciesAutoplayQuirks) > [webView waitForMessage:@"playing"]; > } > >+TEST(WebKit, WebsitePoliciesPerDocumentAutoplayBehaviorQuirks) >+{ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); >+ >+ auto delegate = adoptNS([[AutoplayPoliciesDelegate alloc] init]); >+ [webView setNavigationDelegate:delegate.get()]; >+ >+ WKRetainPtr<WKPreferencesRef> preferences(AdoptWK, WKPreferencesCreate()); >+ WKPreferencesSetNeedsSiteSpecificQuirks(preferences.get(), true); >+ WKPageGroupSetPreferences(WKPageGetPageGroup([webView _pageForTesting]), preferences.get()); >+ >+ receivedAutoplayEvent = WTF::nullopt; >+ >+ NSURLRequest *requestWithMultipleMediaElements = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"autoplaying-multiple-media-elements" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]; >+ >+ [delegate setAllowedAutoplayQuirksForURL:^_WKWebsiteAutoplayQuirk(NSURL *url) { >+ return _WKWebsiteAutoplayQuirkPerDocumentAutoplayBehavior; >+ }]; >+ [delegate setAutoplayPolicyForURL:^(NSURL *) { >+ return _WKWebsiteAutoplayPolicyDeny; >+ }]; >+ [webView loadRequest:requestWithMultipleMediaElements]; >+ [webView waitForMessage:@"loaded"]; >+ >+ // We should not be allowed to play without a user gesture. >+ [webView _evaluateJavaScriptWithoutUserGesture:@"playVideo('video1')" completionHandler:nil]; >+ [webView waitForMessage:@"did-not-play-video1"]; >+ >+ // Now try again with a user gesture... >+ const NSPoint playButtonClickPoint = NSMakePoint(20, 580); >+ [webView mouseDownAtPoint:playButtonClickPoint simulatePressure:NO]; >+ [webView mouseUpAtPoint:playButtonClickPoint]; >+ [webView waitForMessage:@"did-play-video1"]; >+ >+ // Now video2 should also be allowed to autoplay without a user gesture because of the quirk. >+ [webView _evaluateJavaScriptWithoutUserGesture:@"playVideo('video2')" completionHandler:nil]; >+ [webView waitForMessage:@"did-play-video2"]; >+ >+ // Now let's test this without the quirk. >+ [webView loadHTMLString:@"" baseURL:nil]; >+ receivedAutoplayEvent = WTF::nullopt; >+ >+ [delegate setAllowedAutoplayQuirksForURL:^_WKWebsiteAutoplayQuirk(NSURL *url) { >+ return 0; >+ }]; >+ [webView loadRequest:requestWithMultipleMediaElements]; >+ [webView waitForMessage:@"loaded"]; >+ >+ // We should not be allowed to play without a user gesture. >+ [webView _evaluateJavaScriptWithoutUserGesture:@"playVideo('video1')" completionHandler:nil]; >+ [webView waitForMessage:@"did-not-play-video1"]; >+ >+ // Now try again with a user gesture... >+ [webView mouseDownAtPoint:playButtonClickPoint simulatePressure:NO]; >+ [webView mouseUpAtPoint:playButtonClickPoint]; >+ [webView waitForMessage:@"did-play-video1"]; >+ >+ // Now video2 should not be allowed to autoplay without a user gesture. >+ [webView _evaluateJavaScriptWithoutUserGesture:@"playVideo('video2')" completionHandler:nil]; >+ [webView waitForMessage:@"did-not-play-video2"]; >+} >+ > TEST(WebKit, WebsitePoliciesAutoplayQuirksAsyncPolicyDelegate) > { > auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/autoplaying-multiple-media-elements.html b/Tools/TestWebKitAPI/Tests/WebKitCocoa/autoplaying-multiple-media-elements.html >new file mode 100644 >index 0000000000000000000000000000000000000000..72965c049b2d8e4491242163ff70384a91abbeaa >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/autoplaying-multiple-media-elements.html >@@ -0,0 +1,34 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script> >+ >+ function pageLoaded() { >+ try { >+ window.webkit.messageHandlers.testHandler.postMessage('loaded'); >+ } catch(e) { } >+ } >+ >+ function playVideo(identifier) { >+ document.getElementById(identifier).play().catch(function() { >+ try { >+ window.webkit.messageHandlers.testHandler.postMessage("did-not-play-" + identifier); >+ } catch(e) { } >+ }); >+ } >+ >+ function didPlayVideo(identifier) { >+ try { >+ window.webkit.messageHandlers.testHandler.postMessage("did-play-" + identifier); >+ } catch(e) { } >+ } >+ >+ </script> >+</head> >+<body onload="pageLoaded()"> >+ <button onclick="playVideo('video1')">Play Video 1</button> >+ <br /> >+ <video id="video1" onplaying="didPlayVideo('video1')" src="video-with-audio.mp4"></video> >+ <video id="video2" onplaying="didPlayVideo('video2')" src="video-with-audio.mp4"></video> >+</body> >+</html> >diff --git a/LayoutTests/media/document-level-media-user-gesture-quirk-expected.txt b/LayoutTests/media/document-level-media-user-gesture-quirk-expected.txt >deleted file mode 100644 >index 4512d903d1421e2895826c4fa620fd684e5c3318..0000000000000000000000000000000000000000 >--- a/LayoutTests/media/document-level-media-user-gesture-quirk-expected.txt >+++ /dev/null >@@ -1,13 +0,0 @@ >- >-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 >- >diff --git a/LayoutTests/media/document-level-media-user-gesture-quirk.html b/LayoutTests/media/document-level-media-user-gesture-quirk.html >deleted file mode 100644 >index 57ae7d2f38510aff0fae168f763c2719d484e6d2..0000000000000000000000000000000000000000 >--- a/LayoutTests/media/document-level-media-user-gesture-quirk.html >+++ /dev/null >@@ -1,38 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <title>document-level-media-user-gesture-quirk</title> >- <script src=media-file.js></script> >- <script src=video-test.js></script> >- <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="content/test.mp4"></video> >- <video id="video2" src="content/test.mp4"></video> >-</body> >-</html> >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index f61083ca3937fe48049d8e21c0969def00657fc3..8a2c2f2f2bd00372fcabac74a0064b2f9af346d6 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -944,9 +944,6 @@ media/video-seek-to-current-time.html [ Skip ] > # 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 > >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 95ad37280909e4cfddb575dd87ce5a3c524e53db..77ca55c5af2378f5add17c462ea9bd97047f51dc 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -2491,7 +2491,6 @@ media/media-fullscreen-inline.html > > 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 >diff --git a/LayoutTests/platform/win/TestExpectations b/LayoutTests/platform/win/TestExpectations >index f34aa0eac016f93c71162cd2728820cc0e83d866..ed0c2980015060090d6a9bc03a422faf5bef51bc 100644 >--- a/LayoutTests/platform/win/TestExpectations >+++ b/LayoutTests/platform/win/TestExpectations >@@ -3720,9 +3720,6 @@ webkit.org/b/162415 imported/w3c/web-platform-tests/html/syntax [ Skip ] > # 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 ] >diff --git a/LayoutTests/platform/wincairo/TestExpectations b/LayoutTests/platform/wincairo/TestExpectations >index 8b895c83ce3e2c173be6b677a4ef36bd18c2c3cb..09c2a08c43eeb7a135da13adb47f959b95f5dcda 100644 >--- a/LayoutTests/platform/wincairo/TestExpectations >+++ b/LayoutTests/platform/wincairo/TestExpectations >@@ -408,9 +408,6 @@ media/controls [ Skip ] > # 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 ] >- > # These tests reference specific fonts on Mac port. > Bug(GTK) fast/text/font-weights.html [ WontFix ] > Bug(GTK) fast/text/font-weights-zh.html [ WontFix ] >diff --git a/LayoutTests/platform/wpe/TestExpectations b/LayoutTests/platform/wpe/TestExpectations >index 629f8cecadfa23d3305d6461bc16e97071ad8a3a..c83d1db58204ddb263883f501201e25a72cb0fe7 100644 >--- a/LayoutTests/platform/wpe/TestExpectations >+++ b/LayoutTests/platform/wpe/TestExpectations >@@ -298,9 +298,6 @@ Bug(WPE) js/stringimpl-to-jsstring-on-large-strings-3.html [ Skip ] > fast/canvas/webmetal [ Skip ] > webgpu [ Skip ] > >-# This test relies on Mac-specific quirks >-media/document-level-media-user-gesture-quirk.html [ Skip ] >- > # Skipped due to untestable DRM key system. ClearKey counterparts are tested instead. > imported/w3c/web-platform-tests/encrypted-media/drm-check-initdata-type.https.html [ Skip ] > imported/w3c/web-platform-tests/encrypted-media/drm-events.https.html [ Skip ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
jer.noble
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193301
:
358751
| 358756