Bug 128867

Summary: Setting currentTime on HTMLMediaElement with media controller should throw exception
Product: WebKit Reporter: Piotr Grad <piotr.grad>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, eric.carlson, esprehn+autocc, glenn, gyuyoung.kim, jer.noble, kondapallykalyan, philipj, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch & layout test
none
Patch & layout test
eric.carlson: review+
Patch & layout test none

Description Piotr Grad 2014-02-15 00:58:41 PST
According to spec. On setting, if the media element has a current media controller, then the user agent must throw an InvalidStateError exception [1]

[1] http://www.w3.org/TR/html51/embedded-content-0.html#dom-media-currenttime
Comment 1 Piotr Grad 2014-02-15 03:37:37 PST
Created attachment 224296 [details]
Patch & layout test
Comment 2 Piotr Grad 2014-02-15 03:41:14 PST
Created attachment 224297 [details]
Patch & layout test
Comment 3 Eric Carlson 2014-02-15 08:24:53 PST
Comment on attachment 224297 [details]
Patch & layout test

View in context: https://bugs.webkit.org/attachment.cgi?id=224297&action=review

> LayoutTests/media/video-controller-currentTime.html:7
> +            function start() {

Nit: a function's opening brace should be on a new line.

> LayoutTests/media/video-controller-currentTime.html:13
> +            function canPlayThrough() {

Ditto.

> LayoutTests/media/video-controller-currentTime.html:19
> +                try {
> +                    video.currentTime = 3;
> +                } catch (e) {
> +                    consoleWrite(e);
> +                    endTest();
> +                }

You should also test that an INVALID_STATE_ERR exception is thrown, eg.:

testDOMException("video.currentTime = 3", "DOMException.INVALID_STATE_ERR");
Comment 4 Piotr Grad 2014-02-15 08:39:16 PST
Created attachment 224299 [details]
Patch & layout test
Comment 5 Eric Carlson 2014-02-15 09:24:53 PST
Comment on attachment 224299 [details]
Patch & layout test

Thank you!
Comment 6 WebKit Commit Bot 2014-02-15 09:55:13 PST
Comment on attachment 224299 [details]
Patch & layout test

Clearing flags on attachment: 224299

Committed r164174: <http://trac.webkit.org/changeset/164174>
Comment 7 WebKit Commit Bot 2014-02-15 09:55:16 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Darin Adler 2014-02-19 10:06:05 PST
Comment on attachment 224299 [details]
Patch & layout test

View in context: https://bugs.webkit.org/attachment.cgi?id=224299&action=review

> Source/WebCore/html/HTMLMediaElement.h:183
> +    virtual void setCurrentTime(double, ExceptionCode&);

I see no reason for this function to be virtual.