Title: [205863] trunk
Revision
205863
Author
[email protected]
Date
2016-09-13 10:43:05 -0700 (Tue, 13 Sep 2016)

Log Message

Media-source backed elements block load event; cause web-platform-test flakiness
https://bugs.webkit.org/show_bug.cgi?id=161881

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-delaying-load-event.html

The MSE specification has added an explicit step to their "attaching to media element"
algorithm which tells the media element to stop delaying the load event. And indeed,
the HTMLMediaElement blocks the load event when a MediaSource is attached but its data
is never loaded.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setPrivateAndOpen):
* html/HTMLMediaElement.h:

LayoutTests:

* media/media-source/media-source-delaying-load-event-expected.txt: Added.
* media/media-source/media-source-delaying-load-event.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205862 => 205863)


--- trunk/LayoutTests/ChangeLog	2016-09-13 17:33:20 UTC (rev 205862)
+++ trunk/LayoutTests/ChangeLog	2016-09-13 17:43:05 UTC (rev 205863)
@@ -1,3 +1,13 @@
+2016-09-12  Jer Noble  <[email protected]>
+
+        Media-source backed elements block load event; cause web-platform-test flakiness
+        https://bugs.webkit.org/show_bug.cgi?id=161881
+
+        Reviewed by Eric Carlson.
+
+        * media/media-source/media-source-delaying-load-event-expected.txt: Added.
+        * media/media-source/media-source-delaying-load-event.html: Added.
+
 2016-09-13  Jer Noble  <[email protected]>
 
         Unreviewed gardening; removed duplicate entry for mediasource-config-change-mp4-v-bitrate.html.

Added: trunk/LayoutTests/media/media-source/media-source-delaying-load-event-expected.txt (0 => 205863)


--- trunk/LayoutTests/media/media-source/media-source-delaying-load-event-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-delaying-load-event-expected.txt	2016-09-13 17:43:05 UTC (rev 205863)
@@ -0,0 +1,7 @@
+A media element backed by a Media Source should not delay the window's load event
+
+EXPECTED (source.readyState == 'closed') OK
+RUN(video.src = ""
+EVENT(load)
+END OF TEST
+

Added: trunk/LayoutTests/media/media-source/media-source-delaying-load-event.html (0 => 205863)


--- trunk/LayoutTests/media/media-source/media-source-delaying-load-event.html	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-delaying-load-event.html	2016-09-13 17:43:05 UTC (rev 205863)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>media-source-delaying-load-event</title>
+    <script src=""
+    <script>
+    var source;
+    </script>
+</head>
+<body>
+    <div>A media element backed by a Media Source should not delay the window's load event</div>
+    <video></video>
+    <script>
+        findMediaElement();
+
+        source = new MediaSource();
+        testExpected('source.readyState', 'closed');
+
+        run('video.src = ""
+        waitForEventOn(window, 'load', endTest);
+        failTestIn(100);
+    </script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (205862 => 205863)


--- trunk/Source/WebCore/ChangeLog	2016-09-13 17:33:20 UTC (rev 205862)
+++ trunk/Source/WebCore/ChangeLog	2016-09-13 17:43:05 UTC (rev 205863)
@@ -1,3 +1,21 @@
+2016-09-12  Jer Noble  <[email protected]>
+
+        Media-source backed elements block load event; cause web-platform-test flakiness
+        https://bugs.webkit.org/show_bug.cgi?id=161881
+
+        Reviewed by Eric Carlson.
+
+        Test: media/media-source/media-source-delaying-load-event.html
+
+        The MSE specification has added an explicit step to their "attaching to media element"
+        algorithm which tells the media element to stop delaying the load event. And indeed,
+        the HTMLMediaElement blocks the load event when a MediaSource is attached but its data
+        is never loaded.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::setPrivateAndOpen):
+        * html/HTMLMediaElement.h:
+
 2016-09-12  Zalan Bujtas  <[email protected]>
 
         Input type object and the associated render can go out of sync.

Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (205862 => 205863)


--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp	2016-09-13 17:33:20 UTC (rev 205862)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp	2016-09-13 17:43:05 UTC (rev 205863)
@@ -117,7 +117,29 @@
     ASSERT(!m_private);
     ASSERT(m_mediaElement);
     m_private = WTFMove(mediaSourcePrivate);
+
+    // 2.4.1 Attaching to a media element
+    // https://rawgit.com/w3c/media-source/45627646344eea0170dd1cbc5a3d508ca751abb8/media-source-respec.html#mediasource-attach
+
+    // ↳ If readyState is NOT set to "closed"
+    //    Run the "If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying
+    //    to fetch the resource" steps of the resource fetch algorithm's media data processing steps list.
+    if (!isClosed()) {
+        m_mediaElement->mediaLoadingFailedFatally(MediaPlayer::NetworkError);
+        return;
+    }
+
+    // ↳ Otherwise
+    // 1. Set the media element's delaying-the-load-event-flag to false.
+    m_mediaElement->setShouldDelayLoadEvent(false);
+
+    // 2. Set the readyState attribute to "open".
+    // 3. Queue a task to fire a simple event named sourceopen at the MediaSource.
     setReadyState(openKeyword());
+
+    // 4. Continue the resource fetch algorithm by running the remaining "Otherwise (mode is local)" steps,
+    // with these clarifications:
+    // NOTE: This is handled in HTMLMediaElement.
 }
 
 void MediaSource::addedToRegistry()

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (205862 => 205863)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2016-09-13 17:33:20 UTC (rev 205862)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2016-09-13 17:43:05 UTC (rev 205863)
@@ -471,6 +471,7 @@
     void resetPlaybackSessionState();
     bool isVisibleInViewport() const;
     bool hasEverNotifiedAboutPlaying() const;
+    void setShouldDelayLoadEvent(bool);
 
 protected:
     HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser);
@@ -719,7 +720,6 @@
 
     void mediaCanStart() override;
 
-    void setShouldDelayLoadEvent(bool);
     void invalidateCachedTime() const;
     void refreshCachedTime() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to