WebKit Bugzilla
Attachment 358337 Details for
Bug 192829
: [WebKitLegacy] Media playback pauses on scroll
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-192829-20190104110421.patch (text/plain), 38.33 KB, created by
Jer Noble
on 2019-01-04 11:04:22 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-01-04 11:04:22 PST
Size:
38.33 KB
patch
obsolete
>Subversion Revision: 239617 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 176340ac59334b8b9ed28ffc103713f72de21f5b..fb423d4e75223b16c682a6bc3dbbe32e03a300c6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2018-12-18 Jer Noble <jer.noble@apple.com> >+ >+ [WebKitLegacy] Media playback pauses on scroll >+ https://bugs.webkit.org/show_bug.cgi?id=192829 >+ >+ Reviewed by Eric Carlson. >+ >+ New API tests: >+ WebKitLegacy.ScrollingDoesNotPauseMedia >+ WKWebView.StopAllMediaPlayback >+ WKWebView.SuspendResumeAllMediaPlayback >+ >+ Do not use suspendActiveDOMObjects(ReasonForSuspension::PageWillBeSuspended) to pause >+ video. Roll back the changes to HTMLMediaElement, and introduce a new set of Page calls >+ suspendAllMediaPlayback() & resumeAllMediaPlayback() which replaces the removed bahavior. >+ >+ * dom/Document.cpp: >+ (WebCore::Document::~Document): >+ (WebCore::Document::stopAllMediaPlayback): >+ (WebCore::Document::suspendAllMediaPlayback): >+ (WebCore::Document::resumeAllMediaPlayback): >+ * dom/Document.h: >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::HTMLMediaElement): >+ (WebCore::HTMLMediaElement::parseAttribute): >+ (WebCore::HTMLMediaElement::didFinishInsertingNode): >+ (WebCore::HTMLMediaElement::setSrcObject): >+ (WebCore::HTMLMediaElement::updateActiveTextTrackCues): >+ (WebCore::HTMLMediaElement::suspend): >+ (WebCore::HTMLMediaElement::resume): >+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): >+ * html/HTMLMediaElement.h: >+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted. >+ * html/MediaElementSession.cpp: >+ (WebCore::MediaElementSession::playbackPermitted const): >+ * page/Page.cpp: >+ (WebCore::Page::stopAllMediaPlayback): >+ (WebCore::Page::suspendAllMediaPlayback): >+ (WebCore::Page::resumeAllMediaPlayback): >+ * page/Page.h: >+ (WebCore::Page::mediaPlaybackIsSuspended): >+ * platform/audio/PlatformMediaSession.h: >+ * platform/audio/PlatformMediaSessionManager.cpp: >+ (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument): >+ (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument): >+ * platform/audio/PlatformMediaSessionManager.h: >+ > 2018-09-12 Jer Noble <jer.noble@apple.com> > > SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index e07470b1fbfe72cffc2045d43618235a6b97a22a..305ca02adc597adfac7318d1932ead4172f742e2 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,32 @@ >+2018-12-18 Jer Noble <jer.noble@apple.com> >+ >+ [WebKitLegacy] Media playback pauses on scroll >+ https://bugs.webkit.org/show_bug.cgi?id=192829 >+ >+ Reviewed by Eric Carlson. >+ >+ Add a new WebPage, WebPageProxy, & WKWebView SPI to stop, suspend, and resume all >+ existing media playback in the page. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _stopAllMediaPlayback]): >+ (-[WKWebView _suspendAllMediaPlayback]): >+ (-[WKWebView _resumeAllMediaPlayback]): >+ * UIProcess/API/Cocoa/WKWebViewPrivate.h: >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::stopAllMediaPlayback): >+ (WebKit::WebPageProxy::suspendAllMediaPlayback): >+ (WebKit::WebPageProxy::resumeAllMediaPlayback): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: >+ (-[WKFullScreenViewController _showPhishingAlert]): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::stopAllMediaPlayback): >+ (WebKit::WebPage::suspendAllMediaPlayback): >+ (WebKit::WebPage::resumeAllMediaPlayback): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ > 2018-09-12 Jer Noble <jer.noble@apple.com> > > SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index ec66be7661d21606e57cd1f749cdcd42c17f5edc..c499217ab5f7b0f729e53eb9a75020a50a3243f2 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -652,8 +652,7 @@ Document::~Document() > m_cachedResourceLoader->setDocument(nullptr); > > #if ENABLE(VIDEO) >- if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists()) >- platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); >+ stopAllMediaPlayback(); > #endif > > // We must call clearRareData() here since a Document class inherits TreeScope >@@ -1722,6 +1721,23 @@ void Document::allowsMediaDocumentInlinePlaybackChanged() > element->allowsMediaDocumentInlinePlaybackChanged(); > } > >+void Document::stopAllMediaPlayback() >+{ >+ if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists()) >+ platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); >+} >+ >+void Document::suspendAllMediaPlayback() >+{ >+ if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists()) >+ platformMediaSessionManager->suspendAllMediaPlaybackForDocument(*this); >+} >+ >+void Document::resumeAllMediaPlayback() >+{ >+ if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists()) >+ platformMediaSessionManager->resumeAllMediaPlaybackForDocument(*this); >+} > #endif > > String Document::nodeName() const >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index 8a0ffe10b459712274de7d7242860290737cf9ea..b5c69260192c285fa203448ec5a90cef713fdac4 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -1119,6 +1119,10 @@ public: > void registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&); > void unregisterForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&); > void allowsMediaDocumentInlinePlaybackChanged(); >+ >+ void stopAllMediaPlayback(); >+ void suspendAllMediaPlayback(); >+ void resumeAllMediaPlayback(); > #endif > > WEBCORE_EXPORT void setShouldCreateRenderers(bool); >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index 9fd9d4f73e285d26150b6cc06e05dd6b0bc38a29..20cda52c729b47756c4fd6ffaf8dd5f235a8f2eb 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -466,7 +466,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum > , m_haveSetUpCaptionContainer(false) > #endif > , m_isScrubbingRemotely(false) >- , m_shouldUnpauseInternalOnResume(false) > #if ENABLE(VIDEO_TRACK) > , m_tracksAreReady(true) > , m_haveVisibleTextTrack(false) >@@ -919,6 +918,8 @@ void HTMLMediaElement::didFinishInsertingNode() > { > Ref<HTMLMediaElement> protectedThis(*this); // prepareForLoad may result in a 'beforeload' event, which can make arbitrary DOM mutations. > >+ INFO_LOG(LOGIDENTIFIER); >+ > if (m_inActiveDocument && m_networkState == NETWORK_EMPTY && !attributeWithoutSynchronization(srcAttr).isEmpty()) > prepareForLoad(); > >@@ -1130,6 +1131,7 @@ void HTMLMediaElement::setSrcObject(MediaProvider&& mediaProvider) > // 4.7.14.2. Location of the media resource > // srcObject: On setting, it must set the elementâs assigned media provider object to the new > // value, and then invoke the elementâs media element load algorithm. >+ INFO_LOG(LOGIDENTIFIER); > m_mediaProvider = WTFMove(mediaProvider); > prepareForLoad(); > } >@@ -1762,10 +1764,16 @@ void HTMLMediaElement::updateActiveTextTrackCues(const MediaTime& movieTime) > if (nextCue) > nextInterestingTime = std::min(nextInterestingTime, nextCue->low()); > >+ INFO_LOG(LOGIDENTIFIER, "nextInterestingTime:", nextInterestingTime); >+ > if (nextInterestingTime.isValid() && m_player) { >- m_player->performTaskAtMediaTime([weakThis = makeWeakPtr(this), nextInterestingTime] { >- if (weakThis) >- weakThis->updateActiveTextTrackCues(weakThis->currentMediaTime()); >+ m_player->performTaskAtMediaTime([this, weakThis = makeWeakPtr(this), nextInterestingTime] { >+ if (!weakThis) >+ return; >+ >+ auto currentMediaTime = weakThis->currentMediaTime(); >+ INFO_LOG(LOGIDENTIFIER, " - lambda, currentMediaTime:", currentMediaTime); >+ weakThis->updateActiveTextTrackCues(currentMediaTime); > }, nextInterestingTime); > } > >@@ -5728,11 +5736,6 @@ void HTMLMediaElement::suspend(ReasonForSuspension reason) > m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePageConsentToResumeMedia); > break; > case ReasonForSuspension::PageWillBeSuspended: >- if (!m_pausedInternal) { >- m_shouldUnpauseInternalOnResume = true; >- setPausedInternal(true); >- } >- break; > case ReasonForSuspension::JavaScriptDebuggerPaused: > case ReasonForSuspension::WillDeferLoading: > // Do nothing, we don't pause media playback in these cases. >@@ -5748,11 +5751,6 @@ void HTMLMediaElement::resume() > > m_asyncEventQueue.resume(); > >- if (m_shouldUnpauseInternalOnResume) { >- m_shouldUnpauseInternalOnResume = false; >- setPausedInternal(false); >- } >- > setShouldBufferData(true); > > if (!m_mediaSession->pageAllowsPlaybackAfterResuming()) >@@ -5936,6 +5934,12 @@ void HTMLMediaElement::setShouldPlayToPlaybackTarget(bool shouldPlay) > > #endif // ENABLE(WIRELESS_PLAYBACK_TARGET) > >+bool HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless() const >+{ >+ INFO_LOG(LOGIDENTIFIER, m_isPlayingToWirelessTarget); >+ return m_isPlayingToWirelessTarget; >+} >+ > void HTMLMediaElement::setPlayingOnSecondScreen(bool value) > { > if (value == m_playingOnSecondScreen) >diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h >index 118fd4f7967269b2329efe5731f96b7841345d43..4a25b5cdd1b10f0f1802fc6f845d2b1e70beda51 100644 >--- a/Source/WebCore/html/HTMLMediaElement.h >+++ b/Source/WebCore/html/HTMLMediaElement.h >@@ -412,7 +412,7 @@ public: > void setShouldPlayToPlaybackTarget(bool) override; > #endif > bool isPlayingToWirelessPlaybackTarget() const override { return m_isPlayingToWirelessTarget; }; >- bool webkitCurrentPlaybackTargetIsWireless() const { return m_isPlayingToWirelessTarget; } >+ bool webkitCurrentPlaybackTargetIsWireless() const; > > void setPlayingOnSecondScreen(bool value); > bool isPlayingOnSecondScreen() const override { return m_playingOnSecondScreen; } >@@ -1110,7 +1110,6 @@ private: > > bool m_isScrubbingRemotely : 1; > bool m_waitingToEnterFullscreen : 1; >- bool m_shouldUnpauseInternalOnResume : 1; > > #if ENABLE(VIDEO_TRACK) > bool m_tracksAreReady : 1; >diff --git a/Source/WebCore/html/MediaElementSession.cpp b/Source/WebCore/html/MediaElementSession.cpp >index 0aba2d2e587f3bc35b626fba7c9f39454da1143a..22e2a16f2060e3d5efc70ec8c059be6bfab15522 100644 >--- a/Source/WebCore/html/MediaElementSession.cpp >+++ b/Source/WebCore/html/MediaElementSession.cpp >@@ -262,6 +262,10 @@ SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted() co > } > > auto& document = m_element.document(); >+ auto* page = document.page(); >+ if (!page || page->mediaPlaybackIsSuspended()) >+ return MediaPlaybackDenialReason::PageConsentRequired; >+ > if (document.isMediaDocument() && !document.ownerElement()) > return { }; > >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index 296beff24b89f7d82078ffa603a991053aefa4aa..ddf391279534b90c15778bad2bce849e75851392 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -1716,6 +1716,41 @@ void Page::stopMediaCapture() > #endif > } > >+void Page::stopAllMediaPlayback() >+{ >+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { >+ if (auto* document = frame->document()) >+ document->stopAllMediaPlayback(); >+ } >+} >+ >+void Page::suspendAllMediaPlayback() >+{ >+ ASSERT(!m_mediaPlaybackIsSuspended); >+ if (m_mediaPlaybackIsSuspended) >+ return; >+ >+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { >+ if (auto* document = frame->document()) >+ document->suspendAllMediaPlayback(); >+ } >+ >+ m_mediaPlaybackIsSuspended = true; >+} >+ >+void Page::resumeAllMediaPlayback() >+{ >+ ASSERT(m_mediaPlaybackIsSuspended); >+ if (!m_mediaPlaybackIsSuspended) >+ return; >+ m_mediaPlaybackIsSuspended = false; >+ >+ for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { >+ if (auto* document = frame->document()) >+ document->resumeAllMediaPlayback(); >+ } >+} >+ > #if ENABLE(MEDIA_SESSION) > void Page::handleMediaEvent(MediaEventType eventType) > { >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index b5b7f59f8a1be222547835592fa9cc069a3b36a0..cf92dec2f9dae1485922e9f8b0acbd49b2e72f94 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -600,6 +600,11 @@ public: > WEBCORE_EXPORT void setMuted(MediaProducer::MutedStateFlags); > WEBCORE_EXPORT void stopMediaCapture(); > >+ WEBCORE_EXPORT void stopAllMediaPlayback(); >+ WEBCORE_EXPORT void suspendAllMediaPlayback(); >+ WEBCORE_EXPORT void resumeAllMediaPlayback(); >+ bool mediaPlaybackIsSuspended() { return m_mediaPlaybackIsSuspended; } >+ > #if ENABLE(MEDIA_SESSION) > WEBCORE_EXPORT void handleMediaEvent(MediaEventType); > WEBCORE_EXPORT void setVolumeOfMediaElement(double, uint64_t); >@@ -945,6 +950,7 @@ private: > #endif > > bool m_shouldEnableICECandidateFilteringByDefault { true }; >+ bool m_mediaPlaybackIsSuspended { false }; > }; > > inline PageGroup& Page::group() >diff --git a/Source/WebCore/platform/audio/PlatformMediaSession.h b/Source/WebCore/platform/audio/PlatformMediaSession.h >index 17a30d5ceace5f8a09ee856ab5c13a516ef594a1..25c177990cf2613f25fe0ad00d8812429b6da0f2 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSession.h >+++ b/Source/WebCore/platform/audio/PlatformMediaSession.h >@@ -85,6 +85,7 @@ public: > SuspendedUnderLock, > InvisibleAutoplay, > ProcessInactive, >+ PlaybackSuspended, > }; > InterruptionType interruptionType() const { return m_interruptionType; } > >diff --git a/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp b/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >index 1a305d173bb02314fbd8505798f21e0f8d41d48a..d29d7b2b7d53bbbb00a16a6463e15b6a3a054bed 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >+++ b/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >@@ -419,6 +419,22 @@ void PlatformMediaSessionManager::stopAllMediaPlaybackForProcess() > }); > } > >+void PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument(const Document& document) >+{ >+ forEachSession([&] (PlatformMediaSession& session, size_t) { >+ if (session.client().hostingDocument() == &document) >+ session.beginInterruption(PlatformMediaSession::PlaybackSuspended); >+ }); >+} >+ >+void PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument(const Document& document) >+{ >+ forEachSession([&] (PlatformMediaSession& session, size_t) { >+ if (session.client().hostingDocument() == &document) >+ session.endInterruption(PlatformMediaSession::MayResumePlaying); >+ }); >+} >+ > void PlatformMediaSessionManager::forEachSession(const Function<void(PlatformMediaSession&, size_t)>& predicate) const > { > ++m_iteratingOverSessions; >diff --git a/Source/WebCore/platform/audio/PlatformMediaSessionManager.h b/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >index 4d87fd8f8ae01a35ee8161cf0de54b6ebd78aa9b..e670dafc113131daa4e282c9c40bb209327b4832 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >+++ b/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >@@ -77,6 +77,9 @@ public: > void stopAllMediaPlaybackForDocument(const Document*); > WEBCORE_EXPORT void stopAllMediaPlaybackForProcess(); > >+ void suspendAllMediaPlaybackForDocument(const Document&); >+ void resumeAllMediaPlaybackForDocument(const Document&); >+ > enum SessionRestrictionFlags { > NoRestrictions = 0, > ConcurrentPlaybackNotPermitted = 1 << 0, >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 3c5bebf27b42fb9456fedd0e9ae133e75bda6dc9..800f371a3b60caf7fce562046e02bf6caf9778f7 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -4529,6 +4529,21 @@ - (void)_togglePictureInPicture > #endif > } > >+- (void)_stopAllMediaPlayback >+{ >+ _page->stopAllMediaPlayback(); >+} >+ >+- (void)_suspendAllMediaPlayback >+{ >+ _page->suspendAllMediaPlayback(); >+} >+ >+- (void)_resumeAllMediaPlayback >+{ >+ _page->resumeAllMediaPlayback(); >+} >+ > - (NSURL *)_unreachableURL > { > return [NSURL _web_URLWithWTFString:_page->pageLoadState().unreachableURL()]; >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >index e709409fb4a66834f5cb2fa3967a393af5986050..df7c02fefc0dca8ee203f29a91e0fdfee2677403 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >@@ -403,7 +403,9 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) { > @property (nonatomic, readonly) BOOL _isPictureInPictureActive; > - (void)_updateMediaPlaybackControlsManager; > - (void)_togglePictureInPicture; >- >+- (void)_stopAllMediaPlayback; >+- (void)_suspendAllMediaPlayback; >+- (void)_resumeAllMediaPlayback; > @end > > #if TARGET_OS_IPHONE >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index da7a94a33d81935ca14320734688cc98973a5482..41ad5e81e9d01e230bcd25e762700bd945e2fc29 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -5102,6 +5102,30 @@ void WebPageProxy::stopMediaCapture() > #endif > } > >+void WebPageProxy::stopAllMediaPlayback() >+{ >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::StopAllMediaPlayback(), m_pageID); >+} >+ >+void WebPageProxy::suspendAllMediaPlayback() >+{ >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::SuspendAllMediaPlayback(), m_pageID); >+} >+ >+void WebPageProxy::resumeAllMediaPlayback() >+{ >+ if (!isValid()) >+ return; >+ >+ m_process->send(Messages::WebPage::ResumeAllMediaPlayback(), m_pageID); >+} >+ > #if ENABLE(MEDIA_SESSION) > void WebPageProxy::handleMediaEvent(MediaEventType eventType) > { >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 18bf8101a0edd2b4a0fe98760def4388b3403018..e2fcfb6f5a241825eb3974a16686209eed38ccc3 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1124,6 +1124,10 @@ public: > bool mediaCaptureEnabled() const { return m_mediaCaptureEnabled; } > void stopMediaCapture(); > >+ void stopAllMediaPlayback(); >+ void suspendAllMediaPlayback(); >+ void resumeAllMediaPlayback(); >+ > #if ENABLE(MEDIA_SESSION) > bool hasMediaSessionWithActiveMediaElements() const { return m_hasMediaSessionWithActiveMediaElements; } > void handleMediaEvent(WebCore::MediaEventType); >diff --git a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm >index c505b26e31a3b49f0aefabdbaa7c59c511f3e103..351b61f8246830188e6b82002788e8434d5c1cee 100644 >--- a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm >+++ b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm >@@ -556,13 +556,17 @@ - (void)_showPhishingAlert > NSString *alertMessage = [NSString stringWithFormat:WEB_UI_STRING("Typing is not allowed in full screen websites. â%@â may be showing a fake keyboard to trick you into disclosing personal or financial information.", "Full Screen Deceptive Website Warning Sheet Content Text"), (NSString *)self.location]; > UIAlertController* alert = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert]; > >- if (auto* page = [self._webView _page]) >+ if (auto* page = [self._webView _page]) { >+ page->suspendAllMediaPlayback(); > page->suspendActiveDOMObjectsAndAnimations(); >+ } > > UIAlertAction* exitAction = [UIAlertAction actionWithTitle:WEB_UI_STRING_KEY("Exit Full Screen", "Exit Full Screen (Element Full Screen)", "Full Screen Deceptive Website Exit Action") style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { > [self _cancelAction:action]; >- if (auto* page = [self._webView _page]) >+ if (auto* page = [self._webView _page]) { > page->resumeActiveDOMObjectsAndAnimations(); >+ page->resumeAllMediaPlayback(); >+ } > }]; > > UIAlertAction* stayAction = [UIAlertAction actionWithTitle:WEB_UI_STRING_KEY("Stay in Full Screen", "Stay in Full Screen (Element Full Screen)", "Full Screen Deceptive Website Stay Action") style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index a97901d3e207dd4d95e92c19c8d95c9625e02759..2c99f448bc0484564b18bf0f76be37208220e478 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -656,6 +656,21 @@ void WebPage::enableEnumeratingAllNetworkInterfaces() > #endif > #endif > >+void WebPage::stopAllMediaPlayback() >+{ >+ m_page->stopAllMediaPlayback(); >+} >+ >+void WebPage::suspendAllMediaPlayback() >+{ >+ m_page->suspendAllMediaPlayback(); >+} >+ >+void WebPage::resumeAllMediaPlayback() >+{ >+ m_page->resumeAllMediaPlayback(); >+} >+ > void WebPage::reinitializeWebPage(WebPageCreationParameters&& parameters) > { > ASSERT(m_drawingArea); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 0b42a617ccc1098a575eb47cc641f60355e68db6..aa5ab77413cca22af4bc3ebe5430f2cbc5ea6d28 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1385,6 +1385,10 @@ private: > void enableEnumeratingAllNetworkInterfaces(); > #endif > >+ void stopAllMediaPlayback(); >+ void suspendAllMediaPlayback(); >+ void resumeAllMediaPlayback(); >+ > void advanceToNextMisspelling(bool startBeforeSelection); > void changeSpellingToWord(const String& word); > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index e2654d943cf4c4f6b5e497eb792fb8d5d65cbbf4..ac7d7beff92ed52ecc91ab6527245ffd80d996f9 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -356,6 +356,10 @@ messages -> WebPage LegacyReceiver { > DisableEnumeratingAllNetworkInterfaces() > #endif > >+ StopAllMediaPlayback(); >+ SuspendAllMediaPlayback(); >+ ResumeAllMediaPlayback(); >+ > # Notification > DidReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed) > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index ed156bb4cdb45ef25d21c12ec87ccf6315066570..11f021339098278ebc788f050dfe1332fe984666 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,19 @@ >+2018-12-18 Jer Noble <jer.noble@apple.com> >+ >+ [WebKitLegacy] Media playback pauses on scroll >+ https://bugs.webkit.org/show_bug.cgi?id=192829 >+ >+ Reviewed by Eric Carlson. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/StopSuspendResumeAllMedia.mm: Added. >+ (TestWebKitAPI::TEST): >+ * TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm: Added. >+ (-[ScrollingDoesNotPauseMediaDelegate webViewDidFinishLoad:]): >+ (-[ScrollingDoesNotPauseMediaDelegate uiWebView:didCommitLoadForFrame:]): >+ (-[ScrollingDoesNotPauseMediaDelegate handleEvent:]): >+ (TestWebKitAPI::TEST): >+ > 2018-10-31 Jer Noble <jer.noble@apple.com> > > SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index bcdd2cf98974bd25f4689b692a2f7408e357cf0d..4727467543edf8418ceec7fdb74a2152a3b040b0 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -766,6 +766,8 @@ > CDB5DFFF213610FA00D3E189 /* now-playing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDB5DFFE21360ED800D3E189 /* now-playing.html */; }; > CDBFCC451A9FF45300A7B691 /* FullscreenZoomInitialFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDBFCC431A9FF44800A7B691 /* FullscreenZoomInitialFrame.mm */; }; > CDBFCC461A9FF49E00A7B691 /* FullscreenZoomInitialFrame.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */; }; >+ CDC0932B21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC0932A21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm */; }; >+ CDC0932E21C993440030C4B0 /* StopSuspendResumeAllMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC0932D21C993440030C4B0 /* StopSuspendResumeAllMedia.mm */; }; > CDC8E48D1BC5CB4500594FEC /* AudioSessionCategoryIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC8E4851BC5B19400594FEC /* AudioSessionCategoryIOS.mm */; }; > CDC8E4941BC6F10800594FEC /* video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E4891BC5C96200594FEC /* video-with-audio.html */; }; > CDC8E4951BC6F10800594FEC /* video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */; }; >@@ -2052,6 +2054,8 @@ > CDB5DFFE21360ED800D3E189 /* now-playing.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "now-playing.html"; sourceTree = "<group>"; }; > CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenZoomInitialFrame.html; sourceTree = "<group>"; }; > CDBFCC431A9FF44800A7B691 /* FullscreenZoomInitialFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenZoomInitialFrame.mm; sourceTree = "<group>"; }; >+ CDC0932A21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingDoesNotPauseMedia.mm; sourceTree = "<group>"; }; >+ CDC0932D21C993440030C4B0 /* StopSuspendResumeAllMedia.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = StopSuspendResumeAllMedia.mm; sourceTree = "<group>"; }; > CDC2C7141797089D00E627FB /* TimeRanges.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TimeRanges.cpp; sourceTree = "<group>"; }; > CDC8E4851BC5B19400594FEC /* AudioSessionCategoryIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AudioSessionCategoryIOS.mm; sourceTree = "<group>"; }; > CDC8E4891BC5C96200594FEC /* video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "video-with-audio.html"; sourceTree = "<group>"; }; >@@ -2527,6 +2531,7 @@ > 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */, > 2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */, > 2DFF7B6C1DA487AF00814614 /* SnapshotStore.mm */, >+ CDC0932D21C993440030C4B0 /* StopSuspendResumeAllMedia.mm */, > 515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */, > 1C734B5220788C4800F430EA /* SystemColors.mm */, > F4CD74C720FDB49600DE3794 /* TestURLSchemeHandler.h */, >@@ -3535,6 +3540,7 @@ > children = ( > CDC8E49A1BC728FE00594FEC /* Resources */, > CDC8E4851BC5B19400594FEC /* AudioSessionCategoryIOS.mm */, >+ CDC0932A21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm */, > 0F4FFA9D1ED3AA8500F7111F /* SnapshotViaRenderInContext.mm */, > ); > path = ios; >@@ -4132,6 +4138,7 @@ > 5CA985532113CF780057EB6B /* SafeBrowsing.mm in Sources */, > CDCFA7AA1E45183200C2433D /* SampleMap.cpp in Sources */, > CE0947372063223B003C9BA0 /* SchemeRegistry.mm in Sources */, >+ CDC0932B21C872C10030C4B0 /* ScrollingDoesNotPauseMedia.mm in Sources */, > 7CCE7F121A411AE600447C4C /* ScrollPinningBehaviors.cpp in Sources */, > F4C8797F2059D8D3009CD00B /* ScrollViewInsetTests.mm in Sources */, > CE06DF9B1E1851F200E570C9 /* SecurityOrigin.cpp in Sources */, >@@ -4156,6 +4163,7 @@ > 7CCE7EF21A411AE600447C4C /* StopLoadingDuringDidFailProvisionalLoad.cpp in Sources */, > 7CCE7ECE1A411A7E00447C4C /* StopLoadingFromDidFinishLoading.mm in Sources */, > 7CCE7ECF1A411A7E00447C4C /* StopLoadingFromDidReceiveResponse.mm in Sources */, >+ CDC0932E21C993440030C4B0 /* StopSuspendResumeAllMedia.mm in Sources */, > 515BE1711D428E4B00DD7C68 /* StoreBlobThenDelete.mm in Sources */, > 7CCE7ED01A411A7E00447C4C /* StringByEvaluatingJavaScriptFromString.mm in Sources */, > 7CCE7ED11A411A7E00447C4C /* StringTruncator.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/StopSuspendResumeAllMedia.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/StopSuspendResumeAllMedia.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..0d99ab69882cbab57ae5efb5c01f843ac214712a >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/StopSuspendResumeAllMedia.mm >@@ -0,0 +1,88 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#if WK_API_ENABLED && PLATFORM(MAC) >+ >+#import "PlatformUtilities.h" >+#import "TestWKWebView.h" >+#import <WebKit/WKWebViewPrivate.h> >+#import <wtf/RetainPtr.h> >+ >+namespace TestWebKitAPI { >+ >+TEST(WKWebView, StopAllMediaPlayback) >+{ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:configuration.get() addToWindow:YES]); >+ >+ [webView synchronouslyLoadHTMLString:@"<video src=\"video-with-audio.mp4\" webkit-playsinline></video>"]; >+ >+ [webView objectByEvaluatingJavaScript:@"function eventToMessage(event){window.webkit.messageHandlers.testHandler.postMessage(event.type);} var video = document.querySelector('video'); video.addEventListener('playing', eventToMessage); video.addEventListener('pause', eventToMessage);"]; >+ >+ __block bool didBeginPlaying = false; >+ [webView performAfterReceivingMessage:@"playing" action:^{ didBeginPlaying = true; }]; >+ [webView evaluateJavaScript:@"document.querySelector('video').play()" completionHandler:nil]; >+ TestWebKitAPI::Util::run(&didBeginPlaying); >+ >+ __block bool didPause = false; >+ [webView performAfterReceivingMessage:@"pause" action:^{ didPause = true; }]; >+ [webView _stopAllMediaPlayback]; >+ TestWebKitAPI::Util::run(&didPause); >+} >+ >+TEST(WKWebView, SuspendResumeAllMediaPlayback) >+{ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:configuration.get() addToWindow:YES]); >+ >+ [webView synchronouslyLoadHTMLString:@"<video src=\"video-with-audio.mp4\" webkit-playsinline></video>"]; >+ >+ [webView objectByEvaluatingJavaScript:@"function eventToMessage(event){window.webkit.messageHandlers.testHandler.postMessage(event.type);} var video = document.querySelector('video'); video.addEventListener('playing', eventToMessage); video.addEventListener('pause', eventToMessage);"]; >+ >+ __block bool didBeginPlaying = false; >+ [webView performAfterReceivingMessage:@"playing" action:^{ didBeginPlaying = true; }]; >+ [webView evaluateJavaScript:@"document.querySelector('video').play()" completionHandler:nil]; >+ TestWebKitAPI::Util::run(&didBeginPlaying); >+ >+ __block bool didPause = false; >+ [webView performAfterReceivingMessage:@"pause" action:^{ didPause = true; }]; >+ [webView _suspendAllMediaPlayback]; >+ TestWebKitAPI::Util::run(&didPause); >+ >+ __block bool didReject = false; >+ [webView performAfterReceivingMessage:@"rejected" action:^{ didReject = true; }]; >+ [webView evaluateJavaScript:@"document.querySelector('video').play().catch(() = { window.webkit.messageHandlers.testHandler.postMessage('rejected'); })" completionHandler:nil]; >+ >+ didBeginPlaying = false; >+ [webView performAfterReceivingMessage:@"playing" action:^{ didBeginPlaying = true; }]; >+ [webView _resumeAllMediaPlayback]; >+ TestWebKitAPI::Util::run(&didBeginPlaying); >+} >+ >+} // namespace TestWebKitAPI >+ >+#endif >diff --git a/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm b/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..dc0e09044ce10845e8dc477fa4aa4b99c53c2c9c >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm >@@ -0,0 +1,114 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#if PLATFORM(IOS_FAMILY) >+ >+#import "PlatformUtilities.h" >+#import <WebKit/DOMHTMLMediaElement.h> >+#import <WebKit/WebFramePrivate.h> >+#import <wtf/RetainPtr.h> >+ >+@interface ScrollingDoesNotPauseMediaDelegate : NSObject <UIWebViewDelegate, DOMEventListener> { >+} >+@end >+ >+static bool didFinishLoad; >+static bool gotMainFrame; >+static WebFrame* mainFrame; >+ >+@implementation ScrollingDoesNotPauseMediaDelegate >+ >+IGNORE_WARNINGS_BEGIN("deprecated-implementations") >+- (void)webViewDidFinishLoad:(UIWebView *)webView >+IGNORE_WARNINGS_END >+{ >+ didFinishLoad = true; >+} >+ >+- (void)uiWebView:(UIWebView *)sender didCommitLoadForFrame:(WebFrame *)frame >+{ >+ mainFrame = frame; >+ gotMainFrame = true; >+} >+ >+static bool didReceivePause; >+static bool didReceivePlaying; >+ >+- (void)handleEvent:(DOMEvent *)event >+{ >+ if ([event.type isEqualToString:@"pause"]) >+ didReceivePause = true; >+ else if ([event.type isEqualToString:@"playing"]) >+ didReceivePlaying = true; >+} >+@end >+ >+namespace TestWebKitAPI { >+ >+TEST(WebKitLegacy, ScrollingDoesNotPauseMedia) >+{ >+ RetainPtr<UIWindow> uiWindow = adoptNS([[UIWindow alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); >+ RetainPtr<UIWebView> uiWebView = adoptNS([[UIWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); >+ [uiWindow addSubview:uiWebView.get()]; >+ >+ uiWebView.get().mediaPlaybackRequiresUserAction = NO; >+ uiWebView.get().allowsInlineMediaPlayback = YES; >+ >+ RetainPtr<ScrollingDoesNotPauseMediaDelegate> testController = adoptNS([ScrollingDoesNotPauseMediaDelegate new]); >+ uiWebView.get().delegate = testController.get(); >+ >+ didFinishLoad = false; >+ gotMainFrame = false; >+ mainFrame = nil; >+ >+ [uiWebView loadRequest:[NSURLRequest requestWithURL:[NSBundle.mainBundle URLForResource:@"video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; >+ >+ Util::run(&didFinishLoad); >+ Util::run(&gotMainFrame); >+ >+ DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"]; >+ ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]); >+ >+ [video addEventListener:@"playing" listener:testController.get() useCapture:NO]; >+ [video addEventListener:@"pause" listener:testController.get() useCapture:NO]; >+ >+ [mainFrame setTimeoutsPaused:YES]; >+ >+ didReceivePlaying = false; >+ [video play]; >+ Util::run(&didReceivePlaying); >+ >+ [mainFrame setTimeoutsPaused:NO]; >+ >+ didReceivePause = false; >+ [video play]; >+ Util::run(&didReceivePause); >+} >+ >+} // namespace TestWebKitAPI >+ >+#endif
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192829
:
357610
|
357615
| 358337