Bug Tracker

Modify

Ticket #8605 (closed bug: patchwelcome)

Opened 2 years ago

Last modified 2 years ago

Ajax GET of XML from local cache gives false error

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

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

Change History

comment:1 Changed 2 years ago by addyosmani

  • Owner set to jwalton@…
  • Status changed from new to pending

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.

comment:2 Changed 2 years ago by jaubourg

  • Status changed from pending to closed
  • Resolution set to patchwelcome
  • Component changed from unfiled to ajax

@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).

Last edited 2 years ago by jaubourg (previous) (diff)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.