Bug 966579 - Fix intermittent browser_social_chatwindow_resize oranges. r=mixedpuppy, a=sledru
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 06 May 2014 15:25:58 +1000
changeset 192210 3c51501a4e52
parent 192209 ae17ae04609b
child 192211 02e1dd202d67
push id3524
push userryanvm@gmail.com
push date2014-05-06 13:39 +0000
treeherdermozilla-beta@02e1dd202d67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, sledru
bugs966579
milestone30.0
Bug 966579 - Fix intermittent browser_social_chatwindow_resize oranges. r=mixedpuppy, a=sledru
browser/base/content/socialchat.xml
browser/base/content/test/social/head.js
--- a/browser/base/content/socialchat.xml
+++ b/browser/base/content/socialchat.xml
@@ -630,17 +630,17 @@
         }
         // else: achievement unlocked - we are pixel-perfect!
         ]]></body>
       </method>
 
       <method name="handleEvent">
         <parameter name="aEvent"/>
         <body><![CDATA[
-          if (aEvent.type == "resize" && aEvent.eventPhase == aEvent.BUBBLING_PHASE) {
+          if (aEvent.type == "resize") {
             this.resize();
           }
         ]]></body>
       </method>
 
       <method name="_getDragTarget">
         <parameter name="event"/>
         <body><![CDATA[
@@ -677,20 +677,20 @@
 
     </implementation>
 
     <handlers>
       <handler event="popupshown"><![CDATA[
         this.nub.removeAttribute("activity");
       ]]></handler>
       <handler event="load"><![CDATA[
-        window.addEventListener("resize", this);
+        window.addEventListener("resize", this, true);
       ]]></handler>
       <handler event="unload"><![CDATA[
-        window.removeEventListener("resize", this);
+        window.removeEventListener("resize", this, true);
       ]]></handler>
 
       <handler event="dragstart"><![CDATA[
         // chat window dragging is essentially duplicated from tabbrowser.xml
         // to acheive the same visual experience
         let chatbox = this._getDragTarget(event);
         if (!chatbox) {
           return;
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -509,33 +509,29 @@ function resizeWindowToChatAreaWidth(des
   if (window.screen.availWidth - window.outerWidth < delta) {
     info(count + ": skipping this as screen available width is less than necessary");
     executeSoon(function() {
       cb(false);
     });
     return;
   }
   function resize_handler(event) {
-    // for whatever reason, sometimes we get called twice for different event
-    // phases, only handle one of them.
-    if (event.eventPhase != event.AT_TARGET)
-      return;
     // we did resize - but did we get far enough to be able to continue?
     let newSize = window.SocialChatBar.chatbar.getBoundingClientRect().width;
     let sizedOk = widthDeltaCloseEnough(newSize - desired);
     if (!sizedOk)
       return;
-    window.removeEventListener("resize", resize_handler);
+    window.removeEventListener("resize", resize_handler, true);
     info(count + ": resized window width is " + newSize);
     executeSoon(function() {
       cb(sizedOk);
     });
   }
   // Otherwise we request resize and expect a resize event
-  window.addEventListener("resize", resize_handler);
+  window.addEventListener("resize", resize_handler, true);
   window.resizeBy(delta, 0);
 }
 
 function resizeAndCheckWidths(first, second, third, checks, cb) {
   if (checks.length == 0) {
     cb(); // nothing more to check!
     return;
   }