Closed Bug 442344 Opened 17 years ago Closed 17 years ago

Using a combination of while, try, catch and delete to prevent too many recursions

Categories

(Firefox :: General, defect)

x86
Windows Vista
defect
Not set
critical

Tracking

()

VERIFIED INCOMPLETE

People

(Reporter: xymuu, Unassigned)

Details

(Keywords: crash)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0 When using the following code (or similar) [at least for me] firefox crashes instantly. It uses a practically infinite loop and try try and catch. When the error "too many recursions" occurs, the code in the catch part gets executed. In the catch part, a new instance of the same function is made, and (I presume executed). The script loops forever causing a crash. function m(){ i=0; while(i<10000){ try{ document.write("Hello World<br>"); delete m(); document.write("Hello World<br>"); } catch(e){ new m(); i++; } } } m(); Reproducible: Always Steps to Reproduce: 1. Copy the above code. Actual Results: Instant crash. Blank page. Expected Results: Script terminated after a period of loops.
Error console is the window that you see if you open Firefox:Tools/Error Console Reporter: Can you please submit a crash report with the Mozilla crash reporter and get a crash ID from about:crashes (enter it as URL) and post the ID here. It would be also nice if you could attach the testcase using "add an attachment"
Component: Error Console → General
Keywords: crash
QA Contact: error.console → general
Attached file testcase
Here, I've created a file for the given testcase. No crash here, but it did give me an odd GUI lockup. Not a freeze; still could click buttons, bring up context menus, and had mouseover effects. However, nothing worked at all. Had to kill. (3.0 on Linux)
If it wasn't clear, it never prompted to halt. No blank page either. I got a page full of "Hello World" lines.
Repeated the test in Windows XP SP3 and got similar results there, except that it turned into a full hang. Ditching the caution and switching to while(true) forces a recursion warning, however it comes up as a blank textless window with 2 skinny textless buttons that do nothing. I can, however, close it and then close the tab and recover without any noticeable problems. (both Win and Linux)
Testing the attachment by Dave Garrett, if the tab wasn't active the stop script dialogue box wouldn't come up and firefox froze (but didn't get a not responding message when clicked etc). The second time with the tab not active, firefox froze for about 10 seconds (with vista asking me to wait or end program) and then I got a stop script dialogue (with no text) appearing over my active tab, which was fully functional. With the attachment I do see the words Hello World over and over again, however in the example I posted, I didn't see anything- I got an instant crash. Perhaps it is due to the fact that I called the example while the page was loading, whereas the uploaded example uses a load event to call it. Or it could be that I viewed the page clientside (though I don't think this would affect anything) I'll see if I can see what the difference between the codes is later today, however the only difference I can see is the ones above.
The you saw a crash or a hang/freeze ?
(In reply to comment #5) > in the example I posted, I didn't see anything- I got an instant crash. Then attach your file that does that. ;)
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INCOMPLETE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: