Closed Bug 317764 Opened 19 years ago Closed 19 years ago

Javascript - three level deep call gets stuck

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 114461

People

(Reporter: andrew.ray, Unassigned)

Details

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.
This is because document.open() clobbers the JS scope.

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