cloudtrends / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
1 stars 1 forks source link

HandleBeforeResourceLoad doesn't return http statuses #168

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
HandleBeforeResourceLoad and may be SchemeHandlers doesn't returns HTTP status, 
text and headers. It's fully unusable with XMLHttpRequest, 'cause it returns 
zero status, that threats as error.

Original issue reported on code.google.com by fdd...@gmail.com on 11 Jan 2011 at 8:00

GoogleCodeExporter commented 9 years ago
XMLHttpRequest works just fine with HandleBeforeResourceLoad -- all of the 
request information is stored in the |request| parameter.  You don't need to 
return an HTTP status code. Setting the |resourceStream| and |mimeType| 
parameters and returning RV_CONTINUE explicitly indicates success in handling 
the request. Returning RV_HANDLED cancels the request.

Original comment by magreenb...@gmail.com on 11 Jan 2011 at 5:11

GoogleCodeExporter commented 9 years ago
Request it is request, but response is absent.
I return response body and mime type correctly.
Then JS code got my full response body in XHR.
So we have follow:
XHR.responseText contains stream returned by HandleBeforeResourceLoad.
XHR.status=0 - it is HTTP status, zero means error in XMLHttpRequest.
XHR.statusText="" - empty string also signal error.

Original comment by fdd...@gmail.com on 12 Jan 2011 at 5:57

GoogleCodeExporter commented 9 years ago
Uff.
Sorry this issue a completely not a bug.
XHR works fine with HandleBeforeResourceLoad. (But many XHR wrappers as jquery 
listen only onreadystatechange and check status, but for chrome will be better 
to listen onload event...).

Thanks for you help, and great project!

Original comment by fdd...@gmail.com on 14 Jan 2011 at 2:02

GoogleCodeExporter commented 9 years ago
Definetely a bug: the XHR object has status & statusText fields, which js 
libraries rely on.
At the very least a valid status value should be placed in status, and 0 isn't 
a valid status value, if success is assumed, then the value should be set to 
200 to be compatible with js libraries and frameworks.

Original comment by zar...@gmail.com on 30 Mar 2011 at 12:20

GoogleCodeExporter commented 9 years ago

Original comment by magreenb...@gmail.com on 30 Mar 2011 at 1:13