Backed out changeset cb5eccf28d08 (bug 1059146)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 14 Jun 2016 00:59:43 +0200
changeset 326781 f83c6ae171402f19a537a1432595ffbd36bb27eb
parent 326780 cb5eccf28d080455a62d3b09f8b698c6bc306774
child 326782 0e3e27ab48fb2d2603d097be645258d9437722c7
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1059146
milestone50.0a1
backs outcb5eccf28d080455a62d3b09f8b698c6bc306774
Backed out changeset cb5eccf28d08 (bug 1059146)
toolkit/content/tests/chrome/test_bug360220.xul
toolkit/content/tests/chrome/test_menulist.xul
--- a/toolkit/content/tests/chrome/test_bug360220.xul
+++ b/toolkit/content/tests/chrome/test_bug360220.xul
@@ -23,39 +23,21 @@ https://bugzilla.mozilla.org/show_bug.cg
   <menupopup>
     <menuitem id="firstItem" label="foo" selected="true"/>
     <menuitem id="secondItem" label="bar"/>
   </menupopup>
 </menulist>
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-SimpleTest.waitForExplicitFinish();
-
 /** Test for Bug 360220 **/
 
 var menulist = document.getElementById("menulist");
 var secondItem = document.getElementById("secondItem");
 menulist.selectedItem = secondItem;
 
-is(menulist.label, "bar", "second item was not selected");
-
-let mutObserver = new MutationObserver(() => {
-  is(menulist.label, "new label", "menulist label was not updated to the label of its selected item");
-  done();
-});
-mutObserver.observe(menulist, { attributeFilter: ['label'] });
+ok(menulist.label == "bar", "second item was not selected");
 secondItem.label = "new label";
-
-let failureTimeout = setTimeout(function() {
-  ok(false, "menulist label should have updated");
-  done();
-}, 2000);
-
-function done() {
-  mutObserver.disconnect();
-  clearTimeout(failureTimeout);
-  SimpleTest.finish();
-}
+ok(menulist.label == "new label", "menulist label was not updated to the label of its selected item");
 ]]>
 </script>
 
 </window>
--- a/toolkit/content/tests/chrome/test_menulist.xul
+++ b/toolkit/content/tests/chrome/test_menulist.xul
@@ -79,48 +79,41 @@
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function testtag_menulists()
 {
   testtag_menulist_UI_start($("menulist"), false);
+  testtag_menulist_UI_start($("menulist-editable"), true);
+
+  // bug 566154, the menulist width should account for vertical scrollbar
+  ok(document.getElementById("menulist-size").getBoundingClientRect().width >= 210,
+     "menulist popup width includes scrollbar width");
+
+  $("menulist").open = true;
 }
 
 function testtag_menulist_UI_start(element, editable)
 {
   var testprefix = editable ? "editable" : "";
 
   // check the menupopup property
   var popup = element.menupopup;
   ok(popup && popup.localName == "menupopup" &&
               popup.parentNode == element, testprefix + " menupopup");
 
   // test the interfaces that menulist implements
   test_nsIDOMXULMenuListElement(element, testprefix, editable);
-}
 
