Bug 593262. The stop/reload button is chasing me. Keep running from it. r=roc a=fix a test
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 03 Sep 2010 00:43:26 -0500
changeset 51966 4b879b793eb6e3ce103793c2ef25fa03dad3b690
parent 51965 b3523cbd5b33d86bd55b95c2bd304f593a446d5b
child 51967 4b72a30f251e11c3b5b388cc942314ecc5fddafe
push id15479
push usertnikkel@gmail.com
push dateFri, 03 Sep 2010 05:45:04 +0000
treeherdermozilla-central@4b879b793eb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, fix
bugs593262
milestone2.0b6pre
first release with
nightly linux32
4b879b793eb6 / 4.0b6pre / 20100903030104 / files
nightly linux64
4b879b793eb6 / 4.0b6pre / 20100903030728 / files
nightly mac
4b879b793eb6 / 4.0b6pre / 20100903030656 / files
nightly win32
4b879b793eb6 / 4.0b6pre / 20100903040836 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 593262. The stop/reload button is chasing me. Keep running from it. r=roc a=fix a test
layout/style/test/Makefile.in
layout/style/test/chrome/Makefile.in
layout/style/test/chrome/hover_helper.html
layout/style/test/chrome/test_hover.html
layout/style/test/hover_helper.html
layout/style/test/test_hover.html
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -140,18 +140,16 @@ GARBAGE += css_properties.js
 		test_computed_style_no_pseudo.html \
 		test_css_cross_domain.html \
 		test_css_eof_handling.html \
 		test_descriptor_storage.html \
 		test_descriptor_syntax_errors.html \
 		test_dont_use_document_colors.html \
 		test_font_face_parser.html \
 		test_garbage_at_end_of_declarations.html \
-		test_hover.html \
-		hover_helper.html \
 		test_ident_escaping.html \
 		test_inherit_computation.html \
 		test_inherit_storage.html \
 		test_initial_computation.html \
 		test_initial_storage.html \
 		test_media_queries.html \
 		test_media_queries_dynamic.html \
 		test_media_queries_dynamic_xbl.html \
--- a/layout/style/test/chrome/Makefile.in
+++ b/layout/style/test/chrome/Makefile.in
@@ -43,12 +43,14 @@ relativesrcdir  = layout/style/test/chro
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _CHROME_FILES = \
     test_bug535806.xul \
     bug535806-css.css \
     bug535806-html.html \
     bug535806-xul.xul \
+    test_hover.html \
+    hover_helper.html \
     $(NULL)
 
 libs:: $(_CHROME_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
rename from layout/style/test/hover_helper.html
rename to layout/style/test/chrome/hover_helper.html
--- a/layout/style/test/hover_helper.html
+++ b/layout/style/test/chrome/hover_helper.html
@@ -1,16 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for :hover</title>
-  <script type="application/javascript" src="/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <style type="text/css">
 
   div#one { height: 10px; width: 10px; }
   div#one:hover { background: #00f; }
   div#one > div { height: 5px; width: 20px; }
   div#one > div:hover { background: #f00; }
 
   div#twoparent { overflow: hidden; height: 20px; }
@@ -35,34 +32,36 @@
   </div>
 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 var imports = [ "SimpleTest", "is", "isnot", "ok" ];
 for each (var import in imports) {
-    window[import] = window.opener[import];
+    window[import] = window.opener.wrappedJSObject[import];
 }
 
 var div = document.getElementById("display");
 var divtwo = document.getElementById("two");
 var iframe = document.getElementById("twoi");
 var divtwoparent = document.getElementById("twoparent");
 
 iframe.contentDocument.open();
 iframe.contentDocument.write("<style type='text/css'>html, body { margin: 0; padding: 0; }<\/style><body>");
 iframe.contentDocument.close();
 
 var moveEvent = { type: "mousemove", clickCount: "0" };
 
 function setResize(str) {
-  iframe.contentDocument.body.setAttribute("onresize",
-                                            "document.body.setAttribute('onresize', 'void(0)');" + 
-                                            "setTimeout('" + str + "', 100)");
+  var handler = function() {
+    iframe.contentWindow.removeEventListener("resize", arguments.callee, false);
+    setTimeout(str, 100);
+  };
+  iframe.contentWindow.addEventListener("resize", handler, false);
 }
 
 function step1() {
     /** test basic hover **/
     var divone = document.getElementById("one");
     synthesizeMouse(divone, 5, 7, moveEvent, window);
     is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
        ":hover applies");
@@ -80,50 +79,50 @@ function step1() {
        ":hover does not apply");
     synthesizeMouse(divone, 15, 2, moveEvent, window);
     is(getComputedStyle(divone, "").backgroundColor, "rgb(0, 0, 255)",
        ":hover applies hierarchically");
     is(getComputedStyle(divone.firstChild, "").backgroundColor, "rgb(255, 0, 0)",
        ":hover applies");
 
     /** Test for Bug 302561 **/
-    setResize("parent.step2()");
+    setResize("step2();");
     is(iframe.contentDocument.body.offsetWidth, 50,
        ":hover does not apply (iframe body width)");
     synthesizeMouse(divtwoparent, 7, 5, moveEvent, window);
     is(iframe.contentDocument.body.offsetWidth, 100,
        ":hover applies (iframe body width)");
 }
 
 var step2called = false;
 function step2() {
     is(step2called, false, "step2 called only once");
     step2called = true;
     is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)",
        ":hover applies");
     is(iframe.contentDocument.body.offsetWidth, 100,
        ":hover applies (iframe body width)");
