<html>
<head>
<script>
document.writeln("<script>\nfunction f1() {\n window.foo1 = true;\n}\nf1();\n <" + "/script>");
</script>
<script>
console.assert(window.foo1, "FAIL: foo1");
</script>
<script>
function global1()
{
document.writeln("<script>\nfunction f2() {\n window.foo2 = true;\n}\nf2();\n <" + "/script>");
}
var x = global1();
</script>
<script>
console.assert(window.foo2, "FAIL: foo2");
</script>
</head>
</html>