rem:  var comm = MochiKit.Async.sendXMLHttpRequest(req).addCallbacks(handler, bind(d.errback, d)); 
add:    var comm = MochiKit.Async.sendXMLHttpRequest(req); if (async) { comm.addCallbacks(handler, bind(d.errback, d)); } else { if (req.status == 200 || req.status == 304) { handler(req); } else { d.errback(new Error("Request failed:" + req.status)); } } 
context: Freja.AssetManager.loadAsset = function(url, preventCaching) {	var match = /^(file:\/\/.*\/)([^/]*)$/.exec(window.location.href);	if (match) {		url = match[1] + url; // local	}	var d = new MochiKit.Async.Deferred();	var handler = function(transport) {		try {			if (transport.responseText == "") {				throw new Error("Empty response.");			}			if (transport.responseXML.xml == "") {				// The server doesn't reply with Content-Type: text/xml				// this will happen if the file is loaded locally (through file://)				var document = (new DOMParser()).parseFromString(transport.responseText, "text/xml");			} else {				var document = transport.responseXML;			}		} catch (ex) {			d.errback(ex);		}		d.callback(document);	}	try {		var req = new XMLHttpRequest();		if (preventCaching && Freja.AssetManager.HTTP_METHOD_TUNNEL) {			req.open("POST", url, Freja.AssetManager.HTTP_REQUEST_TYPE == "async");			req.setRequestHeader(Freja.AssetManager.HTTP_METHOD_TUNNEL, "GET");			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");		} else {			req.open("GET", url, Freja.AssetManager.HTTP_REQUEST_TYPE == "async");		}		if (Freja.AssetManager.USERNAME && Freja.AssetManager.PASSWORD) {			var auth = "Basic " + Freja.Base64.encode(Freja.AssetManager.USERNAME + ":" + Freja.AssetManager.PASSWORD);			req.setRequestHeader("Authorization", auth);		}//		req.open("GET", url, this.HTTP_REQUEST_TYPE == "async");		var comm = MochiKit.Async.sendXMLHttpRequest(req).addCallbacks(handler, bind(d.errback, d));	} catch (ex) {		d.errback(ex);	}	return d;}
meta: 8607	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8607/ad067b3f5d648d6df90ec6fb2b79f0027612a307/Freja.js/buggy/trunk/lib/Freja.js