Backed out changeset a6b9c152a7d1 (bug 1140293) for mochitest failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 25 Mar 2015 08:42:46 -0400
changeset 264347 eb3e4c2fa35edb81788b382ac8cea15a34b5f555
parent 264346 48d6322d42b7128627eb6683597a567135b197b6
child 264400 97076df948c275036021a45da7347df3bae7acf5
child 264576 203991c8a8fcd6df64d3574ea88b0bbc8d532838
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1140293
milestone39.0a1
backs outa6b9c152a7d1fa6ea97c8bf877a9731b2b539751
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
Backed out changeset a6b9c152a7d1 (bug 1140293) for mochitest failures. CLOSED TREE
dom/events/test/test_bug574663.html
layout/generic/test/mochitest.ini
layout/generic/test/test_bug784410.html
layout/generic/test/test_scroll_behavior.html
testing/mochitest/tests/SimpleTest/EventUtils.js
toolkit/content/tests/chrome/test_mousescroll.xul
--- a/dom/events/test/test_bug574663.html
+++ b/dom/events/test/test_bug574663.html
@@ -15,75 +15,29 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.7">
 
 /** Test for Bug 574663 **/
 
-// SimpleTest's paint_listener does not work on other windows, so we inline
-// a smaller version here.
-function waitForPaint(win, utils, callback) {
-  win.document.documentElement.getBoundingClientRect();
-  if (!utils.isMozAfterPaintPending) {
-    callback();
-    return;
-  }
-
-  var onpaint = function() {
-    if (!utils.isMozAfterPaintPending) {
-      win.removeEventListener("MozAfterPaint", onpaint);
-      callback();
-      return;
-    }
-  }
-  win.addEventListener("MozAfterPaint", onpaint);
-  if (utils.isTestControllingRefreshes) {
-    utils.advanceTimeAndRefresh(0);
-  }
-}
-
-function forceScrollAndWait(scrollbox, callback) {
-  let win = scrollbox.ownerDocument.defaultView;
-  let utils = SpecialPowers.getDOMWindowUtils(win);
-
-  utils.advanceTimeAndRefresh(1000);
-  waitForPaint(win, utils, callback);
-}
-
-function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback) {
+function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum) {
   var win = scrollbox.ownerDocument.defaultView;
   let event = {
     deltaMode: WheelEvent.DOM_DELTA_PIXEL,
     deltaY: direction * 3,
     lineOrPageDeltaY: direction,
     ctrlKey: ctrl,
     isMomentum: momentum
   };
-
-  let kExtraEvents = 5;
-
-  var received = 0;
-  var onwheel = function() {
-    if (++received == 1 + kExtraEvents) {
-      // We have captured all the outstanding wheel events. Wait for the
-      // animation to add itself to the refresh driver.
-      scrollbox.removeEventListener("wheel", onwheel);
-      setTimeout(function() {
-        forceScrollAndWait(scrollbox, callback);
-      }, 0);
-    }
-  };
-  scrollbox.addEventListener("wheel", onwheel);
-
   synthesizeWheel(scrollbox, 10, 10, event, win);
   // then 5 additional pixel scrolls
   event.lineOrPageDeltaY = 0;
-  for (let i = 1; i <= kExtraEvents; ++i) {
+  for (let i = 0; i < 5; ++i) {
     synthesizeWheel(scrollbox, 10, 10, event, win);
   }
 }
 
 function runTest() {
   var win = open('data:text/html,<!DOCTYPE html>\n' +
     '<div id="scrollbox" style="height: 100px; overflow: auto;">' +
     '  <div style="height: 1000px;"></div>' +
@@ -98,62 +52,64 @@ function runTest() {
       [true, true],
     ];
 
     // grab the refresh driver, since we want to make sure
     // async scrolls happen in deterministic time
     winUtils.advanceTimeAndRefresh(1000);
 
     function nextTest() {
+      if (!outstandingTests.length) {
+        winUtils.restoreNormalRefresh();
+        win.close();
+        SimpleTest.finish();
+        return;
+      }
+
       let [ctrlKey, isMomentum] = outstandingTests.shift();
       let scrollTopBefore = scrollbox.scrollTop;
       let zoomFactorBefore = winUtils.fullZoom;
 
-      let check = function() {
+      sendTouchpadScrollMotion(scrollbox, 1, ctrlKey, isMomentum);
+      winUtils.advanceTimeAndRefresh(1000); // force scrolling to happen
+
+      setTimeout(function () {
         if (!ctrlKey) {
           let postfix = isMomentum ? ", even after releasing the touchpad" : "";
           // Normal scroll: scroll
           is(winUtils.fullZoom, zoomFactorBefore, "Normal scrolling shouldn't change zoom" + postfix);
           isnot(scrollbox.scrollTop, scrollTopBefore, "Normal scrolling should scroll" + postfix);
         } else {
           if (!isMomentum) {
             isnot(winUtils.fullZoom, zoomFactorBefore, "Ctrl-scrolling should zoom while the user is touching the touchpad");
             is(scrollbox.scrollTop, scrollTopBefore, "Ctrl-scrolling shouldn't scroll while the user is touching the touchpad");
           } else {
             is(winUtils.fullZoom, zoomFactorBefore, "Momentum scrolling shouldn't zoom, even when pressing Ctrl");
             isnot(scrollbox.scrollTop, scrollTopBefore, "Momentum scrolling should scroll, even when pressing Ctrl");
           }
         }
-
-        if (!outstandingTests.length) {
-          winUtils.restoreNormalRefresh();
-          win.close();
-          SimpleTest.finish();
-          return;
-        }
+        // Revert the effect.
+        sendTouchpadScrollMotion(scrollbox, -1, ctrlKey, isMomentum);
+        winUtils.advanceTimeAndRefresh(1000); // force scrolling to happen
 
-        // Revert the effect for the next test.
-        sendTouchpadScrollMotion(scrollbox, -1, ctrlKey, isMomentum, function() {
-          setTimeout(nextTest, 0);
-        });
-      }
-
-      sendTouchpadScrollMotion(scrollbox, 1, ctrlKey, isMomentum, check);
+        setTimeout(nextTest, 20);
+      }, 20);
     }
     nextTest();
   }, win);
 }
 
 window.onload = function() {
   SpecialPowers.pushPrefEnv({
     "set":[["general.smoothScroll", false],
            ["mousewheel.acceleration.start", -1],
            ["mousewheel.system_scroll_override_on_root_content.enabled", false],
            ["mousewheel.with_control.action", 3]]}, runTest);
 }
 
 SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
 
 </script>
 </pre>
 
 </body>
 </html>
