Adding error handling to jsonp has some issues with the attached patch. These are the ones I've found so far:
Opera seems to load and execute the script synchronously so the timeout can't happen.
Firefox executes the code if it is loaded regardless of whether the timeout happens. So if a script takes 10 seconds to load and a timeout of 1 second is set. The timeout happens and reports failure to the functions. The script is removed from the document at that point, but 9 seconds later it will run. This is the only browser with this issue.
IE6/7 reports success on DNS failures and 404 document not found. I haven't found a way to figure out if it failed or not in those instances.
Safari reports success on 404 document not found (interestingly it reports failure on bad DNS unlike IE).
IMO this is an improvement over the existing code. I don't think it breaks anything that works currently, but rather fixes some of the previously failing cases. Unfortunately the bad cases aren't uniform across browsers so what works for some doesn't for others. I'm not sure which is better no error handling or inconsistent error handling.
Any ideas are welcome.