New issue
Advanced search Search tips

Issue 718447 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: May 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Distinguish between various xhr 'error' situations

Reported by richb.ha...@gmail.com, May 4 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.29 Safari/537.36

Steps to reproduce the problem:
The XMLHttpRequest() 'onerror' event fires on all kinds of conditions. I am looking for ways to distinguish between states such as:

- net::ERR_INTERNET_DISCONNECTED
- net::ERR_QUIC_PROTOCOL_ERROR
- net::ERR_CONNECTION_TIMED_OUT
- net::ERR_NAME_NOT_RESOLVED
- XMLHttpRequest cannot load https://example.com. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

To reproduce, go to http://testmyinter.net/simpletest.html. This sends xhr requests every 30 seconds, using the params on the page. Open the Console to see error messages

1.  to force ERR_NAME_NOT_RESOLVED, enter http://WontResolve3.14159.com in the top box
2. to force ERR_CONNECTION_TIMED_OUT, enter 'http://123.45.67.89' and 20000 in the second box
3. to force a CORS error, enter a valid host (e.g. http://www.google.com)

What is the expected behavior?
Have the ability to distinguish these cases from Javascript onerror handler

What went wrong?
onerror handler only gets 'error' state, the ProgressEvent (displayed in the Console) doesn't seem to show any further info.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 59.0.3071.29  Channel: n/a
OS Version: OS X 10.12.4
Flash Version: 

Clearly, Chrome knows how to get this info/these disparate states. Is there any way for my Javascript to do it? Thanks!
 

Comment 1 by lgrey@chromium.org, May 4 2017

Components: Blink>Network>XHR
Labels: OS-Linux OS-Windows
> Is there any way for my Javascript to do it?
No, there shouldn't be.
The detailed error information of XHRs (and Fetch API) is intentionally unavailable to JavaScript to prevent security issues (e.g. port scanning in users' local networks).
Ahah! Of course.
I'm disappointed (for my own app's sake) but comforted that someone is thinking deeply about this stuff. Thanks!
Status: WontFix (was: Unconfirmed)
Thanks. Closing given #3.
By curiosity, what are the reasons for not giving detailed information for errors of same-origin requests?

Sign in to add a comment