--- a/layout/generic/test/mochitest.ini
+++ b/layout/generic/test/mochitest.ini
@@ -122,16 +122,16 @@ skip-if = (buildapp == 'b2g' && toolkit 
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
 [test_plugin_focus.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || e10s # b2g(plugins not supported) b2g-debug(plugins not supported) b2g-desktop(plugins not supported)
 [test_plugin_mouse_coords.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(plugins not supported) b2g-debug(plugins not supported) b2g-desktop(plugins not supported)
 [test_plugin_position.xhtml]
 skip-if = e10s
 [test_scroll_behavior.html]
-skip-if = buildapp == 'b2g' # Bug 1062609
+skip-if = e10s || buildapp == 'b2g' # Bug 1062609
 [test_selection_expanding.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' # b2g(mouse selection not working) b2g-debug(mouse selection not working) b2g-desktop(mouse selection not working)
 support-files = selection_expanding_xbl.xml
 [test_selection_splitText-normalize.html]
 [test_selection_touchevents.html]
 [test_taintedfilters.html]
 support-files = file_taintedfilters_feDisplacementMap-tainted-1.svg file_taintedfilters_feDisplacementMap-tainted-2.svg file_taintedfilters_feDisplacementMap-tainted-3.svg file_taintedfilters_feDisplacementMap-tainted-ref.svg file_taintedfilters_feDisplacementMap-untainted-ref.svg file_taintedfilters_feDisplacementMap-untainted-1.svg file_taintedfilters_feDisplacementMap-untainted-2.svg file_taintedfilters_red-flood-for-feImage-cors.svg file_taintedfilters_red-flood-for-feImage-cors.svg^headers^ file_taintedfilters_red-flood-for-feImage.svg
--- a/layout/generic/test/test_bug784410.html
+++ b/layout/generic/test/test_bug784410.html
@@ -1,15 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test bug 784410</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <script src="/tests/SimpleTest/paint_listener.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <p id="display"></p>
 <div id="outer" style="overflow:auto; height:200px; border:2px dotted black;" onscroll="doneScroll()">
   <div id="d" style="overflow:auto; height:102px;" onscroll="doneScroll()">
     <div id="inner" style="height:100.1px; border:1px solid black; background:yellow;">Hello</div>
   </div>
@@ -34,26 +33,23 @@ function doneScroll() {
   switch (step) {
   case 1:
     is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down");
     ok(outer.scrollTop > 0, "Outer element should have scrolled down");
 
     outer.scrollTop = 0;
     break;
   case 2:
-    // Wait for paints to flush, so APZ is notified of the new scroll offset.
-    sendWheelAndPaint(inner, 4, 4,
-      { deltaMode: WheelEvent.DOM_DELTA_LINE, deltaY: 1 },
-      function() {});
+    synthesizeWheel(inner, 4, 4,
+      { deltaMode: WheelEvent.DOM_DELTA_LINE, deltaY: 1 });
     break;
   case 3:
     is(innerScrollOffset(), innerStartScrollOffset, "Inner element should not have scrolled down");
     ok(outer.scrollTop > 0, "Outer element should have scrolled down");
     
-    SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
     SimpleTest.finish();
     break;
   }
 }
 
 function test() {
   sel.collapse(inner.firstChild, 2);
   synthesizeKey("VK_PAGE_DOWN", {});
--- a/layout/generic/test/test_scroll_behavior.html
+++ b/layout/generic/test/test_scroll_behavior.html
@@ -24,38 +24,29 @@
 
   SimpleTest.waitForExplicitFinish();
 
   function clamp(val, minVal, maxVal) {
     return Math.max(minVal, Math.min(maxVal, val));
   }
 
   window.addEventListener("load", function(event) {
-    if (event.target != document)
-      return;
-
-    // See bug 1062609 - these tests do not work with APZ yet. If APZ is
-    // enabled, end the tests early.
-    if (SpecialPowers.getBoolPref("layers.async-pan-zoom.enabled")) {
-      todo(false, "This test does not yet work with APZ.");
-      SimpleTest.finish();
-      return;
+    if (event.target == document) {
+      SpecialPowers.pushPrefEnv(
+        { 'set': [['layout.css.scroll-behavior.enabled', true]] },
+        function () {
+          testScrollBehaviorInterruption(function() {
+            testScrollBehaviorFramerate(function() {
+              window.scrollTo(0,0);
+              SimpleTest.finish(); 
+            });
+          });
+        }
+      );
     }
-
-    SpecialPowers.pushPrefEnv(
-      { 'set': [['layout.css.scroll-behavior.enabled', true]] },
-      function () {
-        testScrollBehaviorInterruption(function() {
-          testScrollBehaviorFramerate(function() {
-            window.scrollTo(0,0);
-            SimpleTest.finish();
-          });
-        });
-      }
-    );
   }, false);
 
 
   function testScrollBehaviorInterruption(nextTest) {
     // Take control of refresh driver
     SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(0);
     waitForAllPaintsFlushed(function() {
 
--- a/testing/mochitest/tests/SimpleTest/EventUtils.js
+++ b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -1,16 +1,15 @@
 /**
  * EventUtils provides some utility methods for creating and sending DOM events.
  * Current methods:
  *  sendMouseEvent
  *  sendChar
  *  sendString
  *  sendKey
- *  sendWheelAndPaint
  *  synthesizeMouse
  *  synthesizeMouseAtCenter
  *  synthesizePointer
  *  synthesizeWheel
  *  synthesizeKey
  *  synthesizeNativeKey
  *  synthesizeMouseExpectEvent
  *  synthesizeKeyExpectEvent
@@ -426,59 +425,16 @@ function synthesizeWheel(aTarget, aOffse
 
   var rect = aTarget.getBoundingClientRect();
   utils.sendWheelEvent(rect.left + aOffsetX, rect.top + aOffsetY,
                        aEvent.deltaX, aEvent.deltaY, aEvent.deltaZ,
                        aEvent.deltaMode, modifiers,
                        lineOrPageDeltaX, lineOrPageDeltaY, options);
 }
 
-/**
- * This is a wrapper around synthesizeWheel that waits for the wheel event
- * to be dispatched and for the subsequent layout/paints to be flushed.
- *
- * This requires including paint_listener.js. Tests must call
- * DOMWindowUtils.restoreNormalRefresh() before finishing, if they use this
- * function.
- */
-function sendWheelAndPaint(aTarget, aOffsetX, aOffsetY, aEvent, aCallback, aWindow) {
-  aWindow = aWindow || window;
-
-  var utils = _getDOMWindowUtils(aWindow);
-  if (!utils)
-    return;
-
-  if (utils.isMozAfterPaintPending) {
-    // If a paint is pending, then APZ may be waiting for a scroll acknowledgement
-    // from the content thread. If we send a wheel event now, it could be ignored
-    // by APZ (or its scroll offset could be overridden). To avoid problems we
-    // just wait for the paint to complete.
-    aWindow.waitForAllPaintsFlushed(function() {
-      sendWheelAndPaint(aTarget, aOffsetX, aOffsetY, aEvent, aCallback, aWindow);
-    });
-    return;
-  }
-
-  var onwheel = function() {
-    window.removeEventListener("wheel", onwheel);
-
-    // Wait one frame since the wheel event has not caused a refresh observer
-    // to be added yet.
-    setTimeout(function() {
-      utils.advanceTimeAndRefresh(1000);
-      aWindow.waitForAllPaintsFlushed(function() {
-        aCallback();
-      });
-    }, 0);
-  };
-
-  aWindow.addEventListener("wheel", onwheel);
-  synthesizeWheel(aTarget, aOffsetX, aOffsetY, aEvent, aWindow);
-}
-
 function _computeKeyCodeFromChar(aChar)
 {
   if (aChar.length != 1) {
     return 0;
   }
   const nsIDOMKeyEvent = _EU_Ci.nsIDOMKeyEvent;
   if (aChar >= 'a' && aChar <= 'z') {
     return nsIDOMKeyEvent.DOM_VK_A + aChar.charCodeAt(0) - 'a'.charCodeAt(0);
--- a/toolkit/content/tests/chrome/test_mousescroll.xul
+++ b/toolkit/content/tests/chrome/test_mousescroll.xul
@@ -3,17 +3,16 @@
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=378028
 -->
 <window title="Mozilla Bug 378028"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"/>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml">
   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378028"
      target="_blank">Mozilla Bug 378028</a>
   </body>
 
   <!-- richlistbox currently has no way of giving us a defined number of
@@ -134,71 +133,69 @@ function testListbox(id)
 function testRichListbox(id, andThen)
 {
   var listbox = document.getElementById(id);
   var tests = [];
 
   var winUtils = SpecialPowers.getDOMWindowUtils(window);
   winUtils.advanceTimeAndRefresh(100);
 
-  function nextTest() {
-    var [aStart, aDelta, aIntDelta, aDeltaMode] = tests.shift();
+  function helper()
+  {
+    var [aStart, aDelta, aIntDelta, aDeltaMode] = tests[0];
+    tests.shift();
     listbox.scrollToIndex(aStart);
 
-    let event = {
-      deltaMode: aDeltaMode,
-      deltaY: aDelta,
-      lineOrPageDeltaY: aIntDelta
-    };
-    sendWheelAndPaint(listbox, 10, 10, event, function() {
-      var change = listbox.getIndexOfFirstVisibleRow() - aStart;
-      var direction = (change > 0) - (change < 0);
-      var expected = (aDelta > 0) - (aDelta < 0);
-      is(direction, expected,
-       "testRichListbox(" + id +  "): vertical, starting " + aStart +
-         " delta " + aDelta + " lineOrPageDeltaY " + aIntDelta +
+    synthesizeWheel(listbox, 10, 10,
+                    { deltaMode: aDeltaMode, deltaY: aDelta,
+                      lineOrPageDeltaY: aIntDelta });
+
+    winUtils.advanceTimeAndRefresh(100);
+
+    var change = listbox.getIndexOfFirstVisibleRow() - aStart;
+    var direction = (change > 0) - (change < 0);
+    var expected = (aDelta > 0) - (aDelta < 0);
+    is(direction, expected,
+     "testRichListbox(" + id +  "): vertical, starting " + aStart +
+       " delta " + aDelta + " lineOrPageDelta " + aIntDelta +
+       " aDeltaMode " + aDeltaMode);
+
+    // Check that horizontal scrolling has no effect
+    listbox.scrollToIndex(aStart);
+    synthesizeWheel(listbox, 10, 10,
+                    { deltaMode: aDeltaMode, deltaX: aDelta,
+                      lineOrPageDeltaX: aIntDelta });
+
+    winUtils.advanceTimeAndRefresh(100);
+
+    is(listbox.getIndexOfFirstVisibleRow(), aStart,
+       "testRichListbox(" + id +  "): horizontal, starting " + aStart +
+         " delta " + aDelta + " lineOrPageDelta " + aIntDelta +
          " aDeltaMode " + aDeltaMode);
 
-      // Check that horizontal scrolling has no effect
-      let event = {
-        deltaMode: aDeltaMode,
-        deltaX: aDelta,
-        lineOrPageDeltaX: aIntDelta
-      };
-
-      listbox.scrollToIndex(aStart);
-      sendWheelAndPaint(listbox, 10, 10, event, function() {
-        is(listbox.getIndexOfFirstVisibleRow(), aStart,
-           "testRichListbox(" + id +  "): horizontal, starting " + aStart +
-             " delta " + aDelta + " lineOrPageDeltaX " + aIntDelta +
-             " aDeltaMode " + aDeltaMode);
-
-        if (!tests.length) {
-          winUtils.restoreNormalRefresh();
-          andThen();
-          return;
-        }
-
-        nextTest();
-      });
-    });
+    if (tests.length) {
+      winUtils.advanceTimeAndRefresh(100);
+      helper();
+    } else {
+      winUtils.restoreNormalRefresh();
+      andThen();
+    }
   }
 
   // richlistbox currently uses native XUL scrolling, so the "line"
   // amounts don't necessarily correspond 1-to-1 with listbox items. So
   // we just check that scrolling up/down scrolls in the right direction.
   deltaModes.forEach(function(aDeltaMode) {
     let delta = (aDeltaMode == WheelEvent.DOM_DELTA_PIXEL) ? 32.0 : 2.0;
     tests.push([5, -delta, -1, aDeltaMode]);
     tests.push([5, -delta,  0, aDeltaMode]);
     tests.push([5,  delta,  1, aDeltaMode]);
     tests.push([5,  delta,  0, aDeltaMode]);
   });
-
-  nextTest();
+  helper();
 }
 
 function testArrowScrollbox(id)
 {
   var scrollbox = document.getElementById(id);
   var scrollBoxObject = scrollbox.scrollBoxObject;
   var orient = scrollbox.getAttribute("orient");