Bug 754169 - Fix intermittent orange related to imprecise scrolling positions in test. r=ehsan
authorJared Wein <jwein@mozilla.com>
Tue, 17 Jul 2012 11:40:49 -0400
changeset 99529 e232349d1c64837fd6d882c6cb8b9df6deb37b3b
parent 99528 9a6fcbd8f96aff59421cea1418c636b57c68593a
child 99530 353b4785836a061f128c70127ccbcda22bece9da
push id12046
push userjwein@mozilla.com
push dateTue, 17 Jul 2012 15:41:14 +0000
treeherdermozilla-inbound@e232349d1c64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs754169
milestone17.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 754169 - Fix intermittent orange related to imprecise scrolling positions in test. r=ehsan
editor/libeditor/html/tests/test_bug549262.html
--- a/editor/libeditor/html/tests/test_bug549262.html
+++ b/editor/libeditor/html/tests/test_bug549262.html
@@ -30,28 +30,30 @@ SimpleTest.waitForFocus(function() {
   var ed = win.document.getElementById("editor");
   var sc = win.document.querySelector("a");
   sc.focus();
   is(win.scrollY, 0, "Sanity check");
   synthesizeKey(" ", {}, win);
   setTimeout(function() {
     isnot(win.scrollY, 0, "Page is scrolled down");
     is(ed.textContent, "abc", "The content of the editable element has not changed");
+    var oldY = win.scrollY;
     synthesizeKey(" ", {shiftKey: true}, win);
     setTimeout(function() {
-      is(win.scrollY, 0, "Page is scrolled up");
+      ok(win.scrollY < oldY, "Page is scrolled up");
       is(ed.textContent, "abc", "The content of the editable element has not changed");
 
       // Make sure that pressing Space when a contenteditable element is focused
       // will not scroll the page, and will edit the element.
       ed.focus();
       win.getSelection().collapse(ed.firstChild, 1);
+      oldY = win.scrollY;
       synthesizeKey(" ", {}, win);
       setTimeout(function() {
-        is(win.scrollY, 0, "Page is not scrolled down");
+        ok(win.scrollY <= oldY, "Page is not scrolled down");
         is(ed.textContent, "a bc", "The content of the editable element has changed");
         sc.focus();
         synthesizeKey(" ", {}, win);
         setTimeout(function() {
           isnot(win.scrollY, 0, "Page is scrolled down");
           is(ed.textContent, "a bc", "The content of the editable element has not changed");
           ed.focus();
           win.getSelection().collapse(ed.firstChild, 3);
@@ -60,17 +62,17 @@ SimpleTest.waitForFocus(function() {
             isnot(win.scrollY, 0, "Page is not scrolled up");
             is(ed.textContent, "a b c", "The content of the editable element has changed");
 
             // Now let's test the down/up keys
             sc = document.body;
             setTimeout(function() {
               ed.blur();
               sc.focus();
-              var oldY = win.scrollY;
+              oldY = win.scrollY;
               synthesizeKey("VK_UP", {}, win);
               setTimeout(function() {
                 ok(win.scrollY < oldY, "Page is scrolled up");
                 oldY = win.scrollY;
                 ed.focus();
                 win.getSelection().collapse(ed.firstChild, 3);
                 synthesizeKey("VK_UP", {}, win);
                 setTimeout(function() {