Only allow XHR status 0 for local file:// URLs

Since 0 can also be an error situation, limit the amount we okay it.
This commit is contained in:
Ithamar R. Adema 2018-07-25 15:00:07 +02:00
parent 44f9b10e8c
commit 7d84b54239

View file

@ -315,7 +315,10 @@ var File = new Class({
*/ */
onLoad: function (xhr, event) onLoad: function (xhr, event)
{ {
var success = !(event.target && (event.target.status !== 200 && event.target.status !== 0)); var localFileOk = xhr.responseURL.indexOf('file://') == 0 &&
event.target.status === 0;
var success = !(event.target && event.target.status !== 200) || localFileOk;
// Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599)