I’ve got a (WebRTC) web application runs across three tabs:
- Tab 1 resets the database (deleting any existing data, recreating initial data set)
- Tab 2 acts as a client #1, sending asynchronous requests to the server
- Tab 3 acts as a client #2, sending asynchronous requests to the server
What I’ve noticed is that if I reload Tab 1, one or both of the other tabs close themselves (as in, removed from the list of tabs in Chrome). I asked Chrome developers on IRC and they insist that Chrome will print “Aw snap!” in case of a tab crash but will not remove it from the list of tabs. I am fairly certain my own code isn’t closing the page.
How can I figure out what/who is closing the tab?
I feel retarded.
So, days of investigating this issue I discovered that my code was invoking a function in case of a network error and this function was invoking
close(). Instead of resolving to my class’close()method, it resolved towindow.close()instead. Guess what happened next? 🙂 The tab closed.What made this problem particularly difficult were two Chrome-specific bugs:
In short:
window.close()works when it shouldn’t, and when it fails it does so silently.Anyway, I consider this matter closed. I hope this helps others avoid making the same mistake in the future.