Bug 461199 (Part 29) - Fix dom tests.
☠☠ backed out by fec999d5f666 ☠ ☠
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 17 Feb 2010 14:04:34 -0800
changeset 38195 5607b8b76949e4a1c84cbc766367cbd9e0fdbedc
parent 38194 42bf809ee4139db521da9a8b620a04d9774e3a62
child 38196 550a4379468fe8ed06d39a220cf6769710142a89
child 38217 fec999d5f66684f208eae549a0cb307d0cad8676
push id11651
push usersdwilsh@shawnwilsher.com
push dateWed, 17 Feb 2010 22:38:03 +0000
treeherdermozilla-central@550a4379468f [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.