Bug 33735

Summary: error event doesn't fire for <video><source src=doesnotexist.mp4></video>
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: eric.carlson
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
test case none

Description Adam Roben (:aroben) 2010-01-15 13:48:39 PST
To reproduce:

1. Download the attached test to LayoutTests/media
2. run-webkit-tests media/media-no-source.html

The test times out because the error event is never fired.

HTML5 says we should fire an error event. See <http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#concept-media-load-algorithm> step 6.10:

> Failed: Queue a task to fire a simple event named error at the
> candidate element, in the context of the fetching process that
> was used to try to obtain candidate's corresponding media
> resource in the resource fetch algorithm.

Note that the error event *does* fire for <video src=doesnotexist.mp4></video>
Comment 1 Adam Roben (:aroben) 2010-01-15 14:30:32 PST
<rdar://problem/7547649>
Comment 2 Adam Roben (:aroben) 2010-01-15 14:35:45 PST
I think we need to fire the event here <http://trac.webkit.org/browser/trunk/WebCore/html/HTMLMediaElement.cpp?rev=53146#L692>:

        // If we failed while trying to load a <source> element, the movie was never parsed, and there are more
        // <source> children, schedule the next one
        if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) {
            m_currentSourceNode->scheduleErrorEvent();
            if (havePotentialSourceChild())
                scheduleNextSourceChild();
            return;
        }
Comment 3 Adam Roben (:aroben) 2010-01-15 14:36:48 PST
This seems related to bug 33744.
Comment 4 Eric Carlson 2010-01-16 14:09:07 PST
Looks like you forgot to attach the test case.
Comment 5 Adam Roben (:aroben) 2010-01-18 06:23:10 PST
Created attachment 46816 [details]
test case
Comment 6 Eric Carlson 2010-01-19 10:25:36 PST
This test is incorrect as the event listener is on the <video> element but 'error' events don't bubble. Attach the listener to the document or source element and it will be triggered.