return; 
return null; 
dojox.cometd = new function(){		// cometd states: 	this.DISCONNECTED="DISCONNECTED";	// _initialized==false 	&& _connected==false 	this.CONNECTING="CONNECTING";		// _initialized==true	&& _connected==false (handshake sent) 	this.CONNECTED="CONNECTED";		// _initialized==true	&& _connected==true (first successful connect) 	this.DISCONNECTING="DISCONNECING";	// _initialized==false 	&& _connected==true (disconnect sent) 		this._initialized = false;	this._connected = false;	this._polling = false;	this.connectionTypes = new dojo.AdapterRegistry(true);	this.version = "1.0";	this.minimumVersion = "0.9";	this.clientId = null;	this.messageId = 0;	this.batch=0;	this._isXD = false;	this.handshakeReturn = null;	this.currentTransport = null;	this.url = null;	this.lastMessage = null;	this._messageQ = [];	this.handleAs = "json-comment-optional";	this._advice;	this._maxInterval = 30000;	this._backoffInterval = 1000;	this._deferredSubscribes = {};	this._deferredUnsubscribes = {};	this._subscriptions = [];	this._extendInList = [];	// List of functions invoked before delivering messages	this._extendOutList = [];	// List of functions invoked before sending messages	this.state = function() {		return this._initialized?(this._connected?this.CONNECTED:this.CONNECTING):(this._connected?this.DISCONNECTING:this.DISCONNECTED);	}	this.init = function(	/*String*/	root,				/*Object|null */ props,				/*Object|null */ bargs){	// return: dojo.Deferred		//	summary:		//		Initialize the cometd implementation of the Bayeux protocol		//	description:		//		Initialize the cometd implementation of the Bayeux protocol by		//		sending a handshake message. The cometd state will be changed to CONNECTING		//		until a handshake response is received and the first successful connect message		//		has returned.		//		The protocol state changes may be monitored		//		by subscribing to the dojo topic "/cometd/meta" where events are		//		published in the form {cometd:this,action:"handshake",successful:true,state:this.state()}		//	root:		//		The URL of the cometd server. If the root is absolute, the host		//		is examined to determine if xd transport is needed. Otherwise the		//		same domain is assumed.		//	props:		//		An optional object that is used as the basis of the handshake message		//	bargs:		//		An optional object of bind args mixed in with the send of the handshake		//	example:		//	|	dojox.cometd.init("/cometd");		//	|	dojox.cometd.init("http://xdHost/cometd",{ext:{user:"fred",pwd:"secret"}});		// FIXME: if the root isn't from the same host, we should automatically		// try to select an XD-capable transport		props = props||{};		// go ask the short bus server what we can support		props.version = this.version;		props.minimumVersion = this.minimumVersion;		props.channel = "/meta/handshake";		props.id = ""+this.messageId++;		this.url = root||djConfig["cometdRoot"];		if(!this.url){			console.debug("no cometd root specified in djConfig and no root passed");			return;		}		// Are we x-domain? borrowed from dojo.uri.Uri in lieu of fixed host and port properties		var regexp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";		var r = (""+window.location).match(new RegExp(regexp));		if(r[4]){			var tmp = r[4].split(":");			var thisHost = tmp[0];			var thisPort = tmp[1]||"80"; // FIXME: match 443			r = this.url.match(new RegExp(regexp));			if(r[4]){				tmp = r[4].split(":");				var urlHost = tmp[0];				var urlPort = tmp[1]||"80";				this._isXD = ((urlHost != thisHost)||(urlPort != thisPort));			}		}		if(!this._isXD){			if(props.ext){				if(props.ext["json-comment-filtered"]!==true && props.ext["json-comment-filtered"]!==false){					props.ext["json-comment-filtered"] = true;				}			}else{				props.ext = { "json-comment-filtered": true };			}		}		props=this._extendOut(props);		var bindArgs = {			url: this.url,			handleAs: this.handleAs,			content: { "message": dojo.toJson([props]) },			load: dojo.hitch(this,function(msg){				this._finishInit(msg);			}),			error: dojo.hitch(this,function(e){				console.debug("handshake error!:",e);				this._finishInit([{}]);			})		};		if(bargs){			dojo.mixin(bindArgs, bargs);		}		this._props=props;		for(var tname in this._subscriptions){			for(var sub in this._subscriptions[tname]){				if(this._subscriptions[tname][sub].topic){		 			dojo.unsubscribe(this._subscriptions[tname][sub].topic);				}			}		}		this._messageQ = [];		this._subscriptions = [];		this._initialized=true;		this.batch=0;		this.startBatch();				var r;		// if xdomain, then we assume jsonp for handshake		if(this._isXD){			bindArgs.callbackParamName="jsonp";			r= dojo.io.script.get(bindArgs);		} else			r = dojo.xhrPost(bindArgs);		dojo.publish("/cometd/meta", [{cometd:this,action:"handshake",successful:true,state:this.state()}]);		return r;	}			this.publish = function(/*String*/channel, /*Object */data, /*Object|null */properties){		// summary:		//		publishes the passed message to the cometd server for delivery		//		on the specified topic		// channel:		//		the destination channel for the message		// data:		//		a JSON object containing the message "payload"		// properties:		//		Optional. Other meta-data to be mixed into the top-level of the		//		message		var message = {			data: data,			channel: channel		};		if(properties){			dojo.mixin(message, properties);		}		this._sendMessage(message);	}		this.subscribe = function(	/*String */	channel,					/*Object */	objOrFunc,					/*String */	funcName){ // return: dojo.Deferred		// summary:		//		inform the server of this client's interest in channel		// channel:		//		name of the cometd channel to subscribe to		// objOrFunc:		//		an object scope for funcName or the name or reference to a		//		function to be called when messages are delivered to the		//		channel		// funcName:		//		the second half of the objOrFunc/funcName pair for identifying		//		a callback function to notifiy upon channel message delivery		if(objOrFunc){			var tname = "/cometd"+channel;			var subs=this._subscriptions[tname];			if(!subs || subs.length==0){				subs=[];				this._sendMessage({					channel: "/meta/subscribe",					subscription: channel				});								var _ds = this._deferredSubscribes;				_ds[channel] = new dojo.Deferred();				if(_ds[channel]){					_ds[channel].cancel();					delete _ds[channel];				}			}						for (var i in subs){				if (subs[i].objOrFunc===objOrFunc&&(!subs[i].funcName&&!funcName||subs[i].funcName==funcName))					return;			}						var topic = dojo.subscribe(tname, objOrFunc, funcName);			subs.push({ 				topic: topic, 				objOrFunc: objOrFunc, 				funcName: funcName			});			this._subscriptions[tname] =subs;		}		return this._deferredSubscribes[channel];	}	this.unsubscribe = function(	/*string*/	channel,					/*object|null*/ objOrFunc,					/*string|null*/ funcName){		// summary:		//		inform the server of this client's disinterest in channel		// channel:		//		name of the cometd channel to unsubscribe from		// objOrFunc:		//		an object scope for funcName or the name or reference to a		//		function to be called when messages are delivered to the		//		channel. If null then all subscribers to the channel are unsubscribed.		// funcName:		//		the second half of the objOrFunc/funcName pair for identifying		//		a callback function to notifiy upon channel message delivery				var tname = "/cometd"+channel;		var subs=this._subscriptions[tname];		if(!subs || subs.length==0){			return;		}		var s=0;		for(var i in subs){			var sb=subs[i];			if( (!objOrFunc) ||				(					sb.objOrFunc===objOrFunc &&					(!sb.funcName && !funcName || sb.funcName==funcName)				)			){				dojo.unsubscribe(subs[i].topic);				delete subs[i];			}else{				s++;			}		}				if(s==0){			delete this._subscriptions[tname];			this._sendMessage({				channel: "/meta/unsubscribe",				subscription: channel			});			this._deferredUnsubscribes[channel] = new dojo.Deferred();			if (this._deferredSubscribes[channel]){				this._deferredSubscribes[channel].cancel();				delete this._deferredSubscribes[channel];			}		}		return this._deferredUnsubscribes[channel];	}			this.disconnect = function(){		//	summary:		//		Disconnect from the server.		//	description:		//		Disconnect from the server by sending a disconnect message		//	example:		//	|	dojox.cometd.disconnect();		for(var tname in this._subscriptions){			for(var sub in this._subscriptions[tname]){				if(this._subscriptions[tname][sub].topic){					dojo.unsubscribe(this._subscriptions[tname][sub].topic);				}			}		}		this._subscriptions = [];		this._messageQ = [];		if(this._initialized && this.currentTransport){			this._initialized=false;			this.currentTransport.disconnect();		}		if(!this._polling) {			this._connected=false;			dojo.publish("/cometd/meta", [{cometd:this,action:"connect",successful:false,state:this.state()}]);		}		this._initialized=false;		dojo.publish("/cometd/meta", [{cometd:this,action:"disconnect",successful:true,state:this.state()}]);	}		// public extension points		this.subscribed = function(	/*String*/channel, /*Object*/message){ }	this.unsubscribed = function(/*String*/channel, /*Object*/message){ }	// private methods (TODO name all with leading _)	this.tunnelInit = function(childLocation, childDomain){		// placeholder - replaced by _finishInit	}		this.tunnelCollapse = function(){		// placeholder - replaced by _finishInit	}		this._backoff = function(){		if(!this._advice || !this._advice.interval){			this._advice={reconnect:"retry",interval:0}; // TODO Is this good advice?		}		if(this._advice.interval<this._maxInterval){			this._advice.interval+=this._backoffInterval;		}	}	this._finishInit = function(data){		//	summary:		//		Handle the handshake return from the server and initialize		//		connection if all is OK		data = data[0];		this.handshakeReturn = data;				// remember any advice		if(data["advice"]){			this._advice = data.advice;		}		var successful=data.successful?data.successful:false;				// check version		if(data.version < this.minimumVersion){			console.debug("cometd protocol version mismatch. We wanted", this.minimumVersion, "but got", data.version);			successful=false;			this._advice.reconnect="none";		}				// If all OK		if(successful){			// pick a transport			this.currentTransport = this.connectionTypes.match(				data.supportedConnectionTypes,				data.version,				this._isXD			);			// initialize the transport			this.currentTransport._cometd = this;			this.currentTransport.version = data.version;			this.clientId = data.clientId;			this.tunnelInit = dojo.hitch(this.currentTransport, "tunnelInit");			this.tunnelCollapse = dojo.hitch(this.currentTransport, "tunnelCollapse");			this.currentTransport.startup(data);		}		dojo.publish("/cometd/meta", [{cometd:this,action:"handshook",successful:successful,state:this.state()}]);		// If there is a problem		if(!successful){			console.debug("cometd init failed");			this.backoff();			// follow advice			if(this._advice && this._advice["reconnect"]=="none"){				console.debug("cometd reconnect: none");			}else if(this._advice && this._advice["interval"] && this._advice.interval>0 ){				setTimeout(					dojo.hitch(this, function(){ this.init(cometd.url,this._props); }),					this._advice.interval				);			}else{				this.init(this.url,this._props);			}		}	}	this._extendIn = function(message){		// Handle extensions for inbound messages		var m=message;		dojo.forEach(dojox.cometd._extendInList, function(f){			var n=f(m);			if(n)m=n;		});		return m;	}	this._extendOut= function(message){		// Handle extensions for inbound messages		var m=message;		dojo.forEach(dojox.cometd._extendOutList, function(f){			var n=f(m);			if(n)m=n;		});		return m;	}	this.deliver = function(messages){		dojo.forEach(messages, this._deliver, this);		return messages;	}	this._deliver = function(message){		// dipatch events along the specified path				message=this._extendIn(message);		if(!message["channel"]){			if(message["success"] !== true){				console.debug("cometd error: no channel for message!", message);				return;			}		}		this.lastMessage = message;		if(message.advice){			this._advice = message.advice; // TODO maybe merge?		}		// check to see if we got a /meta channel message that we care about		if(	(message["channel"]) &&			(message.channel.length > 5)&&			(message.channel.substr(0, 5) == "/meta")){			// check for various meta topic actions that we need to respond to			switch(message.channel){				case "/meta/connect":					if(message.successful && !this._connected){						this._connected = this._initialized;						this.endBatch();					} else if(!this._initialized){						this._connected = false; // finish disconnect					}					dojo.publish("/cometd/meta",[{cometd:this,action:"connect",successful:message.successful,state:this.state()}]);					break;				case "/meta/subscribe":					var deferred = this._deferredSubscribes[message.subscription];					if(!message.successful){						if(deferred){							deferred.errback(new Error(message.error));						}						return;					}					dojox.cometd.subscribed(message.subscription, message);					if(deferred){						deferred.callback(true);					}					break;				case "/meta/unsubscribe":					var deferred = this._deferredUnsubscribes[message.subscription];					if(!message.successful){						if(deferred){							deferred.errback(new Error(message.error));						}						return;					}					this.unsubscribed(message.subscription, message);					if(deferred){						deferred.callback(true);					}					break;			}		}				// send the message down for processing by the transport		this.currentTransport.deliver(message);		if(message.data){			// dispatch the message to any locally subscribed listeners			try {				var tname = "/cometd"+message.channel;				dojo.publish(tname, [ message ]);			}catch(e){				console.debug(e);			}		}	}	this._sendMessage = function(/* object */ message){		if(this.currentTransport && this._connected && this.batch==0){			return this.currentTransport.sendMessages([message]);		}		else{			this._messageQ.push(message);		}	}	this.startBatch = function(){		this.batch++;	}	this.endBatch = function(){		if(--this.batch <= 0 && this.currentTransport && this._connected){			this.batch=0;			var messages=this._messageQ;			this._messageQ=[];			if(messages.length>0){				this.currentTransport.sendMessages(messages);			}		}	}		this._onUnload = function(){		// make this the last of the onUnload method		dojo.addOnUnload(dojox.cometd,"disconnect");	}}
5168	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5168/4cc04beeb7438f9f144821df99ae4b372d6f3594/_base.js/buggy/cometd/_base.js