Bug 607566 - Test for bug 595930 takes too long to run [r=ian, a=beltzner]
authorRaymond Lee <raymond@raysquare.com>
Wed, 24 Nov 2010 02:49:50 +0800
changeset 58274 dcc94ba87c5cb46fe3cf8f02b571c120f1b47c3d
parent 58273 b1eda2bd8812b88b311a746e177a1268c217027d
child 58275 d6e9599f18bf28431add961995fd97ebb7e9e6bc
push id17224
push usereakhgari@mozilla.com
push dateFri, 26 Nov 2010 17:36:26 +0000
treeherdermozilla-central@fa69cf56d15b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian, beltzner
bugs607566, 595930
milestone2.0b8pre
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 607566 - Test for bug 595930 takes too long to run [r=ian, a=beltzner]
browser/base/content/tabview/groupitems.js
browser/base/content/test/tabview/browser_tabview_bug595930.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -552,35 +552,38 @@ GroupItem.prototype = Utils.extend(new I
   },
 
   // ----------
   // Function: close
   // Closes the groupItem, removing (but not closing) all of its children.
   close: function GroupItem_close() {
     this.removeAll();
     GroupItems.unregister(this);
-    this._sendToSubscribers("close");
-    this.removeTrenches();
 
     if (this.hidden) {
       iQ(this.container).remove();
       if (this.$undoContainer) {
         this.$undoContainer.remove();
         this.$undoContainer = null;
        }
+      this.removeTrenches();
       Items.unsquish();
+      this._sendToSubscribers("close");
     } else {
+      let self = this;
       iQ(this.container).animate({
         opacity: 0,
         "-moz-transform": "scale(.3)",
       }, {
         duration: 170,
         complete: function() {
           iQ(this).remove();
+          self.removeTrenches();
           Items.unsquish();
+          self._sendToSubscribers("close");
         }
       });
     }
     this.deleteData();
   },
 
   // ----------
   // Function: closeAll
--- a/browser/base/content/test/tabview/browser_tabview_bug595930.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug595930.js
@@ -6,17 +6,17 @@
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
- * The Original Code is tabview test for bug 587040.
+ * The Original Code is tabview test for bug 595930.
  *
  * The Initial Developer of the Original Code is
  * Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2010
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  * Raymond Lee <raymond@appcoast.com>
@@ -66,20 +66,29 @@ function onTabViewWindowLoaded() {
     let onTabViewHidden = function() {
       window.removeEventListener("tabviewhidden", onTabViewHidden, false);
       // assert that we're no longer in tab view
       ok(!TabView.isVisible(), "Tab View is hidden");
       finish();
     };
     window.addEventListener("tabviewhidden", onTabViewHidden, false);
 
-    EventUtils.synthesizeKey("e", {accelKey : true}, contentWindow);
+    // delay to give time for hidden group DOM element to be removed so
+    // the appropriate group would get selected when the key
+    // combination is pressed
+    executeSoon(function() { 
+      EventUtils.synthesizeKey("e", {accelKey : true}, contentWindow);
+    });
+  });
+
+  group1.addSubscriber(group1, "groupHidden", function() {
+    group1.removeSubscriber(group1, "groupHidden");
+
+    // close undo group
+    let closeButton = group1.$undoContainer.find(".close");
+    EventUtils.sendMouseEvent(
+      { type: "click" }, closeButton[0], contentWindow);
   });
 
   // Get rid of the group and its children
   group1.closeAll();
-  
-  // close undo group
-  let closeButton = group1.$undoContainer.find(".close");
-  EventUtils.sendMouseEvent(
-    { type: "click" }, closeButton[0], contentWindow);
 }