1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/bugs/test_bug377539.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=377539 1.8 +--> 1.9 +<head> 1.10 + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 1.11 + <title>Testcase for bug 377539</title> 1.12 + 1.13 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.15 +</head> 1.16 +<body> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=377539">Mozilla Bug 377539</a> 1.18 + 1.19 +<p id="display"></p> 1.20 +<div id="content" style="display: none"> 1.21 + 1.22 +</div> 1.23 + 1.24 +<script type="text/javascript"> 1.25 +var sw; 1.26 +var child_sw = -1; 1.27 + 1.28 +function test(){ 1.29 + var t = '<div style="display: none;"><iframe onload="doChecks()" src="data:text/html,<body><scr'+'ipt>try {parent.child_sw=screen.width}catch(e){}</scr'+'ipt>"></iframe></div>'; 1.30 + var div = document.createElement('div'); 1.31 + div.innerHTML = t; 1.32 + document.getElementsByTagName('body')[0].appendChild(div); 1.33 +} 1.34 + 1.35 +try { 1.36 + sw = screen.width; 1.37 +} catch (e) { 1.38 + sw = -1; 1.39 +} 1.40 + 1.41 +</script> 1.42 + 1.43 +<pre id="test"> 1.44 +<script class="testbody" type="text/javascript"> 1.45 +function doChecks() { 1.46 + isnot(sw, -1, "screen.width threw an exception"); 1.47 + is(child_sw, sw, "iframe got wrong screen.width"); 1.48 + SimpleTest.finish(); 1.49 +} 1.50 + 1.51 +SimpleTest.waitForExplicitFinish(); 1.52 + 1.53 +test(); 1.54 + 1.55 +</script> 1.56 +</pre> 1.57 +</body> 1.58 +</html>