Bug 135507 - Video does not trigger 'error' event for 403 error
Summary: Video does not trigger 'error' event for 403 error
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.9
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-08-01 08:00 PDT by Michael Holroyd
Modified: 2022-08-11 13:14 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Holroyd 2014-08-01 08:00:45 PDT
Correct behavior: error event should fire.
Current behavior: no event fires.

Reproduce with:

<html>
<body></body>
<script>
video = document.createElement("video");
video.addEventListener("error", function (err) {
  console.log("Could not load video");
});
video.src = "https://spins.arqspin.com/2c0rjp53jqhf8/spin.mp4"; // returns 403
video.load();
</script>
</html>
Comment 1 Eric Carlson 2014-08-02 09:58:27 PDT
The media element doesn't see the 403 error because CFNetwork rejects the self-signed certificate used by https://spins.arqspin.com.

2014-08-02 09:53:13.025 com.apple.WebKit.WebContent.Development[640:32798] NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)
[09:53:13.027] HTTPRequest figHttpRequestDidFailCallback: Network error: domain=kCFErrorDomainCFNetwork, code=-1202, The certificate for this server is invalid. You might be connecting to a server that is pretending to be ?spins.arqspin.com? which could put your confidential information at risk. for https://spins.arqspin.com/2c0rjp53jqhf8/spin.mp4
MediaPlayerPrivateAVFoundation::assetStatus - statusOfValueForKey failed for duration, error = The certificate for this server is invalid. You might be connecting to a server that is pretending to be “spins.arqspin.com” which could put your confidential information at risk.
Comment 2 Eric Carlson 2014-08-02 10:03:45 PDT
AVFoundation does return an error, so we try again with QTKit but loadState never changes from QTMovieLoadStateLoading (1000):

MediaPlayerPrivateQTKit::updateStates(0x7f9aea5a1f20) - exiting with networkState = 2, readyState = 0
2014-08-02 09:53:13.329 com.apple.WebKit.WebContent.Development[640:32798] NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)
[09:53:13.330] HTTPRequest figHttpRequestDidFailCallback: Network error: domain=kCFErrorDomainCFNetwork, code=-1202, The certificate for this server is invalid. You might be connecting to a server that is pretending to be ?spins.arqspin.com? which could put your confidential information at risk. for https://spins.arqspin.com/2c0rjp53jqhf8/spin.mp4
MediaPlayerPrivateQTKit::loadedRangesChanged(0x7f9aea5a1f20) - loadState = 1000
Comment 3 Michael Holroyd 2014-08-10 21:56:30 PDT
ugh stupid mistake when cleaning up the url. It should be

http://spins.arqspin.com/2c0rjp53jqhf8/spin.mp4

to avoid (irrelevant) SSL issues.
Comment 4 Rob Buis 2018-08-17 04:59:30 PDT
This seems to work fine these days.
Comment 5 Lucas Forschler 2019-02-06 09:19:07 PST
Mass move bugs into the DOM component.
Comment 6 Ahmad Saleem 2022-08-11 13:14:44 PDT
I am not able to reproduce this bug in Safari 15.6 on macOS based on the following JSFiddle (from Comment 0 and replacing URL from Comment 3 because HTTPS one was self-signed).

Link - https://jsfiddle.net/h3bampwz/

In all browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6), it shows "Could not load video" error message in Console, which is expected result.

I am going to mark this as "RESOLVED CONFIGURATION CHANGED". Please reopen if you think it is incorrect testing or this issue is not resolved. Thanks!