-function testtag_menulist_UI_finish(element, editable)
-{
   element.value = "";
 
   test_nsIDOMXULSelectControlElement(element, "menuitem",
                                      editable ? "editable" : null);
-
-  if (!editable) {
-    testtag_menulist_UI_start($("menulist-editable"), true);
-  }
-  else {
-    // bug 566154, the menulist width should account for vertical scrollbar
-    ok(document.getElementById("menulist-size").getBoundingClientRect().width >= 210,
-       "menulist popup width includes scrollbar width");
-
-    $("menulist").open = true;
-  }
 }
 
 function test_nsIDOMXULMenuListElement(element, testprefix, editable)
 {
   is(element.open, false, testprefix + " open");
   is(element.editable, editable, testprefix + " editable");
 
   if (editable) {
@@ -154,90 +147,50 @@ function test_nsIDOMXULMenuListElement(e
   thirditem.setAttribute("description", "This is the third description");
 
   // check the image and description properties
   // editable menulists don't use the image or description properties currently
   if (editable) {
     element.selectedIndex = 1;
     is(element.image, "", testprefix + " image set to selected");
     is(element.description, "", testprefix + " description set to selected");
-    test_nsIDOMXULMenuListElement_finish(element, testprefix, editable);
   }
   else {
     element.selectedIndex = 1;
     is(element.image, "happy.png", testprefix + " image set to selected");
     is(element.description, "This is the second description", testprefix + " description set to selected");
     element.selectedIndex = -1;
     is(element.image, "", testprefix + " image set when none selected");
     is(element.description, "", testprefix + " description set when none selected");
     element.selectedIndex = 2;
     is(element.image, "happy.png", testprefix + " image set to selected again");
     is(element.description, "This is the third description", testprefix + " description set to selected again");
 
     // check that changing the properties of the selected item changes the menulist's properties
-    let properties = [{attr: "label", value: "Item Number Three"},
-                      {attr: "value", value: "item-three"},
-                      {attr: "image", value: "smile.png"},
-                      {attr: "description", value: "Changed description"}];
-    test_nsIDOMXULMenuListElement_properties(element, testprefix, editable, thirditem, properties);
-  }
-}
-
-function test_nsIDOMXULMenuListElement_properties(element, testprefix, editable, thirditem, properties)
-{
-  let {attr, value} = properties.shift();
-  let last = (properties.length == 0);
+    thirditem.label = "Item Number Three";
+    is(element.label, "Item Number Three", testprefix + " label modified");
+    thirditem.value = "item-three";
+    is(element.value, "item-three", testprefix + " value modified");
+    thirditem.image = "smile.png";
+    is(element.image, "smile.png", testprefix + " image modified");
+    thirditem.setAttribute("description", "Changed description");
+    is(element.description, "Changed description", testprefix + " description modified");
+    seconditem.label = "Changed Label 2";
+    is(element.label, "Item Number Three", testprefix + " label of another item modified");
 
-  let mutObserver = new MutationObserver(() => {
-    is(element.getAttribute(attr), value, `${testprefix} ${attr} modified`);
-    done();
-  });
-  mutObserver.observe(element, { attributeFilter: [attr] });
-
-  let failureTimeout = setTimeout(() => {
-    ok(false, `${testprefix} ${attr} should have updated`);
-    done();
-  }, 2000);
-
-  function done()
-  {
-    clearTimeout(failureTimeout);
-    mutObserver.disconnect();
-    if (!last) {
-      test_nsIDOMXULMenuListElement_properties(element, testprefix, editable, thirditem, properties);
-    }
-    else {
-      test_nsIDOMXULMenuListElement_unselected(element, testprefix, editable, thirditem);
-    }
+    element.selectedIndex = 0;
+    is(element.image, "", testprefix + " image set to selected with no image");
+    is(element.description, "", testprefix + " description set to selected with no description");
   }
 
-  thirditem.setAttribute(attr, value)
-}
-
-function test_nsIDOMXULMenuListElement_unselected(element, testprefix, editable, thirditem)
-{
-  let seconditem = thirditem.previousElementSibling;
-  seconditem.label = "Changed Label 2";
-  is(element.label, "Item Number Three", testprefix + " label of another item modified");
-
-  element.selectedIndex = 0;
-  is(element.image, "", testprefix + " image set to selected with no image");
-  is(element.description, "", testprefix + " description set to selected with no description");
-  test_nsIDOMXULMenuListElement_finish(element, testprefix, editable);
-}
-
-function test_nsIDOMXULMenuListElement_finish(element, testprefix, editable)
-{
   // check the removeAllItems method
   element.appendItem("An Item", "anitem");
   element.appendItem("Another Item", "anotheritem");
   element.removeAllItems();
   is(element.itemCount, 0, testprefix + " removeAllItems");
-
-  testtag_menulist_UI_finish(element, editable);
 }
 
 function test_menulist_open(element, scroller)
 {
   element.appendItem("Scroll Item 1", "scrollitem1");
   element.appendItem("Scroll Item 2", "scrollitem2");
   element.focus();
   element.selectedIndex = 0;