#9687 closed bug (duplicate)
$.getScript() equiv $.ajax() with timeout - timeout elapsed, error() fired, script still executed
Reported by: | anonymous | Owned by: | anonymous |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | ajax | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
BUG: An $.ajax()
-retrieved script is loaded/executed even after the ajax timeout
is expired.
With $.ajax({dataType: 'script', type: 'GET', timeout: 10000}, success: ..., error: ...)
, the target script, if eventually retrieved, is executed even after the timeout has elapsed and the error handler has been executed. (That is long-hand code for $.getScript()
with timeout and error handling added)
It should be easy enough to statically analyze for someone familiar with the $.ajax
code. It is too difficult a situation to create a public test case for this because of the requirements, jsfiddle.net cannot handle it.
The usecase is to connect to a COMET server with $.getScript()
which works well unless a timeout is specified (with the $.ajax({dataType: 'script'})
equivalent call) and the timeout is elapsed. In this case of the timeout elapsing, error()
is run (as expected), firebug shows that the browser continues to wait for a result from the server, and once retrieved, jquery executes it without respect to the "timeout"
or "abort"
status.
I believe the fix needs to be in $.ajax's
function done( status, statusText, responses, headers )
but I'm not familiar enough with this code to attempt the change.
- COMET
A COMET server is a special webserver implementation which holds browser connections open until an event of interest to the client occurs, at which time a payload either of code or data can be returned to the browser. Code is preferred because it avoids the need for a parser on the client-side.
Change History (4)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → ajax |
---|---|
Owner: | set to anonymous |
Priority: | undecided → low |
Status: | new → pending |
Thanks for taking the time to contribute to the jQuery project! Do you perhaps have a running test case anywhere?
Also, please be sure you are testing against the git version of jQuery to ensure the issue still exists.
comment:3 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | pending → closed |
This is a FF bug: when you remove a script tag from the document, the resource is still fetched.
I assume that this happens with any content type, except that normally only the
success
callback is used to process it. With adataType: 'script'
, it can run without being officially invoked by the user code.