From 28fc80bba0107075ab371fd0a7634a38891626b2 Mon Sep 17 00:00:00 2001 From: RafaƂ Jagoda Date: Fri, 27 Dec 2013 12:55:02 +0100 Subject: fix($httpBackend): Allow status code 0 from any protocol Android 4.1 stock browser also returns status code 0 when a template is loaded via `http` and the application is cached using appcache. Fixes #1356. Closes #5547. --- src/ng/httpBackend.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ng/httpBackend.js') diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 565e1b12..d2806e3e 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -121,14 +121,14 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc } function completeRequest(callback, status, response, headersString) { - var protocol = urlResolve(url).protocol; - // cancel timeout and subsequent timeout promise resolution timeoutId && $browserDefer.cancel(timeoutId); jsonpDone = xhr = null; - // fix status code for file protocol (it's always 0) - status = (protocol == 'file' && status === 0) ? (response ? 200 : 404) : status; + // fix status code when it is 0 (0 status is undocumented). + // Occurs when accessing file resources. + // On Android 4.1 stock browser it occurs while retrieving files from application cache. + status = (status === 0) ? (response ? 200 : 404) : status; // normalize IE bug (http://bugs.jquery.com/ticket/1450) status = status == 1223 ? 204 : status; -- cgit v1.2.3