Skip to main content

Bug Tracker

Side navigation

#8125 closed bug (fixed)

Opened February 01, 2011 02:12PM UTC

Closed February 01, 2011 04:22PM UTC

Last modified February 21, 2011 06:42PM UTC

jQuery 1.5 Local File AJAX requests are "not successful" despite working fine in 1.4.4

Reported by: samuel@oriontransfer.org Owned by: jaubourg
Priority: high Milestone: 1.5.1
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

Loading file:// results in the error callback.

At line 7251, I put a breakpoint, here is the contents of xhr:

XMLHttpRequest
onabort: null
onerror: null
onload: null
onloadstart: null
onprogress: null
onreadystatechange: function () {}
readyState: 4
responseText: "//	This file is part of the "jQuery.Syntax" project, and is licensed under the GNU AGPLv3. //	Copyri…"
responseXML: null
status: 0
statusText: ""
upload: XMLHttpRequestUpload
withCredentials: false
__proto__: XMLHttpRequestPrototype

Despite being successful, on line 6430, because status is 0, the request is considered failed.

Attachments (0)
Change History (14)

Changed February 01, 2011 02:18PM UTC by anonymous comment:1

N.B. running exactly the same code from a web server results in the correct code being executed, I guess because status will be 200.

Changed February 01, 2011 02:19PM UTC by anonymous comment:2

N.B. I've verified this problem with both Safari 3 and FF 3.6.12

Changed February 01, 2011 02:20PM UTC by anonymous comment:3

Sorry, I meant Safari 5 ... getting old :)

Changed February 01, 2011 02:35PM UTC by rwaldron comment:4

component: unfiledajax
owner: → jaubourg
priority: undecidedhigh
status: newassigned

Changed February 01, 2011 02:40PM UTC by anonymous comment:5

I just double checked and yes, 1.4.4 works fine in the same situation.

Changed February 01, 2011 04:19PM UTC by jaubourg comment:6

milestone: 1.next1.5.1

Changed February 01, 2011 04:22PM UTC by jaubourg comment:7

resolution: → fixed
status: assignedclosed

Fixes #8125. Status is set to 200 for requests with status 0 when location.protocol if "file:". Added test/localfile.html to control it works.

Changeset: cb85da7b62e74e7339ed652ade209aaffbd0c15b

Changed February 01, 2011 05:32PM UTC by danheberden comment:8

#8127 is a duplicate of this ticket.

Changed February 01, 2011 08:59PM UTC by jitter comment:9

description: Loading file:// results in the error callback. \ \ At line 7251, I put a breakpoint, here is the contents of xhr: \ \ XMLHttpRequest \ onabort: null \ onerror: null \ onload: null \ onloadstart: null \ onprogress: null \ onreadystatechange: function () {} \ readyState: 4 \ responseText: "// This file is part of the "jQuery.Syntax" project, and is licensed under the GNU AGPLv3. // Copyri…" \ responseXML: null \ status: 0 \ statusText: "" \ upload: XMLHttpRequestUpload \ withCredentials: false \ __proto__: XMLHttpRequestPrototype \ \ Despite being successful, on line 6430, because status is 0, the request is considered failed. \ Loading file:// results in the error callback. \ \ At line 7251, I put a breakpoint, here is the contents of xhr: \ {{{ \ XMLHttpRequest \ onabort: null \ onerror: null \ onload: null \ onloadstart: null \ onprogress: null \ onreadystatechange: function () {} \ readyState: 4 \ responseText: "// This file is part of the "jQuery.Syntax" project, and is licensed under the GNU AGPLv3. // Copyri…" \ responseXML: null \ status: 0 \ statusText: "" \ upload: XMLHttpRequestUpload \ withCredentials: false \ __proto__: XMLHttpRequestPrototype \ }}} \ Despite being successful, on line 6430, because status is 0, the request is considered failed. \

Changed February 03, 2011 05:37PM UTC by rwaldron comment:10

#8166 is a duplicate of this ticket.

Changed February 04, 2011 12:26AM UTC by jitter comment:11

#8154 is a duplicate of this ticket.

Changed February 21, 2011 06:25AM UTC by Yun Mo comment:12

Another problem occurs when inserting html code by ajaxing from local file as follows though no problem occurs with http.

Node cannot be inserted at the specified point in the hierarchy" code: "3

error source line: [Break On This Error] fragment.appendChild( ret[i] );

jquery-git.js (line 5605)

Yun

Changed February 21, 2011 12:38PM UTC by jitter comment:13

Replying to [comment:12 Yun Mo]:

Another problem occurs when inserting html code by ajaxing from local file as follows though no problem occurs with http. Node cannot be inserted at the specified point in the hierarchy" code: "3 error source line: [Break On This Error] fragment.appendChild( ret[i] ); jquery-git.js (line 5605) Yun

Please provide a reduced test case, which reproduces the issue you are experiencing. Also make sure to read the link given below, in order to provide a most useful bug report.


How to report bugs

Changed February 21, 2011 06:42PM UTC by jitter comment:14

#8342 is a duplicate of this ticket.