* Emit error on load failure. * @param {!Element|!Window} eleOrWindow Supports both Elements and as a special * case Windows.
(eleOrWindow)
| 220 | * case Windows. |
| 221 | */ |
| 222 | function failedToLoad(eleOrWindow) { |
| 223 | // Mark the element as errored since some elements - like HTMLMediaElement |
| 224 | // using HTMLSourceElement - do not provide any synchronous way to verify if |
| 225 | // they already errored, even though the error event was already dispatched. |
| 226 | if (isHTMLMediaElement(eleOrWindow)) { |
| 227 | eleOrWindow[MEDIA_LOAD_FAILURE_SRC_PROPERTY] = |
| 228 | eleOrWindow.currentSrc || true; |
| 229 | } |
| 230 | |
| 231 | // Report failed loads as user errors so that they automatically go |
| 232 | // into the "document error" bucket. |
| 233 | let target = eleOrWindow; |
| 234 | if (target && target.src) { |
| 235 | target = target.src; |
| 236 | } |
| 237 | throw user().createError(LOAD_FAILURE_PREFIX, target); |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Returns true if the parameter is a HTMLMediaElement. |
no test coverage detected