Permalink
Browse files

Suppress SecurityError on processEvents(). #159

  • Loading branch information...
1 parent 1ab03b3 commit 3010e943a5d715d7265004918326754d31a92ab6 @gimite committed Nov 7, 2015
View
Binary file not shown.
View
Binary file not shown.
@@ -150,8 +150,14 @@ public class WebSocketMain extends Sprite implements IWebSocketLogger{
*/
public function processEvents():void {
if (eventQueue.length == 0) return;
- if (!ExternalInterface.call("WebSocket.__onFlashEvent")) {
- setTimeout(processEvents, 500);
+ try {
+ if (!ExternalInterface.call("WebSocket.__onFlashEvent")) {
+ setTimeout(processEvents, 500);
+ }
+ } catch(e:SecurityError){
+ trace(
+ "Caught SecurityError when trying to processEvents. " +
+ "This may happen when the window is going to be closed.");
}
}

0 comments on commit 3010e94

Please sign in to comment.