()
| 1406 | ); |
| 1407 | for (const node of assetNodes) { |
| 1408 | const onError = () => { |
| 1409 | if (!(node instanceof Element)) { |
| 1410 | return; |
| 1411 | } |
| 1412 | const tagName = node.tagName.toLowerCase(); |
| 1413 | const assetUrl = |
| 1414 | node.getAttribute("src") ?? |
| 1415 | node.getAttribute("href") ?? |
| 1416 | node.getAttribute("poster") ?? |
| 1417 | null; |
| 1418 | const diagnosticCode = |
| 1419 | tagName === "link" ? "runtime_stylesheet_load_failed" : "runtime_asset_load_failed"; |
| 1420 | postRuntimeDiagnosticOnce( |
| 1421 | diagnosticCode, |
| 1422 | { |
| 1423 | tagName, |
| 1424 | assetUrl, |
| 1425 | currentSrc: |
| 1426 | node instanceof HTMLImageElement || node instanceof HTMLMediaElement |
| 1427 | ? node.currentSrc || null |
| 1428 | : null, |
| 1429 | readyState: node instanceof HTMLMediaElement ? node.readyState : null, |
| 1430 | networkState: node instanceof HTMLMediaElement ? node.networkState : null, |
| 1431 | }, |
| 1432 | `${diagnosticCode}:${tagName}:${assetUrl ?? "unknown"}`, |
| 1433 | ); |
| 1434 | }; |
| 1435 | node.addEventListener("error", onError); |
| 1436 | registerRuntimeCleanup(() => { |
| 1437 | node.removeEventListener("error", onError); |
nothing calls this directly
no test coverage detected