Skip to content
Permalink
Browse files
video.currentSrc should not be reset when a new load errors
https://bugs.webkit.org/show_bug.cgi?id=225451
<rdar://77961629>

Reviewed by Eric Carlson.

A media element's currentSrc attribute should not be reset if a load
ends up erroring. This was happening due to the reset of currentSrc in the
prepareForLoad method. Instead of resetting the URL, we should instead
just set the unique media identifier.

* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-currentSrc-expected.txt:

Media test removed since this condition is already covered by the above WPT test.
* LayoutTests/media/video-currentsrc-cleared-expected.txt: Removed.
* LayoutTests/media/video-currentsrc-cleared.html: Removed.

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::prepareForLoad):

Canonical link: https://commits.webkit.org/251899@main
  • Loading branch information
youssefsoli committed Jun 28, 2022
1 parent bf8293a commit de4124158812fa9bbc6bff85e1dba79ee97bbab3
Showing 4 changed files with 2 additions and 48 deletions.
@@ -1,3 +1,3 @@

FAIL Test currentSrc behaviour in various playback scenarios assert_true: Not reset when a new load errors expected true got false
PASS Test currentSrc behaviour in various playback scenarios

This file was deleted.

This file was deleted.

@@ -1183,7 +1183,7 @@ void HTMLMediaElement::prepareForLoad()
m_haveFiredLoadedData = false;
m_completelyLoaded = false;
m_havePreparedToPlay = false;
setCurrentSrc(URL());
m_currentIdentifier = MediaUniqueIdentifier::generate();

#if ENABLE(WIRELESS_PLAYBACK_TARGET)
m_failedToPlayToWirelessTarget = false;

0 comments on commit de41241

Please sign in to comment.