In Gmail you can pop up the chat window from an already opened tabbed window. If you try to close the first opened tabbed window from which the pop up was triggered, the browsers notifies you that the pop up window will also be closed. How does that earlier/parent window also close the pop up window?
Share
So Gmail probably does something like (this is pseudo-code):
See this fiddle example: http://jsfiddle.net/maniator/4kKdM/