Thanks Harbs. Yeah I used URLStream and it was enough to get what I needed. However I was just wondering if that lack of handle scenario with CORS is not a Bug which should be maybe fixed.
Piotr Zarzycki On Mon, 22 Jul 2024 at 22:02, Harbs <harbs.li...@gmail.com> wrote: > FWIW I always use URLBinaryLoader which handles all errors well. > > > On Jul 22, 2024, at 1:31 PM, Piotr Zarzycki <piotrzarzyck...@gmail.com> > wrote: > > > > in Q2 it suppose to be readyState == 4 - My mistake > > > > pon., 22 lip 2024 o 12:16 Piotr Zarzycki <piotrzarzyck...@gmail.com> > > napisaĆ(a): > > > >> Hello, > >> > >> I have case in my application where I'm trying load some url, which > >> reports CORS issue. I would like to know thanks to Loader that I have > some > >> errors, unfortunately we are not reporting such cases trough our events. > >> > >> At the end of loading we have following state of URLLoader: > >> > >> 1) This event has been dispatcher before loading is ended -> > >> element.onreadystatechange [1] > >> This readyState == 4 [2] and status == 0 [3] > >> 2) Next we are getting onloadend and end up here [5] in our handler > >> > >> //here e.type is equal to 'loadended', so we won't reach COMPLETE > >> > >> if (e.type == 'load') > >> dispatchEvent(HTTPConstants.COMPLETE); > >> > >> Q1: Do you think we should notify user about completion when e.type is > >> 'loadended' ? > >> Q2: Do you think if onreadystatechange has been handled and we have > status > >> == 0 and readyState == 0 should we dispatch -> > >> dispatchEvent(HTTPConstants.IO_ERROR); ? Doc is saying this is server > error > >> [6] > >> > >> [1] > >> > https://github.com/apache/royale-asjs/blob/f547da6cbe62e878b54690995b3e0dce18b31b1f/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLLoader.as#L209 > >> [2][3] > >> > https://github.com/apache/royale-asjs/blob/f547da6cbe62e878b54690995b3e0dce18b31b1f/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLLoader.as#L342 > >> [4] > >> > https://github.com/apache/royale-asjs/blob/f547da6cbe62e878b54690995b3e0dce18b31b1f/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLLoader.as#L213C29-L213C38 > >> [5] > >> > https://github.com/apache/royale-asjs/blob/f547da6cbe62e878b54690995b3e0dce18b31b1f/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLLoader.as#L372 > >> [6] > https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/status > >> > >> Thanks, > >> -- > >> > >> Piotr Zarzycki > >> > > > > > > -- > > > > Piotr Zarzycki > >