Very quick diagnosis from poking in GDB... It looked to me like the track has a mode of `disabled` by default -- and when a track has that mode, it bails from `MaybeDispatchLoadResource()` without actually dispatching a task to load the resource, here: https://searchfox.org/firefox-main/rev/98bf4b92d3f5d7a9855281df4bf333210bcfbbc4/dom/media/webvtt/HTMLTrackElement.cpp#249,252-253,255-257 ```cpp void HTMLTrackElement::MaybeDispatchLoadResource() { ... // step2, if the text track's text track mode is not set to one of hidden or // showing, then return. ... if (mTrack->Mode() == TextTrackMode::Disabled && !resistFingerprinting) { LOG("Do not load resource for disable track"); return; ``` The **very first track** manages to avoid that problem, because we get a call to `HonorUserPreferencesForTrackSelection` which changes the mode of all disabled tracks here: https://searchfox.org/firefox-main/rev/98bf4b92d3f5d7a9855281df4bf333210bcfbbc4/dom/media/webvtt/TextTrackManager.cpp#328-331,341-352 ```cpp void TextTrackManager::HonorUserPreferencesForTrackSelection() { if (performedTrackSelection || !mTextTracks) { return; } ... // Step 4: Set all TextTracks with a kind of metadata that are disabled // to hidden. for (uint32_t i = 0; i < mTextTracks->Length(); i++) { RefPtr<TextTrack> track = (*mTextTracks)[i]; if (track->Kind() == TextTrackKind::Metadata && TrackIsDefault(track) && track->Mode() == TextTrackMode::Disabled) { track->SetMode(TextTrackMode::Hidden); } } performedTrackSelection = true; } ``` I think later tracks trigger that same call to `HonorUserPreferencesForTrackSelection`, but they skip the important parts of that function because `performedTrackSelection` is now `true` which makes them take the early-return at the start of the function.
Bug 2029014 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Very quick diagnosis from poking in GDB... It looked to me like each `track` element has a `Mode()` of `TextTrackMode::Disabled` by default -- and when a track has that `Disabled` mode, it bails from `MaybeDispatchLoadResource()` **without actually dispatching any task to load the resource**, here: https://searchfox.org/firefox-main/rev/98bf4b92d3f5d7a9855281df4bf333210bcfbbc4/dom/media/webvtt/HTMLTrackElement.cpp#249,252-253,255-257 ```cpp void HTMLTrackElement::MaybeDispatchLoadResource() { ... // step2, if the text track's text track mode is not set to one of hidden or // showing, then return. ... if (mTrack->Mode() == TextTrackMode::Disabled && !resistFingerprinting) { LOG("Do not load resource for disable track"); return; ``` The **very first track** manages to avoid that problem, because we get a call to `HonorUserPreferencesForTrackSelection` which changes the mode of all disabled tracks here: https://searchfox.org/firefox-main/rev/98bf4b92d3f5d7a9855281df4bf333210bcfbbc4/dom/media/webvtt/TextTrackManager.cpp#328-331,341-352 ```cpp void TextTrackManager::HonorUserPreferencesForTrackSelection() { if (performedTrackSelection || !mTextTracks) { return; } ... // Step 4: Set all TextTracks with a kind of metadata that are disabled // to hidden. for (uint32_t i = 0; i < mTextTracks->Length(); i++) { RefPtr<TextTrack> track = (*mTextTracks)[i]; if (track->Kind() == TextTrackKind::Metadata && TrackIsDefault(track) && track->Mode() == TextTrackMode::Disabled) { track->SetMode(TextTrackMode::Hidden); } } performedTrackSelection = true; } ``` I think later tracks trigger that same call to `HonorUserPreferencesForTrackSelection`, but they skip the important parts of that function because `performedTrackSelection` is now `true` which makes them take the early-return at the start of the function.