Skip to main content

Bug Tracker

Side navigation

#13735 closed bug (notabug)

Opened April 05, 2013 09:49AM UTC

Closed April 05, 2013 10:04AM UTC

Last modified April 05, 2013 01:13PM UTC

getScript() neither calls done nor fail on Bad Gateway

Reported by: dev.coldice@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:
Description

When using getScript

(as in:)

$.getScript(url)
.done(function(script, textStatus) {Logger.log(0, "loaded script:"+url);})
.fail(function(jqxhr, settings, exception) {Logger.log(1, "loading script failed! ("+url+") error:"+jqxhr.status+" exception:"+exception);
});

No function call will be made if the server answers with 502 (Bad Gateway)

Attachments (0)
Change History (5)

Changed April 05, 2013 10:04AM UTC by jaubourg comment:1

resolution: → notabug
status: newclosed

That's because cross-domain requests are not guaranteed to notify errors as documented here (see the error option).

We're doing the best we can using script tag injection under the hood.

Changed April 05, 2013 10:31AM UTC by dev.coldice@gmail.com comment:2

Okay, I don't want to stress this too much, but the problem is a bit different: There is no Cross-Domain Problem (for the Browser), as it loads another script from the same server. When triggering a cross-domain denial, fail is called, giving a 404 (at least in my example), which is fine. The Problem is, that the server returns a 502 Bad Gateway Page, which is even caught in my debugging console, but the getScript function neither calls fail NOR done, where I would expect that at least one of them get's called.

Changed April 05, 2013 10:39AM UTC by jaubourg comment:3

Then we need a minimal test case demonstrating the issue before we re-open this. I guess you cannot provide a jsfiddle or jsbin but could you have a page on one of your servers demonstrating the issue?

Changed April 05, 2013 11:54AM UTC by dev.coldice@gmail.com comment:4

I have set up an example at http://devetopia.com/jtest/jquery_loadtest/test1.html

this test will try to load 3 js files - one from the same server, one from a different origin (which works) and one which gives bad gateway. Responses are logged in the middle box.

I'm quite surprised that the cross origin load works fine.

Changed April 05, 2013 01:13PM UTC by jaubourg comment:5

So the failing script actually __is__ cross-domain. Sometimes errors will be notified (like a 404), other times, however, the browser won't notify the error back up to the javascript (which is the case for the bad gateway).

There's nothing jQuery can do here.