-    setResize("parent.step3()");
+    setResize("step3()");
     synthesizeMouse(divtwoparent, 2, 5, moveEvent, window);
     is(iframe.contentDocument.body.offsetWidth, 50,
        ":hover does not apply (iframe body width)");
 }
 
 var step3called = false;
 function step3() {
     is(step3called, false, "step3 called only once");
     step3called = true;
     if (getComputedStyle(iframe, "").width == "100px") {
         // The two resize events may be coalesced into a single one.
         step4();
         return;
     }
     is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
        ":hover does not apply");
-    setResize("parent.step4()");
+    setResize("step4()");
     /* expect to get a second resize from the oscillation */
 }
 
 var step4called = false;
 function step4() {
     is(step4called, false, "step4 called only once (more than two cycles of oscillation)");
     if (step4called)
         return;
@@ -132,42 +131,42 @@ function step4() {
        ":hover applies");
     setTimeout(step5, 500); // time to detect oscillations if they exist
 }
 
 var step5called = false;
 function step5() {
     is(step5called, false, "step5 called only once");
     step5called = true;
-    setResize("parent.step6()");
+    setResize("step6()");
     synthesizeMouse(divtwoparent, 25, 5, moveEvent, window);
 }
 
 var step6called = false;
 function step6() {
     is(step6called, false, "step6 called only once");
     step6called = true;
     is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
        ":hover does not apply");
-    setResize("parent.step7()");
+    setResize("step7()");
     synthesizeMouse(divtwoparent, 2, 5, moveEvent, window);
 }
 
 var step7called = false;
 function step7() {
     is(step7called, false, "step7 called only once");
     step7called = true;
     if (getComputedStyle(iframe, "").width == "50px") {
         // The two resize events may be coalesced into a single one.
         step8();
         return;
     }
     is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)",
        ":hover applies");
-    setResize("parent.step8()");
+    setResize("step8()");
     /* expect to get a second resize from the oscillation */
 }
 
 var step8called = false;
 function step8() {
     is(step8called, false, "step8 called only once (more than two cycles of oscillation)");
     if (step8called)
         return;
@@ -182,43 +181,43 @@ function step8() {
 var step9called = false;
 function step9() {
     is(step9called, false, "step9 called only once");
     step9called = true;
     iframe.contentDocument.body.removeAttribute("onresize");
     /* move the mouse out of the way */
     synthesizeMouse(divtwoparent, 200, 5, moveEvent, window);
     divtwoparent.scrollLeft = 5;
-    setResize("parent.step10()");
+    setResize("step10()");
     synthesizeMouse(divtwoparent, 2, 5, moveEvent, window);
     /* mouse now over 7, 5 */
 }
 
 var step10called = false;
 function step10() {
     is(step10called, false, "step10 called only once");
     step10called = true;
     is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)",
        ":hover applies");
-    setResize("parent.step11()");
+    setResize("step11()");
     divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */
 }
 
 var step11called = false;
 function step11() {
     is(step11called, false, "step11 called only once");
     step11called = true;
     if (getComputedStyle(iframe, "").width == "100px") {
         // The two resize events may be coalesced into a single one.
         step12();
         return;
     }
     is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
        ":hover does not apply");
-    setResize("parent.step12()");
+    setResize("step12()");
     /* expect to get a second resize from the oscillation */
 }
 
 var step12called = false;
 function step12() {
     is(step12called, false, "step12 called only once (more than two cycles of oscillation)");
     if (step12called)
         return;
@@ -227,42 +226,42 @@ function step12() {
        ":hover applies");
     setTimeout(step13, 500); // time to detect oscillations if they exist
 }
 
 var step13called = false;
 function step13() {
     is(step13called, false, "step13 called only once");
     step13called = true;
-    setResize("parent.step14()");
+    setResize("step14()");
     divtwoparent.scrollLeft = 25; /* mouse now over 27,5 */
 }
 
 var step14called = false;
 function step14() {
     is(step14called, false, "step14 called only once");
     step14called = true;
     is(getComputedStyle(divtwo, "").backgroundColor, "transparent",
        ":hover does not apply");
-    setResize("parent.step15()");
+    setResize("step15()");
     divtwoparent.scrollLeft = 0; /* mouse now over 2,5 */
 }
 
 var step15called = false;
 function step15() {
     is(step15called, false, "step15 called only once");
     step15called = true;
     if (getComputedStyle(iframe, "").width == "50px") {
         // The two resize events may be coalesced into a single one.
         step16();
         return;
     }
     is(getComputedStyle(divtwo, "").backgroundColor, "rgb(0, 255, 0)",
        ":hover applies");
-    setResize("parent.step16()");
+    setResize("step16()");
     /* expect to get a second resize from the oscillation */
 }
 
 var step16called = false;
 function step16() {
     is(step16called, false, "step16 called only once (more than two cycles of oscillation)");
     if (step16called)
         return;
rename from layout/style/test/test_hover.html
rename to layout/style/test/chrome/test_hover.html
--- a/layout/style/test/test_hover.html
+++ b/layout/style/test/chrome/test_hover.html
@@ -1,16 +1,16 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for :hover</title>
-  <script type="application/javascript" src="/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body onload="startTest();">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
 <div id="display">
 
 </div>
 <pre id="test">
 <script type="application/javascript">