this.connected = false;  
dojox.cometd.connected = false; 
dojox.cometd.longPollTransport = new function(){	this.connected = false;	this.authToken = null;	this.lastTimestamp = null;	this.lastId = null;	this.backlog = [];	this.check = function(types, version, xdomain){		return ((!xdomain)&&(dojo.indexOf(types, "long-polling") >= 0));	}	this.tunnelInit = function(){		if(this.connected){ return; }		// FIXME: open up the connection here		this.openTunnelWith({			message: dojo.toJson([				{					channel:	"/meta/connect",					clientId:	dojox.cometd.clientId,					connectionType: "long-polling"					// FIXME: auth not passed here!					// "authToken": this.authToken				}			])		});		this.connected = true;	}	this.tunnelCollapse = function(){		if(!this.connected){			// try to restart the tunnel			this.connected = false;			// console.debug("clientId:", dojox.cometd.clientId);						// TODO handle transport specific advice						if(dojox.cometd["advice"]){				if(dojox.cometd.advice["reconnect"]=="none"){					return;				}				            if(	(dojox.cometd.advice["interval"])&&					(dojox.cometd.advice.interval>0) ){					setTimeout(function(){						dojox.cometd.currentTransport._reconnect();					}, dojox.cometd.advice.interval);				}else{					this._reconnect();				}			}else{				this._reconnect();			}	    }	}					this._reconnect = function(){		if(	(dojox.cometd["advice"])&&			(dojox.cometd.advice["reconnect"]=="handshake")		){			dojox.cometd.init(null,dojox.cometd.url);		}else{			this.openTunnelWith({				message: dojo.toJson([					{						channel:	"/meta/reconnect",						connectionType: "long-polling",						clientId:	dojox.cometd.clientId,						timestamp:	this.lastTimestamp,						id:			this.lastId						// FIXME: no authToken provision!					}				])			});		}	}	this.deliver = function(message){		// console.debug(message);		// handle delivery details that this transport particularly cares		// about. Most functions of should be handled by the main cometd object		// with only transport-specific details and state being tracked here.		if(message["timestamp"]){			this.lastTimestamp = message.timestamp;		}		if(message["id"]){			this.lastId = message.id;		}		// check to see if we got a /meta channel message that we care about		if(	(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){						console.debug("cometd connection error:", message.error);						return;					}					this.connected = true;					this.processBacklog();					break;				case "/meta/reconnect":					if(!message.successful){						console.debug("cometd reconnection error:", message.error);						return;					}					this.connected = true;					break;				case "/meta/subscribe":					if(!message.successful){						console.debug("cometd subscription error for channel", message.channel, ":", message.error);						return;					}					dojox.cometd.subscribed(message.channel);					// console.debug(message.channel);					break;			}		}	}	this.openTunnelWith = function(content, url){		// console.debug("openTunnelWith:", content, (url||cometd.url));		var d = dojo.xhrPost({			url: (url||dojox.cometd.url),			content: content,			// handleAs: "json",			handleAs: dojox.cometd.handleAs,			load: dojo.hitch(this, function(data){				// console.debug(evt.responseText);				// console.debug(data);				dojox.cometd.deliver(data);				this.connected = false;				this.tunnelCollapse();			}),			error: function(err){ 				console.debug("tunnel opening failed:", err);				// TODO - follow advice to reconnect or rehandshake?			}		});		this.connected = true;	}	this.processBacklog = function(){		while(this.backlog.length > 0){			this.sendMessage(this.backlog.shift(), true);		}	}	this.sendMessage = function(message, bypassBacklog){		// FIXME: what about auth fields?		if((bypassBacklog)||(this.connected)){			message.clientId = dojox.cometd.clientId;			return dojo.xhrPost({				url: dojox.cometd.url||djConfig["cometdRoot"],				handleAs: dojox.cometd.handleAs,				load: dojo.hitch(dojox.cometd, "deliver"),				content: { 					message: dojo.toJson([ message ]) 				}			});		}else{			this.backlog.push(message);		}	}	this.startup = function(handshakeData){		if(this.connected){ return; }		this.tunnelInit();	}}
5168	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5168/5d75c36c89d7fb7b26381ba75a8f75522b80412f/cometd.js/buggy/_cometd/cometd.js