This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7631 - Don't invoke resource selection algorithm when inserting <source> if src="" is present
Summary: Don't invoke resource selection algorithm when inserting <source> if src="" i...
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Keywords: NE
Depends on:
Reported: 2009-09-15 14:39 UTC by Simon Pieters
Modified: 2010-10-04 13:57 UTC (History)
4 users (show)

See Also:


Description Simon Pieters 2009-09-15 14:39:14 UTC
The spec says

"If a source element is inserted as a child of a media element that is in a Document and whose networkState has the value NETWORK_EMPTY, the user agent must invoke the media element's resource selection algorithm."

A media element can have networkState be NETWORK_EMPTY while also having a src="" attribute if:

...the connection is interrupted, causing the user agent to give up trying to fetch the resource, or
...the media data is corrupted, or
...the media data fetching process is aborted by the user, and the media element's readyState attribute had a value equal to HAVE_NOTHING

When inserting a <source> element into such a media element, the resource selection algorithm will be run, and it will see that there is a src attribute and try to use it again, which will fail in the same way.

If an author inserts a <source> in the onemptied="" event listener, then there will be an infinite (async) loop.

Maybe the spec should also check that the media element does not have a src attribute before running the resource selection algorithm when inserting a <source> element.
Comment 1 Simon Pieters 2009-09-15 15:33:09 UTC
Alternatively, maybe the spec should say that those three cases don't set networkState to NETWORK_EMPTY but to something else (e.g. NETWORK_NO_SOURCE).
Comment 2 contributor 2009-09-21 09:27:56 UTC
Checked in as WHATWG revision r3924.
Check-in comment: Avoid inserting a <source> being the trigger for retrying the src='', since that makes no sense.