1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/test/test_bug477700.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=477700 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 477700</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=477700">Mozilla Bug 477700</a> 1.16 +<p id="display"> 1.17 + <iframe id="i" 1.18 + src="http://example.com/tests/layout/forms/test/bug477700_subframe.html"></iframe> 1.19 +</p> 1.20 +<div id="content" style="display: none"> 1.21 + 1.22 +</div> 1.23 +<pre id="test"> 1.24 +<script type="application/javascript"> 1.25 + 1.26 +/** Test for Bug 477700 **/ 1.27 +SimpleTest.waitForExplicitFinish(); 1.28 +addLoadEvent(function() { 1.29 + isnot(window.location.host, "example.com", "test is not testing cross-site"); 1.30 + var accessed = false; 1.31 + try { 1.32 + $("i").contentDocument.documentElement; 1.33 + accessed = true; 1.34 + } catch(e) {} 1.35 + is(accessed, false, "Shouldn't be able to access cross-site"); 1.36 + 1.37 + $("i").style.display = "none"; 1.38 + document.body.offsetWidth; 1.39 + is(document.defaultView.getComputedStyle($("i"), "").display, "none", 1.40 + "toggling display failed"); 1.41 + $("i").style.display = ""; 1.42 + document.body.offsetWidth; 1.43 + is(document.defaultView.getComputedStyle($("i"), "").display, "inline", 1.44 + "toggling display back failed"); 1.45 + 1.46 + $("i").contentWindow.postMessage("start", "*"); 1.47 +}); 1.48 + 1.49 +window.addEventListener("message", 1.50 + function(evt) { 1.51 + var arr = evt.data.split(/ /).map(decodeURIComponent); 1.52 + if (arr[0] == 't') { 1.53 + is(arr[1], arr[2], arr[3]); 1.54 + } else if (arr[0] == 'f') { 1.55 + SimpleTest.finish(); 1.56 + } 1.57 + }, 1.58 + false); 1.59 + 1.60 +</script> 1.61 +</pre> 1.62 +</body> 1.63 +</html>