onload callback for <track> element attached to <video> does not fire
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2013 00:33:32 +0000 (00:33 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2013 00:33:32 +0000 (00:33 +0000)
commit5a07fb51551d6c79862bb850f66054eea2dd656d
treee481e08ca3673db4c93d11168da324a439421ba8
parenteb5f47218ce058b339cb88754020dc289b5f411a
onload callback for <track> element attached to <video> does not fire
https://bugs.webkit.org/show_bug.cgi?id=103258

Patch by Antoine Quint <graouts@apple.com> on 2013-01-03
Reviewed by Eric Carlson.

Source/WebCore:

We now correctly implement the track processing model per the latest spec at
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#start-the-track-processing-model.

For a <track> to load, three conditions must be met:

1. it must have a non-empty src
2. it must have a mode other than "disabled" (the default)
3. it must have a parent media element

We used to only check if we were able to load upon setting the track's src,
whereas a change of any of those conditions should have done this, which this
patch now correctly implements.

We also correctly implement the load model asynchronously after step 4, per
the spec, hence the split of the code previously entirely contained in
HTMLTrackElement::scheduleLoad() in another method fired on a timer.

Test: media/track/track-element-load-event.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::textTrackModeChanged):
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::HTMLTrackElement):
(WebCore::HTMLTrackElement::insertedInto):
(WebCore::HTMLTrackElement::parseAttribute):
(WebCore::HTMLTrackElement::scheduleLoad):
(WebCore):
(WebCore::HTMLTrackElement::loadTimerFired):
(WebCore::HTMLTrackElement::textTrackModeChanged):
* html/HTMLTrackElement.h:
* html/track/TextTrack.cpp:
(WebCore::TextTrack::removeAllCues):
(WebCore):
* html/track/TextTrack.h:
(TextTrack):

LayoutTests:

As a result of fixing this bug, a few new failures were uncovered and TestExpectations
needed to be updated to take this into account. Additionally, some existing tests were
incorrect or outdated and were fixed as well. Finally, a new test was added to thoroughly
test the various conditions required for a <track> element to successfully load.

* fast/events/constructors/track-event-constructor.html: Update the test to correctly set
a non-disabled mode on the text track such that it may load per the rules enforced with this patch.
* http/tests/security/text-track-crossorigin.html: Update the test to correctly set a non-disabled
mode on the text track such that it may load per the rules enforced with this patch.
* media/track/track-add-track-expected.txt: Update the output to match changes made to test.
* media/track/track-add-track.html: Update the test to correctly set a non-disabled mode on
the text track such that it may load per the rules enforced with this patch. Also, ensure
the .readyState of the text track is correctly assumed to be NONE vs. LOADING as it would
have to wait until the next run loop to be changed to anything but NONE.
* media/track/track-element-load-event-expected.txt: Added.
* media/track/track-element-load-event.html: Added.
* media/track/track-load-from-src-readyState.html: Update the test to correctly set a
non-disabled mode on the text track such that it may load per the rules enforced with
this patch.
* platform/chromium/TestExpectations: Skip tests that now fail instead of timing out.
* platform/efl/TestExpectations: Skip tests that now fail instead of timing out.
* platform/gtk/TestExpectations: Skip tests that now fail instead of timing out.
* platform/mac/TestExpectations: Skip tests that now fail instead of timing out.
* platform/qt/TestExpectations: Skip tests that now fail instead of timing out.
* platform/win/TestExpectations: Skip tests that now fail instead of timing out.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/constructors/track-event-constructor.html
LayoutTests/http/tests/security/text-track-crossorigin.html
LayoutTests/media/track/track-add-track-expected.txt
LayoutTests/media/track/track-add-track.html
LayoutTests/media/track/track-element-load-event-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-element-load-event.html [new file with mode: 0644]
LayoutTests/media/track/track-load-from-src-readyState.html
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/HTMLTrackElement.h
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h