id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,blocking,blockedby
5059,No error handling for cross site ajax,ooktay,,"For cross site ajax, when remote site is down error handlers are not called.
Here is my mod for error handling:

//-------------------START line:3473 in v1.3.2

		// If we're requesting a remote document
		// and trying to load JSON or Script with a GET
		if ( s.dataType == ""script"" && type == ""GET"" && parts
			&& ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){

			var head = document.getElementsByTagName(""head"")[0];
			var script = document.createElement(""script"");
			script.src = s.url;
			if (s.scriptCharset)
				script.charset = s.scriptCharset;

			// Error handling on firefox (DOM standard)
			script.onerror = function(){
				jQuery.handleError(s, null, ""error"");
				complete();
			};

			// Handle Script loading
			if ( !jsonp ) {
				var done = false;
				// Attach handlers for all browsers
				script.onload = script.onreadystatechange = function(){
					if ( !done && ( !this.readyState ||
							         this.readyState == ""loaded"" || this.readyState == ""complete"") ) {
						done = true;
						// Note that IE will call success even when connection is down
						// We can't do anything about it since IE doesn't have a way to tell
						success();
						complete();

						// Handle memory leak in IE
						script.onload = script.onreadystatechange = null;
						head.removeChild( script );
					}
				};
			} else {
				script.onreadystatechange = function(){
					// Error handling for IE: 
					// if connection is down, handler is not run, hence window[ jsonp ] is still there
					if ( !done && (this.readyState == ""loaded"" || this.readyState == ""complete"") 
							&& window[ jsonp ] ) {
						done = true;

						// Handle memory leak in IE
						script.onreadystatechange = null;
						window[ jsonp ] = undefined;
						try{ delete window[ jsonp ]; } catch(e){}
						if ( head )
							head.removeChild( script );

						jQuery.handleError(s, null, ""error"");
						complete();
					}
				};
			}

			// Use insertBefore instead of appendChild  to circumvent an IE6 bug. 
		 	// This arises when a base node is used (#2709 and #4378). 
		 	head.insertBefore( script, head.firstChild ); 

			// We handle everything using the script element injection
			return undefined;
		}
//-------------------END
",bug,closed,major,1.4,ajax,1.3.2,invalid,,,,
