add:       if (m_tb_is_main_window) { torbutton_log(3, "Original window closed. Searching for another"); var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var enumerator = wm.getEnumerator("navigator:browser"); while(enumerator.hasMoreElements()) { var win = enumerator.getNext(); if(win != window) { torbutton_log(3, "Found another window"); win.torbutton_do_main_window_startup(); break; } } } 
context: function torbutton_close_window(event) {    torbutton_window_pref_observer.unregister();}
meta: 3444	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/3444/f00a453033376bbf34272e307cdcaa04eb5253d8/torbutton.js/buggy/src/chrome/content/torbutton.js