1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/test/test_bug680257.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=680257 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 680257</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=680257">Mozilla Bug 680257</a> 1.16 + 1.17 +<script type="application/javascript;version=1.7"> 1.18 + 1.19 +SimpleTest.waitForExplicitFinish(); 1.20 + 1.21 +var popup = window.open('file_bug680257.html'); 1.22 + 1.23 +// The popup will call into popupLoaded() once it loads. 1.24 +function popupLoaded() { 1.25 + // runTests() needs to be called from outside popupLoaded's onload handler. 1.26 + // Otherwise, the navigations we do in runTests won't create new SHEntries. 1.27 + SimpleTest.executeSoon(runTests); 1.28 +} 1.29 + 1.30 +function runTests() { 1.31 + checkPopupLinkStyle(false, 'Initial'); 1.32 + 1.33 + popup.location.hash = 'a'; 1.34 + checkPopupLinkStyle(true, 'After setting hash'); 1.35 + 1.36 + popup.history.back(); 1.37 + checkPopupLinkStyle(false, 'After going back'); 1.38 + 1.39 + popup.history.forward(); 1.40 + checkPopupLinkStyle(true, 'After going forward'); 1.41 + 1.42 + popup.close(); 1.43 + SimpleTest.finish(); 1.44 +} 1.45 + 1.46 +function checkPopupLinkStyle(isTarget, desc) { 1.47 + var link = popup.document.getElementById('a'); 1.48 + var style = popup.getComputedStyle(link); 1.49 + var color = style.getPropertyValue('color'); 1.50 + 1.51 + // Color is red if isTarget, black otherwise. 1.52 + if (isTarget) { 1.53 + is(color, 'rgb(255, 0, 0)', desc); 1.54 + } 1.55 + else { 1.56 + is(color, 'rgb(0, 0, 0)', desc); 1.57 + } 1.58 +} 1.59 + 1.60 +</script> 1.61 +</body> 1.62 +</html>