Bug 461199 (Part 29) - Fix dom tests.
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 24 Feb 2010 08:37:03 -0800
changeset 38490 79462e4e234d85845cd15942b1df62b7a2aaac93
parent 38489 2777f7baaaad4a40773b4030c317294b91c16b65
child 38491 639b98ae11a87689ec600d710c630aebef72c34f
push id11779
push usersdwilsh@shawnwilsher.com
push dateWed, 24 Feb 2010 17:05:48 +0000
treeherdermozilla-central@639b98ae11a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs461199
milestone1.9.3a2pre
Bug 461199 (Part 29) - Fix dom tests. r=sicking
dom/tests/mochitest/whatwg/file_bug500328_1.html
dom/tests/mochitest/whatwg/test_bug500328.html
--- a/dom/tests/mochitest/whatwg/file_bug500328_1.html
+++ b/dom/tests/mochitest/whatwg/file_bug500328_1.html
@@ -1,16 +1,20 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 Inner frame for testing bug 500328.
 https://bugzilla.mozilla.org/show_bug.cgi?id=500328
 -->
 <head>
 <title>test 1</title>
+  <style>
+    a           { fill:blue; }
+    a:visited   { fill:purple; }
+  </style>
 </head>
 <body onload="load();" onpopstate="popstate(event);">
 <script type="application/javascript">
   function load() {
     if(parent && parent.onChildLoad)
       parent.onChildLoad();
     if(opener && opener.onChildLoad)
       opener.onChildLoad();
--- a/dom/tests/mochitest/whatwg/test_bug500328.html
+++ b/dom/tests/mochitest/whatwg/test_bug500328.html
@@ -27,18 +27,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 
 var iframe = document.getElementById("iframe");
 var iframeCw = iframe.contentWindow;
 
 var iframe2 = document.getElementById("iframe2");
 var iframe2Cw = iframe2.contentWindow;
 
-var unvisitedColor;
-var visitedColor;
+const unvisitedColor = "rgb(0, 0, 238)";
+const visitedColor = "rgb(85, 26, 139)";
 
 var gCallbackOnIframeLoad = false;
 var gCallbackOnPopState = false;
 var gNumPopStates = 0;
 var gLastPopStateEvent;
 
 var gGen;
 
@@ -171,35 +171,20 @@ function expectException(func, msg) {
 function runTest() {
   // We can't enable universal XPConnect privleges in this function, because
   // test 5 needs to be running at normal privleges in order to test the
   // same-origin policy.
 
   /**
    * PRELIMINARY:
    *  1. Clear the popstate counter
-   *  2. Get the visited and unvisited link colors.
    */
 
   clearPopStateCounter();
 
-  // Set the link's href to somewhere we haven't been so we can get the
-  // unvisited link color.
-  var rand = Date.now() + "-" + Math.random();
-  $("link").href = rand;
-  unvisitedColor = getColor($("link"));
-  statusMsg("Unvisited color is " + unvisitedColor);
-
-  // Set the link's href to our current location so we can get the visited link
-  // color.
-  $("link").href = document.location;
-  visitedColor = getColor($("link"));
-  statusMsg("Visited color is " + visitedColor);
-  isnot(visitedColor, unvisitedColor, "visited/unvisited link colors are the same?");
-
   // The URL of file_bug500328_1.html on http://localhost:8888
   var innerLoc;
 
   // Now we can start the tests
 
   /**
    * TEST 1 tests basic pushState functionality
    */
@@ -298,16 +283,17 @@ function runTest() {
   iframe.onload = null;
   iframeCw.location = "file_bug500328_1.html";
   enableChildPopStateCallback();
   yield;
   popstateExpected("No popstate after re-loading file_bug500328_1.html");
   statusMsg("Done loading file_bug500328_1.html for the second time.");
 
   var ifLink = iframeCw.document.getElementById("link-anchor1");
+  var rand = Date.now() + "-" + Math.random();
   ifLink.href = rand;
 
   // Poll the document until the link has the correct color, or this test times
   // out.  Unfortunately I can't come up with a more elegant way to do this.
   // We could listen to MozAfterPaint, but that doesn't guarantee that we'll
   // observe the new color.
   while (getColor(ifLink) != unvisitedColor) {
     // Dump so something shows up in the mochitest logs if we spin here.