Changeset 221155 in webkit
- Timestamp:
- Aug 24, 2017 12:44:20 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r221150 r221155 1 2017-08-24 Kirill Ovchinnikov <kirill.ovchinn@gmail.com> 2 3 HTMLTrackElement behavior violates the standard 4 https://bugs.webkit.org/show_bug.cgi?id=175888 5 6 Reviewed by Eric Carlson. 7 8 * media/track/text-track-src-change-expected.txt: 9 * media/track/text-track-src-change.html: 10 1 11 2017-08-24 Jonathan Bedard <jbedard@apple.com> 2 12 -
trunk/LayoutTests/media/track/text-track-src-change-expected.txt
r220472 r221155 8 8 *** Changing 'src' attribute... 9 9 EXPECTED (cues.length == '100') OK 10 EXPECTED (cues === testTrack.track.cues == 'true') OK 10 11 11 12 *** Changing back 'src' attribute... 13 EXPECTED (cues === testTrack.track.cues == 'true') OK 12 14 EXPECTED (cues.length == '4') OK 15 16 *** Setting 'src' to the same value... 17 EXPECTED (cues === testTrack.track.cues == 'true') OK 18 EXPECTED (cues.length == '4') OK 19 20 *** Setting 'src' to an empty value... 21 EXPECTED (stage == '5') OK 22 EXPECTED (true == 'true') OK 23 EXPECTED (cues.length == '0') OK 13 24 END OF TEST 14 25 -
trunk/LayoutTests/media/track/text-track-src-change.html
r220472 r221155 8 8 <script> 9 9 var stage = 0; 10 var errorEventTimer = null; 10 11 11 function trackLoaded()12 function loadedTrackTest() 12 13 { 13 14 var testTrack = document.getElementById('testTrack'); … … 22 23 break; 23 24 case 1: 24 cues = testTrack.track.cues;25 25 testExpected("cues.length", 100); 26 testExpected("cues === testTrack.track.cues", true); 26 27 consoleWrite("<br>*** Changing back 'src' attribute..."); 27 28 ++stage; … … 29 30 break; 30 31 case 2: 31 cues = testTrack.track.cues;32 testExpected("cues === testTrack.track.cues", true); 32 33 testExpected("cues.length", 4); 33 endTest(); 34 consoleWrite("<br>*** Setting 'src' to the same value..."); 35 ++stage; 36 testTrack.src = "captions-webvtt/tc013-settings.vtt"; 37 // Let's ensure that 'load' event is not fired after that 38 // - it should jump directly to the stage 4 instead of stage 3 39 setTimeout(function() { ++stage; loadedTrackTest(); }, 100); 40 break; 41 case 3: 42 failTest("'load' event should not be fired after setting the same URL"); 43 break; 44 case 4: 45 testExpected("cues === testTrack.track.cues", true); 46 testExpected("cues.length", 4); 47 consoleWrite("<br>*** Setting 'src' to an empty value..."); 48 ++stage; 49 testTrack.src = ""; // this should fire 'error' event 50 errorEventTimer = setTimeout(function() { 51 failTest("'error' event didn't fire after setting an empty URL"); 52 }, 10000); 53 break; 54 case 5: 55 failTest("'load' event should not be fired after setting an empty URL"); 34 56 break; 35 57 } 36 58 } 59 60 function trackLoadFailed() 61 { 62 clearTimeout(errorEventTimer); 63 testExpected("stage", 5); 64 testExpected(cues === testTrack.track.cues, true); 65 testExpected("cues.length", 0); 66 endTest(); 67 } 68 37 69 38 70 setCaptionDisplayMode('Automatic'); … … 42 74 <p>Tests Track 'src' changing handling</p> 43 75 <video> 44 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" kind="captions" onload=" trackLoaded()" default>76 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" kind="captions" onload="loadedTrackTest()" onerror="trackLoadFailed()" default> 45 77 </video> 46 78 </body> -
trunk/Source/WebCore/ChangeLog
r221152 r221155 1 2017-08-24 Kirill Ovchinnikov <kirill.ovchinn@gmail.com> 2 3 HTMLTrackElement behavior violates the standard 4 https://bugs.webkit.org/show_bug.cgi?id=175888 5 6 Reviewed by Eric Carlson. 7 8 Test: media/track/text-track-src-change.html: added asserts 9 10 * html/HTMLTrackElement.cpp: 11 (WebCore::HTMLTrackElement::parseAttribute): 12 (WebCore::HTMLTrackElement::loadTimerFired): 13 * html/track/LoadableTextTrack.cpp: 14 (WebCore::LoadableTextTrack::scheduleLoad): 15 * html/track/TextTrack.cpp: 16 (WebCore::TextTrack::removeAllCues): 17 * html/track/TextTrackCueList.cpp: 18 (WebCore::TextTrackCueList::removeAll): 19 * html/track/TextTrackCueList.h: 20 1 21 2017-08-24 David Kilzer <ddkilzer@apple.com> 2 22 -
trunk/Source/WebCore/html/HTMLTrackElement.cpp
r220472 r221155 101 101 { 102 102 if (name == srcAttr) { 103 if (!value.isEmpty()) 104 scheduleLoad(); 105 else if (m_track) 106 m_track->removeAllCues(); 103 scheduleLoad(); 107 104 108 105 // 4.8.10.12.3 Sourcing out-of-band text tracks … … 187 184 void HTMLTrackElement::loadTimerFired() 188 185 { 189 if (!hasAttributeWithoutSynchronization(srcAttr)) 190 return; 186 if (!hasAttributeWithoutSynchronization(srcAttr)) { 187 track().removeAllCues(); 188 return; 189 } 191 190 192 191 // 6. Set the text track readiness state to loading. … … 196 195 URL url = getNonEmptyURLAttribute(srcAttr); 197 196 197 // ... if URL is the empty string, then queue a task to first change the text track readiness state 198 // to failed to load and then fire an event named error at the track element. 198 199 // 8. If the track element's parent is a media element then let CORS mode be the state of the parent media 199 200 // element's crossorigin content attribute. Otherwise, let CORS mode be No CORS. 200 if (!canLoadURL(url)) { 201 if (url.isEmpty() || !canLoadURL(url)) { 202 track().removeAllCues(); 201 203 didCompleteLoad(HTMLTrackElement::Failure); 202 204 return; 203 205 } 204 205 // When src attribute is changed we need to flush all collected track data206 if (m_track)207 m_track->removeAllCues();208 206 209 207 track().scheduleLoad(url); -
trunk/Source/WebCore/html/track/LoadableTextTrack.cpp
r219237 r221155 48 48 if (url == m_url) 49 49 return; 50 51 // When src attribute is changed we need to flush all collected track data 52 removeAllCues(); 50 53 51 54 // 4.8.10.12.3 Sourcing out-of-band text tracks (continued) -
trunk/Source/WebCore/html/track/TextTrack.cpp
r219856 r221155 270 270 m_cues->item(i)->setTrack(nullptr); 271 271 272 m_cues = nullptr;272 m_cues->clear(); 273 273 } 274 274 -
trunk/Source/WebCore/html/track/TextTrackCueList.cpp
r210319 r221155 107 107 } 108 108 109 void TextTrackCueList::clear() 110 { 111 m_vector.clear(); 112 if (m_activeCues) 113 m_activeCues->m_vector.clear(); 114 } 115 109 116 void TextTrackCueList::updateCueIndex(TextTrackCue& cue) 110 117 { -
trunk/Source/WebCore/html/track/TextTrackCueList.h
r210319 r221155 47 47 void updateCueIndex(TextTrackCue&); 48 48 49 void clear(); 50 49 51 TextTrackCueList& activeCues(); 50 52
Note: See TracChangeset
for help on using the changeset viewer.