Backed out changeset 26f7974bf6ef

This commit is contained in:
Shawn Wilsher 2010-02-18 09:55:05 -08:00
parent f5428e410b
commit 4b7fe56c88

View File

@ -14,10 +14,7 @@
</script>
<script type="application/javascript"><![CDATA[
const Ci = Components.interfaces;
const Cc = Components.classes;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// Define the generator-iterator for the tests.
var tests = testIterator();
@ -27,40 +24,18 @@
function nextTest() {
tests.next();
}
// Return the Element object for the specified element id
function $(id) { return TestWindow.getDocument().getElementById(id); }
////
// Generator function for test steps for bug 293235:
// Generator function for test steps for bug 293235:
// A visited link should have the :visited style applied
// to it when displayed on a page which was fetched from
// the bfcache.
//
function testIterator()
{
// Register our observer to know when the link lookup is complete.
let testURI = NetUtil.newURI(getHttpUrl("bug293235_p2.html"));
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
const URI_VISITED_RESOLUTION_TOPIC = "visited-status-resolution";
let observer = {
notified: false,
observe: function(aSubject, aTopic, aData)
{
if (!testURI.equals(aSubject.QueryInterface(Ci.nsIURI))) {
return;
}
is(aTopic, URI_VISITED_RESOLUTION_TOPIC, "Unexpected topic");
this.notified = true;
// Cleanup after ourselves...
os.removeObserver(this, URI_VISITED_RESOLUTION_TOPIC);
},
};
os.addObserver(observer, URI_VISITED_RESOLUTION_TOPIC, false);
function notified() observer.notified;
// Load a test page containing a link that should be initially
// blue, per the :link style.
doPageNavigation({
@ -68,14 +43,9 @@
onNavComplete: nextTest
});
yield;
// Before we go any further, make sure our link has been notified.
waitForTrue(notified, nextTest);
yield;
// Now that we've been notified, we can check our link color.
is(TestWindow.getWindow().getComputedStyle($("link1"), "").color,
"rgb(0, 0, 128)",
is(TestWindow.getWindow().getComputedStyle($("link1"), "").color,
"rgb(0, 0, 128)",
"link not initially blue");
// Load the page that the link on the previous page points to.
@ -85,16 +55,6 @@
});
yield;
// Because of LAZY_ADD, we will not be notified for three seconds
// Wait for four seconds just to be safe.
setTimeout(nextTest, 4000);
yield;
// And the nodes get notified after the "link-visited" topic, so
// we need to execute soon...
SimpleTest.executeSoon(nextTest);
yield;
// Go back, verify the original page was loaded from the bfcache,
// and verify that the link is now purple, per the
// :visited style.
@ -108,17 +68,16 @@
});
yield;
// Now we can test the link color.
is(TestWindow.getWindow().getComputedStyle($("link1"), "").color,
"rgb(128, 0, 128)",
is(TestWindow.getWindow().getComputedStyle($("link1"), "").color,
"rgb(128, 0, 128)",
":visited link wrong color");
// Tell the framework the test is finished. Include the final 'yield'
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
finish();
yield;
}
]]></script>
<browser type="content-primary" flex="1" id="content" src="about:blank"/>