Mochitest for bug 377539. b=377539 r=bzbarsky

This commit is contained in:
mats.palmgren@bredband.net 2007-05-09 06:27:59 -07:00
parent e322c0eedc
commit 689855b929
2 changed files with 53 additions and 0 deletions

View File

@ -51,6 +51,7 @@ _TEST_FILES = \
test_bug342448.html \
test_bug345521.html \
test_bug351601.html \
test_bug377539.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=377539
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Testcase for bug 377539</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=377539">Mozilla Bug 377539</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<script type="text/javascript">
var sw;
var child_sw = -1;
function test(){
var t = '<div style="display: none;"><iframe src="data:text/html,<body><scr'+'ipt>try {parent.child_sw=screen.width}catch(e){}</scr'+'ipt>"></iframe></div>';
var div = document.createElement('div');
div.innerHTML = t;
document.getElementsByTagName('body')[0].appendChild(div);
}
try {
sw = screen.width;
} catch (e) {
sw = -1;
}
test();
</script>
<pre id="test">
<script class="testbody" type="text/javascript">
isnot(sw, -1, "screen.width threw an exception");
is(child_sw, sw, "iframe got wrong screen.width");
</script>
</pre>
</body>
</html>