1// Restarts media that a Turbo visit brought onto the page dead. 2// 3// Turbo parses each visit's HTML with DOMParser, and that document has no browsing context. 4// Chromium starts loading a <video>/<audio> the moment it lands in a document, so the load 5// runs there and fails ("Media load rejected by URL safety check"), leaving the element in 6// NETWORK_NO_SOURCE. Turbo then swaps the element into the live page, but a media element 7// only starts loading on insertion while its network state is still NETWORK_EMPTY â so it 8// stays dead until something calls load(). Full page loads never hit this. 9// 10// Shared between the body-level sweep (light DOM) and the Pulse shadow roots, which 11// light-DOM queries don't reach. 12export function reloadStrandedMedia(root) { 13 root.querySelectorAll("video, audio").forEach((media) => { 14 if (neverStartedLoading(media)) media.load() 15 }) 16} 17 18// Media that genuinely failed â a 404, an unplayable codec â also ends in NETWORK_NO_SOURCE, 19// but with a currentSrc, and reloading that would only repeat a request we know fails. 20function neverStartedLoading(media) { 21 return media.networkState === HTMLMediaElement.NETWORK_NO_SOURCE && !media.currentSrc 22};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.