Title: [164174] trunk
Revision
164174
Author
[email protected]
Date
2014-02-15 10:00:22 -0800 (Sat, 15 Feb 2014)

Log Message

Setting currentTime on HTMLMediaElement with media controller should throw exception.
https://bugs.webkit.org/show_bug.cgi?id=128867.

Patch by Piotr Grad <[email protected]> on 2014-02-15
Reviewed by Eric Carlson.

Source/WebCore:

Added implementation for setting currentTime in HTMLMediaElement. Old implementation
was left to be used internally.

Test: media/video-controller-currentTime.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLMediaElement.h:
* html/HTMLMediaElement.idl:

LayoutTests:

* media/video-controller-currentTime-expected.txt: Added.
* media/video-controller-currentTime.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164173 => 164174)


--- trunk/LayoutTests/ChangeLog	2014-02-15 17:51:57 UTC (rev 164173)
+++ trunk/LayoutTests/ChangeLog	2014-02-15 18:00:22 UTC (rev 164174)
@@ -1,3 +1,13 @@
+2014-02-15  Piotr Grad  <[email protected]>
+
+        Setting currentTime on HTMLMediaElement with media controller should throw exception.
+        https://bugs.webkit.org/show_bug.cgi?id=128867.
+
+        Reviewed by Eric Carlson.
+
+        * media/video-controller-currentTime-expected.txt: Added.
+        * media/video-controller-currentTime.html: Added.
+
 2014-02-15  Renata Hodovan  <[email protected]>
 
         ASSERT_WITH_SECURITY_IMPLICATION in WebCore::toElement

Added: trunk/LayoutTests/media/video-controller-currentTime-expected.txt (0 => 164174)


--- trunk/LayoutTests/media/video-controller-currentTime-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/video-controller-currentTime-expected.txt	2014-02-15 18:00:22 UTC (rev 164174)
@@ -0,0 +1,7 @@
+
+Test that seeking video with media controller throws invalid state exception.
+
+EVENT(canplaythrough)
+TEST(video.currentTime = 3) THROWS(DOMException.INVALID_STATE_ERR) OK
+END OF TEST
+

Added: trunk/LayoutTests/media/video-controller-currentTime.html (0 => 164174)


--- trunk/LayoutTests/media/video-controller-currentTime.html	                        (rev 0)
+++ trunk/LayoutTests/media/video-controller-currentTime.html	2014-02-15 18:00:22 UTC (rev 164174)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script>
+            function start()
+            {
+                findMediaElement();
+                video.src = "" "content/test");
+                waitForEventOnce('canplaythrough', canPlayThrough);
+            }
+
+            function canPlayThrough()
+            {
+                testDOMException("video.currentTime = 3", "DOMException.INVALID_STATE_ERR");
+                endTest();
+            }
+        </script>
+    </head>
+    <body _onload_="start()">
+        <video mediaGroup="group" controls></video>
+        <p>Test that seeking video with media controller throws invalid state exception.</p>
+    </body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (164173 => 164174)


--- trunk/Source/WebCore/ChangeLog	2014-02-15 17:51:57 UTC (rev 164173)
+++ trunk/Source/WebCore/ChangeLog	2014-02-15 18:00:22 UTC (rev 164174)
@@ -1,3 +1,20 @@
+2014-02-15  Piotr Grad  <[email protected]>
+
+        Setting currentTime on HTMLMediaElement with media controller should throw exception.
+        https://bugs.webkit.org/show_bug.cgi?id=128867.
+
+        Reviewed by Eric Carlson.
+
+        Added implementation for setting currentTime in HTMLMediaElement. Old implementation
+        was left to be used internally.
+
+        Test: media/video-controller-currentTime.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * html/HTMLMediaElement.h:
+        * html/HTMLMediaElement.idl:
+
 2014-02-15  Anders Carlsson  <[email protected]>
 
         Form controls are always painted in the active state

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (164173 => 164174)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-02-15 17:51:57 UTC (rev 164173)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-02-15 18:00:22 UTC (rev 164174)
@@ -2520,6 +2520,18 @@
     seek(time);
 }
 
+void HTMLMediaElement::setCurrentTime(double time, ExceptionCode& ec)
+{
+    // On setting, if the media element has a current media controller, then the user agent must
+    // throw an InvalidStateError exception
+    if (m_mediaController) {
+        ec = INVALID_STATE_ERR;
+        return;
+    }
+
+    seek(time);
+}
+
 double HTMLMediaElement::duration() const
 {
     if (m_player && m_readyState >= HAVE_METADATA)

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (164173 => 164174)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2014-02-15 17:51:57 UTC (rev 164173)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2014-02-15 18:00:22 UTC (rev 164174)
@@ -180,6 +180,7 @@
 // playback state
     virtual double currentTime() const override;
     virtual void setCurrentTime(double) override;
+    virtual void setCurrentTime(double, ExceptionCode&);
     virtual double duration() const override;
     virtual bool paused() const override;
     virtual double defaultPlaybackRate() const override;

Modified: trunk/Source/WebCore/html/HTMLMediaElement.idl (164173 => 164174)


--- trunk/Source/WebCore/html/HTMLMediaElement.idl	2014-02-15 17:51:57 UTC (rev 164173)
+++ trunk/Source/WebCore/html/HTMLMediaElement.idl	2014-02-15 18:00:22 UTC (rev 164174)
@@ -63,7 +63,7 @@
     readonly attribute boolean seeking;
 
     // playback state
-    attribute double currentTime;
+    [SetterRaisesException] attribute double currentTime;
     readonly attribute double duration;
     readonly attribute boolean paused;
     attribute double defaultPlaybackRate;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to