Unreviewed, rolling out r227279 and r227373.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jan 2018 17:52:53 +0000 (17:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jan 2018 17:52:53 +0000 (17:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181988

The LayoutTest crash fix introduced an API test failure.
(Requested by ryanhaddad on #webkit).

Reverted changesets:

"Resign NowPlaying status when no media element is eligible"
https://bugs.webkit.org/show_bug.cgi?id=181914
https://trac.webkit.org/changeset/227279

"Resign NowPlaying status when no media element is eligible"
https://bugs.webkit.org/show_bug.cgi?id=181914
https://trac.webkit.org/changeset/227373

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227422 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlayingControlsTests.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/large-video-test-now-playing.html

index a4f1a0b..cf5b24c 100644 (file)
@@ -1,3 +1,21 @@
+2018-01-23  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r227279 and r227373.
+        https://bugs.webkit.org/show_bug.cgi?id=181988
+
+        The LayoutTest crash fix introduced an API test failure.
+        (Requested by ryanhaddad on #webkit).
+
+        Reverted changesets:
+
+        "Resign NowPlaying status when no media element is eligible"
+        https://bugs.webkit.org/show_bug.cgi?id=181914
+        https://trac.webkit.org/changeset/227279
+
+        "Resign NowPlaying status when no media element is eligible"
+        https://bugs.webkit.org/show_bug.cgi?id=181914
+        https://trac.webkit.org/changeset/227373
+
 2018-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, fix some format specifiers added in r227190
index 2406749..98ce1e3 100644 (file)
@@ -971,9 +971,6 @@ void HTMLMediaElement::removedFromAncestor(RemovalType removalType, ContainerNod
         m_pauseAfterDetachedTaskQueue.enqueueTask(std::bind(&HTMLMediaElement::pauseAfterDetachedTask, this));
     }
 
-    if (m_mediaSession)
-        m_mediaSession->clientCharacteristicsChanged();
-
     HTMLElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
 }
 
index 113e98c..ebdfc4f 100644 (file)
@@ -551,8 +551,6 @@ public:
 
     bool willLog(WTFLogLevel) const;
 
-    bool isSuspended() const final;
-
 protected:
     HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser);
     virtual void finishInitialization();
@@ -866,6 +864,7 @@ private:
     bool shouldOverrideBackgroundLoadingRestriction() const override;
     bool canProduceAudio() const final;
     bool processingUserGestureForMedia() const final;
+    bool isSuspended() const final;
 
     void pageMutedStateDidChange() override;
 
index 6c478ae..2d5bb51 100644 (file)
@@ -162,9 +162,6 @@ static bool needsArbitraryUserGestureAutoplayQuirk(const Document& document)
 
 SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted(const HTMLMediaElement& element) const
 {
-    if (m_element.isSuspended())
-        return { };
-
     if (element.document().isMediaDocument() && !element.document().ownerElement())
         return { };
 
@@ -298,11 +295,6 @@ bool MediaElementSession::pageAllowsPlaybackAfterResuming(const HTMLMediaElement
 
 bool MediaElementSession::canShowControlsManager(PlaybackControlsPurpose purpose) const
 {
-    if (m_element.isSuspended()) {
-        LOG(Media, "MediaElementSession::canShowControlsManager - returning FALSE: isSuspended()");
-        return false;
-    }
-
     if (m_element.isFullscreen()) {
         LOG(Media, "MediaElementSession::canShowControlsManager - returning TRUE: Is fullscreen");
         return true;
@@ -343,6 +335,11 @@ bool MediaElementSession::canShowControlsManager(PlaybackControlsPurpose purpose
         return false;
     }
 
+    if (m_element.document().activeDOMObjectsAreSuspended()) {
+        LOG(Media, "MediaElementSession::canShowControlsManager - returning FALSE: activeDOMObjectsAreSuspended()");
+        return false;
+    }
+
     if (!playbackPermitted(m_element)) {
         LOG(Media, "MediaElementSession::canShowControlsManager - returning FALSE: Playback not permitted");
         return false;
@@ -694,8 +691,7 @@ size_t MediaElementSession::maximumMediaSourceBufferSize(const SourceBuffer& buf
 
 static bool isMainContentForPurposesOfAutoplay(const HTMLMediaElement& element)
 {
-    Document& document = element.document();
-    if (!document.isSafeToUpdateStyleOrLayout() || !element.hasAudio() || !element.hasVideo())
+    if (!element.hasAudio() || !element.hasVideo())
         return false;
 
     // Elements which have not yet been laid out, or which are not yet in the DOM, cannot be main content.
@@ -715,6 +711,7 @@ static bool isMainContentForPurposesOfAutoplay(const HTMLMediaElement& element)
         return false;
 
     // Main content elements must be in the main frame.
+    Document& document = element.document();
     if (!document.frame() || !document.frame()->isMainFrame())
         return false;
 
@@ -821,9 +818,6 @@ void MediaElementSession::mainContentCheckTimerFired()
 
 bool MediaElementSession::updateIsMainContent() const
 {
-    if (m_element.isSuspended())
-        return false;
-
     bool wasMainContent = m_isMainContent;
     m_isMainContent = isMainContentForPurposesOfAutoplay(m_element);
 
index 1430355..1f17ccc 100644 (file)
 
 namespace WebCore {
 
+#if !PLATFORM(MAC)
+void PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary()
+{
+}
+#endif
+
 #if ENABLE(VIDEO) || ENABLE(WEB_AUDIO)
 
 #if !PLATFORM(COCOA)
@@ -51,12 +57,6 @@ PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists(
 }
 #endif // !PLATFORM(COCOA)
 
-void PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary()
-{
-    if (auto existingManager = PlatformMediaSessionManager::sharedManagerIfExists())
-        existingManager->scheduleUpdateNowPlayingInfo();
-}
-
 PlatformMediaSessionManager::PlatformMediaSessionManager()
     : m_systemSleepListener(PAL::SystemSleepListener::create(*this))
 {
index 67c1610..f518207 100644 (file)
@@ -61,7 +61,6 @@ public:
     WEBCORE_EXPORT virtual double lastUpdatedNowPlayingDuration() const { return NAN; }
     WEBCORE_EXPORT virtual double lastUpdatedNowPlayingElapsedTime() const { return NAN; }
     WEBCORE_EXPORT virtual uint64_t lastUpdatedNowPlayingInfoUniqueIdentifier() const { return 0; }
-    WEBCORE_EXPORT virtual bool registeredAsNowPlayingApplication() const { return false; }
 
     bool willIgnoreSystemInterruptions() const { return m_willIgnoreSystemInterruptions; }
     void setWillIgnoreSystemInterruptions(bool ignore) { m_willIgnoreSystemInterruptions = ignore; }
index 7728418..5da2de9 100644 (file)
@@ -73,7 +73,6 @@ private:
     double lastUpdatedNowPlayingDuration() const final { return m_reportedDuration; }
     double lastUpdatedNowPlayingElapsedTime() const final { return m_reportedCurrentTime; }
     uint64_t lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; }
-    bool registeredAsNowPlayingApplication() const final { return m_nowPlayingActive; }
 
     PlatformMediaSession* nowPlayingEligibleSession();
     
index 499f05b..f2bd573 100644 (file)
@@ -41,7 +41,6 @@ public:
     double lastUpdatedNowPlayingDuration() const final { return m_lastUpdatedNowPlayingDuration; }
     double lastUpdatedNowPlayingElapsedTime() const final { return m_lastUpdatedNowPlayingElapsedTime; }
     uint64_t lastUpdatedNowPlayingInfoUniqueIdentifier() const final { return m_lastUpdatedNowPlayingInfoUniqueIdentifier; }
-    bool registeredAsNowPlayingApplication() const final { return m_registeredAsNowPlayingApplication; }
 
 private:
     friend class PlatformMediaSessionManager;
@@ -62,7 +61,6 @@ private:
 
     bool m_nowPlayingActive { false };
     bool m_isInBackground { false };
-    bool m_registeredAsNowPlayingApplication { false };
 
     // For testing purposes only.
     String m_lastUpdatedNowPlayingTitle;
index e516053..2e45029 100644 (file)
@@ -54,6 +54,12 @@ PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists(
     return platformMediaSessionManager;
 }
 
+void PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary()
+{
+    if (auto existingManager = (MediaSessionManagerMac *)PlatformMediaSessionManager::sharedManagerIfExists())
+        existingManager->scheduleUpdateNowPlayingInfo();
+}
+
 MediaSessionManagerMac::MediaSessionManagerMac()
     : PlatformMediaSessionManager()
 {
@@ -130,10 +136,6 @@ void MediaSessionManagerMac::updateNowPlayingInfo()
             MRMediaRemoteSetNowPlayingVisibility(MRMediaRemoteGetLocalOrigin(), MRNowPlayingClientVisibilityNeverVisible);
 
         LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - clearing now playing info");
-
-        MRMediaRemoteSetCanBeNowPlayingApplication(false);
-        m_registeredAsNowPlayingApplication = false;
-
         MRMediaRemoteSetNowPlayingInfo(nullptr);
         m_nowPlayingActive = false;
         m_lastUpdatedNowPlayingTitle = emptyString();
@@ -152,10 +154,10 @@ void MediaSessionManagerMac::updateNowPlayingInfo()
         return;
     }
 
-    if (!m_registeredAsNowPlayingApplication) {
-        m_registeredAsNowPlayingApplication = true;
+    static dispatch_once_t enableNowPlayingToken;
+    dispatch_once(&enableNowPlayingToken, ^() {
         MRMediaRemoteSetCanBeNowPlayingApplication(true);
-    }
+    });
 
     String title = currentSession->title();
     double duration = currentSession->supportsSeeking() ? currentSession->duration() : MediaPlayer::invalidTime();
index 23b550b..0f16d35 100644 (file)
@@ -1,3 +1,21 @@
+2018-01-23  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r227279 and r227373.
+        https://bugs.webkit.org/show_bug.cgi?id=181988
+
+        The LayoutTest crash fix introduced an API test failure.
+        (Requested by ryanhaddad on #webkit).
+
+        Reverted changesets:
+
+        "Resign NowPlaying status when no media element is eligible"
+        https://bugs.webkit.org/show_bug.cgi?id=181914
+        https://trac.webkit.org/changeset/227279
+
+        "Resign NowPlaying status when no media element is eligible"
+        https://bugs.webkit.org/show_bug.cgi?id=181914
+        https://trac.webkit.org/changeset/227373
+
 2018-01-23  Youenn Fablet  <youenn@apple.com>
 
         REGRESSION (r227348): ASSERT_NOT_REACHED in WebKit::ServiceWorkerClientFetch::didFinish()
index 20d3c1d..dd275a7 100644 (file)
@@ -6074,16 +6074,16 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
 
 #endif // PLATFORM(MAC)
 
-- (void)_requestActiveNowPlayingSessionInfo:(void(^)(BOOL, BOOL, NSString*, double, double, NSInteger))callback
+- (void)_requestActiveNowPlayingSessionInfo:(void(^)(BOOL, NSString*, double, double, NSInteger))callback
 {
     if (!_page) {
-        callback(NO, NO, @"", std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), 0);
+        callback(NO, @"", std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), 0);
         return;
     }
 
     auto handler = makeBlockPtr(callback);
-    auto localCallback = WebKit::NowPlayingInfoCallback::create([handler](bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier, WebKit::CallbackBase::Error) {
-        handler(active, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier);
+    auto localCallback = WebKit::NowPlayingInfoCallback::create([handler](bool active, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier, WebKit::CallbackBase::Error) {
+        handler(active, title, duration, elapsedTime, uniqueIdentifier);
     });
 
     _page->requestActiveNowPlayingSessionInfo(WTFMove(localCallback));
index 7af8b5a..0f33817 100644 (file)
@@ -442,7 +442,7 @@ typedef NS_OPTIONS(NSInteger, _WKRectEdge) {
 - (void)_setFooterBannerHeight:(int)height WK_API_AVAILABLE(macosx(10.12.3));
 #endif
 
-- (void)_requestActiveNowPlayingSessionInfo:(void(^)(BOOL, BOOL, NSString*, double, double, NSInteger))callback WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_requestActiveNowPlayingSessionInfo:(void(^)(BOOL, NSString*, double, double, NSInteger))callback WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 - (void)_setPageScale:(CGFloat)scale withOrigin:(CGPoint)origin WK_API_AVAILABLE(ios(10.3));
 - (CGFloat)_pageScale WK_API_AVAILABLE(ios(10.3));
index ef57e10..86806af 100644 (file)
@@ -6813,7 +6813,7 @@ void WebPageProxy::requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback
     m_process->send(Messages::WebPage::RequestActiveNowPlayingSessionInfo(callbackID), m_pageID);
 }
 
-void WebPageProxy::nowPlayingInfoCallback(bool hasActiveSession, bool registeredAsNowPlayingApplication, const String& title, double duration, double elapsedTime, uint64_t uniqueIdentifier, CallbackID callbackID)
+void WebPageProxy::nowPlayingInfoCallback(bool hasActiveSession, const String& title, double duration, double elapsedTime, uint64_t uniqueIdentifier, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<NowPlayingInfoCallback>(callbackID);
     if (!callback) {
@@ -6821,7 +6821,7 @@ void WebPageProxy::nowPlayingInfoCallback(bool hasActiveSession, bool registered
         return;
     }
 
-    callback->performCallbackWithReturnValue(hasActiveSession, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier);
+    callback->performCallbackWithReturnValue(hasActiveSession, title, duration, elapsedTime, uniqueIdentifier);
 }
 #endif
 
index 9a124e6..3ab7e96 100644 (file)
@@ -297,7 +297,7 @@ using DrawToPDFCallback = GenericCallback<const IPC::DataReference&>;
 
 #if PLATFORM(COCOA)
 typedef GenericCallback<const WebCore::MachSendRight&> MachSendRightCallback;
-typedef GenericCallback<bool, bool, String, double, double, uint64_t> NowPlayingInfoCallback;
+typedef GenericCallback<bool, String, double, double, uint64_t> NowPlayingInfoCallback;
 #endif
 
 class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
@@ -1126,7 +1126,7 @@ public:
 
 #if PLATFORM(COCOA)
     void requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&&);
-    void nowPlayingInfoCallback(bool, bool, const String&, double, double, uint64_t, CallbackID);
+    void nowPlayingInfoCallback(bool, const String&, double, double, uint64_t, CallbackID);
 #endif
 
 #if ENABLE(MEDIA_SESSION)
index f60ec93..51feb9e 100644 (file)
@@ -204,7 +204,7 @@ messages -> WebPageProxy {
 #endif
 #if PLATFORM(COCOA)
     MachSendRightCallback(WebCore::MachSendRight sendRight, WebKit::CallbackID callbackID)
-    NowPlayingInfoCallback(bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier, WebKit::CallbackID callbackID)
+    NowPlayingInfoCallback(bool active, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier, WebKit::CallbackID callbackID)
 #endif
 
     PageScaleFactorDidChange(double scaleFactor)
index b49d357..65cfcab 100644 (file)
@@ -48,17 +48,15 @@ void WebPage::requestActiveNowPlayingSessionInfo(CallbackID callbackID)
     double duration = NAN;
     double elapsedTime = NAN;
     uint64_t uniqueIdentifier = 0;
-    bool registeredAsNowPlayingApplication = false;
     if (auto* sharedManager = WebCore::PlatformMediaSessionManager::sharedManagerIfExists()) {
         hasActiveSession = sharedManager->hasActiveNowPlayingSession();
         title = sharedManager->lastUpdatedNowPlayingTitle();
         duration = sharedManager->lastUpdatedNowPlayingDuration();
         elapsedTime = sharedManager->lastUpdatedNowPlayingElapsedTime();
         uniqueIdentifier = sharedManager->lastUpdatedNowPlayingInfoUniqueIdentifier();
-        registeredAsNowPlayingApplication = sharedManager->registeredAsNowPlayingApplication();
     }
 
-    send(Messages::WebPageProxy::NowPlayingInfoCallback(hasActiveSession, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier, callbackID));
+    send(Messages::WebPageProxy::NowPlayingInfoCallback(hasActiveSession, title, duration, elapsedTime, uniqueIdentifier, callbackID));
 }
 
 } // namespace WebKit
index a4769b7..1c73f97 100644 (file)
@@ -1,3 +1,21 @@
+2018-01-23  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r227279 and r227373.
+        https://bugs.webkit.org/show_bug.cgi?id=181988
+
+        The LayoutTest crash fix introduced an API test failure.
+        (Requested by ryanhaddad on #webkit).
+
+        Reverted changesets:
+
+        "Resign NowPlaying status when no media element is eligible"
+        https://bugs.webkit.org/show_bug.cgi?id=181914
+        https://trac.webkit.org/changeset/227279
+
+        "Resign NowPlaying status when no media element is eligible"
+        https://bugs.webkit.org/show_bug.cgi?id=181914
+        https://trac.webkit.org/changeset/227373
+
 2018-01-22  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Add test case for slow in test_expectations.py.
index c6fd876..ed1f668 100644 (file)
@@ -35,7 +35,6 @@
 
 @interface NowPlayingTestWebView : TestWKWebView
 @property (nonatomic, readonly) BOOL hasActiveNowPlayingSession;
-@property (nonatomic, readonly) BOOL registeredAsNowPlayingApplication;
 @property (readonly) NSString *lastUpdatedTitle;
 @property (readonly) double lastUpdatedDuration;
 @property (readonly) double lastUpdatedElapsedTime;
 @implementation NowPlayingTestWebView {
     bool _receivedNowPlayingInfoResponse;
     BOOL _hasActiveNowPlayingSession;
-    BOOL _registeredAsNowPlayingApplication;
 }
 - (BOOL)hasActiveNowPlayingSession
 {
     _receivedNowPlayingInfoResponse = false;
 
-    auto completionHandler = [retainedSelf = retainPtr(self), self](BOOL active, BOOL registeredAsNowPlayingApplication, NSString *title, double duration, double elapsedTime, NSInteger uniqueIdentifier) {
+    auto completionHandler = [retainedSelf = retainPtr(self), self](BOOL active, NSString *title, double duration, double elapsedTime, NSInteger uniqueIdentifier) {
         _hasActiveNowPlayingSession = active;
-        _registeredAsNowPlayingApplication = registeredAsNowPlayingApplication;
         _lastUpdatedTitle = [title copy];
         _lastUpdatedDuration = duration;
         _lastUpdatedElapsedTime = elapsedTime;
@@ -188,31 +185,6 @@ TEST(NowPlayingControlsTests, NowPlayingControlsClearInfoAfterSessionIsNoLongerV
     ASSERT_TRUE(isnan(webView.get().lastUpdatedElapsedTime));
     ASSERT_TRUE(!webView.get().lastUniqueIdentifier);
 }
-
-TEST(NowPlayingControlsTests, NowPlayingControlsCheckRegistered)
-{
-    WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
-    configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
-    auto webView = adoptNS([[NowPlayingTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration]);
-    [webView loadTestPageNamed:@"large-video-test-now-playing"];
-    [webView waitForMessage:@"playing"];
-    [webView setWindowVisible:NO];
-    [webView.get().window resignKeyWindow];
-
-    [webView expectHasActiveNowPlayingSession:YES];
-    ASSERT_TRUE(webView.get().registeredAsNowPlayingApplication);
-
-    [webView stringByEvaluatingJavaScript:@"pause()"];
-    [webView waitForMessage:@"paused"];
-    [webView expectHasActiveNowPlayingSession:YES];
-    ASSERT_TRUE(webView.get().registeredAsNowPlayingApplication);
-
-    auto result = [webView stringByEvaluatingJavaScript:@"removeVideoElement()"];
-    ASSERT_STREQ("<null>", result.UTF8String);
-    [webView expectHasActiveNowPlayingSession:NO];
-    ASSERT_FALSE(webView.get().registeredAsNowPlayingApplication);
-}
-
 #endif // PLATFORM(MAC)
 
 #if PLATFORM(IOS)
index d6cf2da..657dbd7 100644 (file)
@@ -8,12 +8,6 @@
             position: absolute;
         }
 
-        button {
-            top: 320px;
-            left: 20px;
-            position: absolute;
-        }
-
         body {
             margin: 0;
         }
         function mousedown() {
             document.querySelector("video").muted = true;
         }
-
-        function removeVideoElement() {
-            document.body.removeChild(document.querySelector("video"));
-            return document.querySelector("video");
-        }
-
-        function pause() {
-            document.querySelector("video").pause();
-        }
-
-        function stopped() {
-            setTimeout(function() {
-               try {
-                    window.webkit.messageHandlers.testHandler.postMessage("paused");
-               } catch(e) {
-                   console.debug(`error: ${e}`);
-               }
-           }, 0);
-        }
-
     </script>
 </head>
 <body>
-    <video autoplay title="foo" onmousedown=mousedown() onplaying=playing() onpause=stopped()><source src="large-video-with-audio.mp4"></video>
-    <button onclick="console.log(removeVideoElement())">Stop!</button>
+    <video autoplay title="foo" onmousedown=mousedown() onplaying=playing()><source src="large-video-with-audio.mp4"></video>
 </body>
 <html>