Too many javascript events freezes browser (exponential setTimeout/setInterval growth)

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
7 years ago
a month ago

People

(Reporter: mcmanus, Unassigned)

Tracking

11 Branch
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
JS that creates lots of events (in the case below an ever increasing set of events) can almost completely freeze the UI - so much so that you can't even close the tab. The runaway script dialog never comes up - killing the browser is pretty much the only path. Some sort of runaway detection would be desirable.

2 examples:

function f() {
    for (var i = 0; i < 32; ++i) setTimeout(f);
}
setTimeout(f);

and (derived from a real bug):

function chatRoomClass(){};
var reconnection;
var ctr = 32;

iv=function ()
{
    cr.ws.close();
    for(j=0;j<ctr;j++)
	cr.initws();
}

chatRoomClass.prototype.initws=function()
{
    self=this;
    if("WebSocket"in window)
    {
	if(this.ws!=null)
        {
            this.ws.close();
        }

	this.ws=new WebSocket("ws://doesntreallyexist.tv:88/1");
	var self=this;
	reconnection=setInterval(function(){;clearInterval(reconnection); 
					    iv();}, 1);
    }
};

cr = new chatRoomClass();
cr.initws();
Component: XPConnect → DOM
QA Contact: xpconnect → general
Summary: Too many javascript events freezes browser → Too many javascript events freezes browser (exponential setTimeout/setInterval growth)
Duplicate of this bug: 1108286
No longer depends on: 1300118
I believe this should be fixed now that bug 1300659 has landed.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.