Title: [221033] trunk
Revision
221033
Author
bfulg...@apple.com
Date
2017-08-22 12:54:09 -0700 (Tue, 22 Aug 2017)

Log Message

Ensure media controls host exists before using it
https://bugs.webkit.org/show_bug.cgi?id=175833
<rdar://problem/34001219>

Reviewed by Jer Noble.

Source/WebCore:

Although we ensure that the media controls shadow root exists before updating the text track
container, we don't check that the media controls host has been created yet. We do check
and create in other places in HTMLMediaElement.

Tests: media/track/track-display-before-controls-crash.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateTextTrackDisplay): 

LayoutTests:

* media/track/track-display-before-controls-crash-expected.txt: Added.
* media/track/track-display-before-controls-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (221032 => 221033)


--- trunk/LayoutTests/ChangeLog	2017-08-22 19:22:48 UTC (rev 221032)
+++ trunk/LayoutTests/ChangeLog	2017-08-22 19:54:09 UTC (rev 221033)
@@ -1,3 +1,14 @@
+2017-08-22  Brent Fulgham  <bfulg...@apple.com>
+
+        Ensure media controls host exists before using it
+        https://bugs.webkit.org/show_bug.cgi?id=175833
+        <rdar://problem/34001219>
+
+        Reviewed by Jer Noble.
+
+        * media/track/track-display-before-controls-crash-expected.txt: Added.
+        * media/track/track-display-before-controls-crash.html: Added.
+
 2017-08-22  Chris Dumez  <cdu...@apple.com>
 
        Unreviewed, beacon/contentextensions is only expected to work on Sierra+.

Added: trunk/LayoutTests/media/track/track-display-before-controls-crash-expected.txt (0 => 221033)


--- trunk/LayoutTests/media/track/track-display-before-controls-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-display-before-controls-crash-expected.txt	2017-08-22 19:54:09 UTC (rev 221033)
@@ -0,0 +1,9 @@
+Tests triggering track display before media controls are created. Test passes if it does not crash.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/media/track/track-display-before-controls-crash.html (0 => 221033)


--- trunk/LayoutTests/media/track/track-display-before-controls-crash.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-display-before-controls-crash.html	2017-08-22 19:54:09 UTC (rev 221033)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+    description("Tests triggering track display before media controls are created. Test passes if it does not crash.");
+</script>
+</head>
+<body>
+    <template>
+        <video>
+            <source>
+                <audio>
+                    <track src="" default="C">Test Track 1</track>
+                </audio>
+            </source>
+        </video>
+    </template>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (221032 => 221033)


--- trunk/Source/WebCore/ChangeLog	2017-08-22 19:22:48 UTC (rev 221032)
+++ trunk/Source/WebCore/ChangeLog	2017-08-22 19:54:09 UTC (rev 221033)
@@ -1,3 +1,20 @@
+2017-08-22  Brent Fulgham  <bfulg...@apple.com>
+
+        Ensure media controls host exists before using it
+        https://bugs.webkit.org/show_bug.cgi?id=175833
+        <rdar://problem/34001219>
+
+        Reviewed by Jer Noble.
+
+        Although we ensure that the media controls shadow root exists before updating the text track
+        container, we don't check that the media controls host has been created yet. We do check
+        and create in other places in HTMLMediaElement.
+
+        Tests: media/track/track-display-before-controls-crash.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
+
 2017-08-22  Youenn Fablet  <you...@apple.com>
 
         [Cache API] Optimize whitespace trimming in Vary header values

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (221032 => 221033)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-08-22 19:22:48 UTC (rev 221032)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2017-08-22 19:54:09 UTC (rev 221033)
@@ -5967,6 +5967,8 @@
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     ensureMediaControlsShadowRoot();
     ASSERT(m_mediaControlsHost);
+    if (!m_mediaControlsHost)
+        m_mediaControlsHost = MediaControlsHost::create(this);
     m_mediaControlsHost->updateTextTrackContainer();
 #else
     if (!hasMediaControls() && !createMediaControls())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to