From d8e222083ac364e9e95317fd1a50cf1333557eec Mon Sep 17 00:00:00 2001 From: Mike de Boer Date: Fri, 21 Nov 2014 15:47:56 +0100 Subject: [PATCH] Bug 1100284: also support detached chat windows in duplicate chat window handling. r=mixedpuppy --- browser/base/content/socialchat.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/browser/base/content/socialchat.xml b/browser/base/content/socialchat.xml index 63808225ab4..d53427adb45 100644 --- a/browser/base/content/socialchat.xml +++ b/browser/base/content/socialchat.xml @@ -193,6 +193,9 @@ () => { this.swapDocShells(cb); + chatbar.focus(); + this.close(); + // chatboxForURL is a map of URL -> chatbox used to avoid opening // duplicate chat windows. Ensure reattached chat windows aren't // registered with about:blank as their URL, otherwise reattaching @@ -200,8 +203,6 @@ chatbar.chatboxForURL.delete("about:blank"); chatbar.chatboxForURL.set(this.src, Cu.getWeakReference(cb)); - chatbar.focus(); - this.close(); deferred.resolve(cb); } ); @@ -527,7 +528,9 @@ let cb = this.chatboxForURL.get(aURL); if (cb) { cb = cb.get(); - if (cb.parentNode) { + // A chatbox is still alive to us when it's parented and still has + // content. + if (cb.parentNode && cb.contentWindow) { this.showChat(cb, aMode); if (aCallback) { if (cb._callbacks == null) { @@ -646,6 +649,7 @@