Bug 1150052 - Move up weak reference resolving for garbage collected chatboxes to fix JS errors making Loop cry. r=mixedpuppy, a=lmandel
--- a/browser/base/content/socialchat.xml
+++ b/browser/base/content/socialchat.xml
@@ -550,18 +550,17 @@
<method name="openChat">
<parameter name="aOrigin"/>
<parameter name="aTitle"/>
<parameter name="aURL"/>
<parameter name="aMode"/>
<parameter name="aCallback"/>
<body><![CDATA[
let cb = this.chatboxForURL.get(aURL);
- if (cb) {
- cb = cb.get();
+ if (cb && (cb = cb.get())) {
// 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) {
// Chatbox has already been created, so callback now.
aCallback(cb);