RESOLVED FIXED 71915
addTrack() must throw an exception if 'kind' is unknown
https://bugs.webkit.org/show_bug.cgi?id=71915
Summary addTrack() must throw an exception if 'kind' is unknown
Eric Carlson
Reported 2011-11-09 07:29:42 PST
http://dev.w3.org/html5/spec/the-iframe-element.html#dom-media-addtexttrack says: "If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps"
Attachments
Proposed patch (27.28 KB, patch)
2011-11-15 18:33 PST, Eric Carlson
webkit.review.bot: commit-queue-
Patch (27.36 KB, patch)
2011-11-15 20:42 PST, Eric Carlson
pnormand: review+
Radar WebKit Bug Importer
Comment 1 2011-11-09 07:30:17 PST
Eric Carlson
Comment 2 2011-11-15 18:33:58 PST
Created attachment 115292 [details] Proposed patch
WebKit Review Bot
Comment 3 2011-11-15 18:54:33 PST
Comment on attachment 115292 [details] Proposed patch Attachment 115292 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/10494001
Eric Carlson
Comment 4 2011-11-15 20:42:28 PST
Philippe Normand
Comment 5 2011-11-16 07:57:57 PST
Comment on attachment 115311 [details] Patch Nice patch, thanks Eric!
Eric Carlson
Comment 6 2011-11-16 08:06:52 PST
Darin Adler
Comment 7 2011-12-01 16:02:28 PST
Comment on attachment 115292 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=115292&action=review > Source/WebCore/html/HTMLMediaElement.cpp:2099 > -TextTrackList* HTMLMediaElement::textTracks() const > +TextTrackList* HTMLMediaElement::textTracks() Left a trailing space on there. > Source/WebCore/html/HTMLTrackElement.cpp:106 > + } else if (attrName == kindAttr) > + track()->setKind(attr->value()); > + else if (attrName == labelAttr) > + track()->setLabel(attr->value()); > + else if (attrName == srclangAttr) > + track()->setLanguage(attr->value()); I’m not sure why this is in attributeChanged rather than parseMappedAttribute. > Source/WebCore/html/HTMLTrackElement.cpp:109 > KURL HTMLTrackElement::src() const I don’t understand why this doesn’t just use [Reflect]. Why do we need a custom function for this? And for any of these other attributes. > Source/WebCore/html/HTMLTrackElement.cpp:122 > String HTMLTrackElement::kind() const > { > - return getAttribute(kindAttr); > + return track()->kind(); > } I don’t understand this change. How can these two get out of sync? > Source/WebCore/html/HTMLTrackElement.cpp:166 > + String kind = getAttribute(kindAttr); Should be fastGetAttribute. > Source/WebCore/html/HTMLTrackElement.h:-51 > KURL src() const; > + void setSrc(const String&); > + > String kind() const; > + void setKind(const String&); > + > String srclang() const; > + void setSrclang(const String&); > + > String label() const; > + void setLabel(const String&); > > bool isDefault() const; > - void setKind(const String&); > - void setSrc(const String&); > - void setSrclang(const String&); > - void setLabel(const String&); This seems like an unneeded change. > Source/WebCore/html/TextTrack.h:70 > + static const AtomicString& subtitlesKeyword(); > + static const AtomicString& captionsKeyword(); > + static const AtomicString& descriptionsKeyword(); > + static const AtomicString& chaptersKeyword(); > + static const AtomicString& metadataKeyword(); Do these need to be member functions?
Eric Carlson
Comment 8 2011-12-02 09:48:22 PST
(In reply to comment #7) > (From update of attachment 115292 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=115292&action=review > > > Source/WebCore/html/HTMLMediaElement.cpp:2099 > > -TextTrackList* HTMLMediaElement::textTracks() const > > +TextTrackList* HTMLMediaElement::textTracks() > > Left a trailing space on there. > I will fix that. > > Source/WebCore/html/HTMLTrackElement.cpp:106 > > + } else if (attrName == kindAttr) > > + track()->setKind(attr->value()); > > + else if (attrName == labelAttr) > > + track()->setLabel(attr->value()); > > + else if (attrName == srclangAttr) > > + track()->setLanguage(attr->value()); > > I’m not sure why this is in attributeChanged rather than parseMappedAttribute. > No good reason, I will fix this. > > Source/WebCore/html/HTMLTrackElement.cpp:109 > > KURL HTMLTrackElement::src() const > > I don’t understand why this doesn’t just use [Reflect]. Why do we need a custom function for this? And for any of these other attributes. > Good point. > > Source/WebCore/html/HTMLTrackElement.cpp:122 > > String HTMLTrackElement::kind() const > > { > > - return getAttribute(kindAttr); > > + return track()->kind(); > > } > > I don’t understand this change. How can these two get out of sync? > The kind IDL attribute must "reflect the content attribute of the same name, limited to only known values". I decided to put the knowledge about what kind values are allowed in TextTrack because it also applies to tracks created with HTMLMediaElement::addTrack(). I will add a comment to this function. > > Source/WebCore/html/HTMLTrackElement.cpp:166 > > + String kind = getAttribute(kindAttr); > > Should be fastGetAttribute. > Good point, I will fix this. > > Source/WebCore/html/HTMLTrackElement.h:-51 > > KURL src() const; > > + void setSrc(const String&); > > + > > String kind() const; > > + void setKind(const String&); > > + > > String srclang() const; > > + void setSrclang(const String&); > > + > > String label() const; > > + void setLabel(const String&); > > > > bool isDefault() const; > > - void setKind(const String&); > > - void setSrc(const String&); > > - void setSrclang(const String&); > > - void setLabel(const String&); > > This seems like an unneeded change. > It was just drive-by cleanup. > > Source/WebCore/html/TextTrack.h:70 > > + static const AtomicString& subtitlesKeyword(); > > + static const AtomicString& captionsKeyword(); > > + static const AtomicString& descriptionsKeyword(); > > + static const AtomicString& chaptersKeyword(); > > + static const AtomicString& metadataKeyword(); > > Do these need to be member functions? > Not necessarily. They are also used by HTMLMediaElement and HTMLTrackElement so I thought it would be helpful to give them class scope. Thanks for the feedback!
Note You need to log in before you can comment on or make changes to this bug.