Bug 847094 - fix intermittent chat test failures by waiting for content load event. r=felipe
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 03 Apr 2013 12:17:44 +1100
changeset 137975 6af3167805da577c434871ea205bbb0d75b1ad67
parent 137974 e0d063f04ee215165146043ce66975d7e3fd0cf0
child 137976 63453515a870238be2a706eb6c4cac664d48d6c1
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs847094
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 847094 - fix intermittent chat test failures by waiting for content load event. r=felipe
browser/base/content/socialchat.xml
--- a/browser/base/content/socialchat.xml
+++ b/browser/base/content/socialchat.xml
@@ -22,18 +22,20 @@
 
     <implementation implements="nsIDOMEventListener">
       <constructor><![CDATA[
         let Social = Components.utils.import("resource:///modules/Social.jsm", {}).Social;
         Social.setErrorListener(this.iframe, function(iframe) {
           iframe.webNavigation.loadURI("about:socialerror?mode=compactInfo", null, null, null, null);
         });
         let iframeWindow = this.iframe.contentWindow;
-        this.addEventListener("DOMContentLoaded", function DOMContentLoaded() {
-          this.removeEventListener("DOMContentLoaded", DOMContentLoaded);
+        this.addEventListener("DOMContentLoaded", function DOMContentLoaded(event) {
+          if (event.target != this.iframe.contentDocument)
+            return;
+          this.removeEventListener("DOMContentLoaded", DOMContentLoaded, true);
           this.isActive = !this.minimized;
           // process this._callbacks, then set to null so the chatbox creator
           // knows to make new callbacks immediately.
           for (let callback of this._callbacks) {
             if (callback)
               callback(iframeWindow);
           }
           this._callbacks = null;
@@ -43,17 +45,17 @@
             this.setAttribute("activity", true);
             this.parentNode.updateTitlebar(this);
           }.bind(this);
           iframeWindow.addEventListener("socialChatActivity", chatActivity);
           iframeWindow.addEventListener("unload", function unload() {
             iframeWindow.removeEventListener("unload", unload);
             iframeWindow.removeEventListener("socialChatActivity", chatActivity);
           });
-        });
+        }, true);
         this.setAttribute("src", this.src);
       ]]></constructor>
 
       <field name="iframe" readonly="true">
         document.getAnonymousElementByAttribute(this, "anonid", "iframe");
       </field>
 
       <property name="minimized">