2009-06-04 Pierre d'Herbemont <pdherbemont@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jun 2009 16:04:07 +0000 (16:04 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Jun 2009 16:04:07 +0000 (16:04 +0000)
        Reviewed by Darin Adler.

        Test: media/before-load-member-access.html

        https://bugs.webkit.org/show_bug.cgi?id=26081

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::played): Ensure that if m_playedTimeRanges,
        is not initialized we return a valid range, and don't attempt to use it.

2009-06-04  Pierre d'Herbemont  <pdherbemont@apple.com>

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=26081

        * media/before-load-member-access-expected.txt: Added.
        * media/before-load-member-access.html: Test access for property accessed before
        loading occurs. That tests for 26081 crasher specifically.

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

LayoutTests/ChangeLog
LayoutTests/media/before-load-member-access-expected.txt [new file with mode: 0644]
LayoutTests/media/before-load-member-access.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLMediaElement.cpp

index 1c68674..57fdbde 100644 (file)
@@ -1,3 +1,13 @@
+2009-06-04  Pierre d'Herbemont  <pdherbemont@apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=26081
+
+        * media/before-load-member-access-expected.txt: Added.
+        * media/before-load-member-access.html: Test access for property accessed before
+        loading occurs. That tests for 26081 crasher specifically.
+
 2009-06-04  Ariya Hidayat  <ariya.hidayat@nokia.com>
 
         Rubber-stamped by Tor Arne Vestbø.
diff --git a/LayoutTests/media/before-load-member-access-expected.txt b/LayoutTests/media/before-load-member-access-expected.txt
new file mode 100644 (file)
index 0000000..d8204d2
--- /dev/null
@@ -0,0 +1,9 @@
+Test that accessing member of a non loaded video works.
+
+RUN(video.played)
+RUN(video.buffered)
+RUN(video.seekable)
+RUN(video.volume)
+SUCCESS
+END OF TEST
+
diff --git a/LayoutTests/media/before-load-member-access.html b/LayoutTests/media/before-load-member-access.html
new file mode 100644 (file)
index 0000000..58866a5
--- /dev/null
@@ -0,0 +1,26 @@
+<html>
+    <head>
+        <title>Test that accessing member of a non loaded video works.</title>
+        <script src=video-test.js></script>
+        <script>
+        function test()
+        {
+            findMediaElement();
+    
+            run("video.played");
+            run("video.buffered");
+            run("video.seekable");
+            run("video.volume");
+            consoleWrite("SUCCESS");
+            endTest();
+        }
+        </script>
+     </head>
+
+<body onload="test()">
+
+    <video controls></video>
+    <p>Test that accessing member of a non loaded video works.</p>
+
+</body>
+</html>
index f3b2db7..d1da8bf 100644 (file)
@@ -1,3 +1,15 @@
+2009-06-04  Pierre d'Herbemont  <pdherbemont@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Test: media/before-load-member-access.html
+        
+        https://bugs.webkit.org/show_bug.cgi?id=26081
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::played): Ensure that if m_playedTimeRanges,
+        is not initialized we return a valid range, and don't attempt to use it.
+
 2009-06-03  Kenneth Rohde Christiansen  <kenneth.christiansen@openbossa.org>
 
         Reviewed by Simon Hausmann.
index 348abf0..6ad0653 100644 (file)
@@ -1295,6 +1295,10 @@ PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const
 
 PassRefPtr<TimeRanges> HTMLMediaElement::played() const
 {
+    if (!m_playedTimeRanges) {
+        // We are not yet loaded
+        return TimeRanges::create();
+    }
     if (m_playing) {
         float time = currentTime();
         if (m_lastSeekTime < time)