From 7d84b542395951701a7efd4ea3bc166499a37492 Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Wed, 25 Jul 2018 15:00:07 +0200 Subject: [PATCH] Only allow XHR status 0 for local file:// URLs Since 0 can also be an error situation, limit the amount we okay it. --- src/loader/File.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/loader/File.js b/src/loader/File.js index 343782244..28af29e9d 100644 --- a/src/loader/File.js +++ b/src/loader/File.js @@ -315,7 +315,10 @@ var File = new Class({ */ 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. if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599)