72f4ba51b784673a15a1e89d8d9f49d1

This code crashes Firefox 3, badly: http://www.freeformroleplay.net/standalone/chat

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
this.getHttpRequest(identifier).onreadystatechange = function() {
	try {
		ajaxChat.handleResponse(identifier);
	} catch(e) {
		try {
			clearTimeout(ajaxChat.timer);
		} catch(e) {
			//alert(e);
		}
		try {
			if(data) {
				ajaxChat.addChatBotMessageToChatList('/error ConnectionTimeout');
				ajaxChat.updateChatlistView();
			}
		} catch(e) {
			//alert(e);
		}
		try {				
			ajaxChat.timer = setTimeout('ajaxChat.updateChat(null);', ajaxChat.timerRate);
		} catch(e) {
			//alert(e);
		}
	}
};

Refactorings

No refactoring yet !

98c852e2d9b26249745ea92c72964d3f

GateKiller

July 23, 2008, July 23, 2008 08:35, permalink

No rating. Login to rate!

Does it work if you remove all the try and catch statements?

1
2
3
this.getHttpRequest(identifier).onreadystatechange = function() {
	ajaxChat.handleResponse(identifier);
};

Your refactoring





Format Copy from initial code

or Cancel