Javascript - three level deep call gets stuck

RESOLVED DUPLICATE of bug 114461

Status

()

RESOLVED DUPLICATE of bug 114461
13 years ago
13 years ago

People

(Reporter: andrew.ray, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.12) Gecko/20050919 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.12) Gecko/20050919 Firefox/1.0.7

I have pasted in an example minimal html example which works in IE but not FF. As you can see, FunctionOne() calls FunctionTwo() and thnis calls FunctionThree(). However in FF function 3 never happens and the browser hangs.

*** HTML problem example code follows ***
<html>
    <head>
		<script language="JavaScript">
            function FunctionThree()
            {
                alert("FireFox never processes this");
            }

            function FunctionTwo()
            {
                // IE has no problem and shows both alert boxes, however
                // FireFox gets stuck when calling FunctionThree() below
                // but why - there seems to be no reason for this.
                document.open();
                document.write("<html>\n");
                document.write("Hello World");

                alert("FireFox processes this");
                FunctionThree();       // **** Firefox 1.7.12 Gecko/20050919 1.0.7 is now stuck ****

                document.write("<BR>Hello World again");
                document.write("</html>\n");
                document.close();
            }
            
            function FunctionOne()
            {
                FunctionTwo();
            }
		</script>
    </head>
    <body>
		<form name="f" method="POST" onSubmit="FunctionOne(); return false;" ID="Form1">
			<input type="submit" value="Submit" ID="Submit1" NAME="Submit1">
		</form>
    </body>
</html>


Reproducible: Always

Steps to Reproduce:
1.Copy the html pasted in code out of details into a file called test.html
2.Run it in IE and you should get "Hello World", two alert boxes and "Hello World again" on screen
3.Run it in FF. after first alert("FireFox processes this"), the broser gets stuck.

Actual Results:  
Hello World

Expected Results:  
Hello World
Hello World again

This happens on any computer running this version of FF.
This hangs the client end of the interface.

Comment 1

13 years ago
This is because document.open() clobbers the JS scope.

*** This bug has been marked as a duplicate of 114461 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.