Skip to main content

Bug Tracker

Side navigation

#8605 closed bug (patchwelcome)

Opened March 23, 2011 11:53AM UTC

Closed March 24, 2011 01:44PM UTC

Last modified November 14, 2013 02:01AM UTC

Ajax GET of XML from local cache gives false error

Reported by: jwalton@cix.co.uk Owned by: jwalton@cix.co.uk
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

Environment is Windows Safari 5.0.4 on Windows 7 (64bit O/S). This uses webkit browser engine (AppleWebKit/533.20.25).

I have an HTML5 application that uses the HTML5 local cache feature.

If I use Ajax GET to fetch XML files that has been cached, it returns false error (code: 0, message "error").

Problem seems to be due to raw GET returning a "status" of 0, which is not tested for within the jQuery code. My workaround (not a solution!) is to change line 6542 from

if ( status >= 200 && status < 300 || status === 304 ) {

to:

if ( status >= 200 && status < 300 || status === 304 || status === 0) {

John Walton

Attachments (0)
Change History (3)

Changed March 23, 2011 04:03PM UTC by addyosmani comment:1

owner: → jwalton@cix.co.uk
status: newpending

Thanks for submitting a ticket to the jQuery Bug Tracker. In order to assist you further, could you please also submit a reduced test case on http://jsFiddle.net that reproduces the issue you are experiencing?

Please also try testing using jQuery-GIT to see if the issue submitted persists.

Changed March 24, 2011 01:44PM UTC by jaubourg comment:2

_comment0: @jwalton: \ \ you're right when you state your workaround is not a solution and so far, we've found none :( \ \ Files cached into the HTML5 local cache always issue a 0 status code just like a network error. While it is sometimes possible to somehow circumvent this behaviour when it comes to local file systems (since we have a specific protocol to deal with and can use this info to take specific actions), we found no general yet non-breaking solution for the HTML5 local cache. \ \ If someone finds a solution that won't make it impossible to detect errors for spec-compliant requests (ie. returning a meaningful status code and 0 in case on a network error) then we'll be happy to review it. \ \ All I can suggest is that you open a bug report against Safari/Webkit (if none exists already).1300974340119386
component: unfiledajax
resolution: → patchwelcome
status: pendingclosed

@jwalton:

you're right when you state your workaround is not a solution and so far, we've found none :(

Files cached into the HTML5 local cache always issue a 0 status code just like a network error. While it is sometimes possible to somehow circumvent this behaviour when it comes to local file systems (since we have a specific protocol to deal with and can use this info to take specific actions), we found no general yet non-breaking solution for the HTML5 local cache.

If someone finds a solution that won't make it impossible to detect errors for spec-compliant requests (ie. returning a meaningful status code and 0 in case of a network error) then we'll be happy to review it.

All I can suggest is that you open a bug report against Safari/Webkit (if none exists already).

Changed November 14, 2013 02:01AM UTC by Dave Methvin comment:3

ajax: Fix #14207. file protocol returns status 0, see #8605.

Changeset: dce2edb3a615f9de158607c9f8be83809373940e