Open Bug 580460 Opened 11 years ago Updated 2 years ago

Hang for several Seconds with several hundred window.addEvent() functions


(Core :: DOM: Core & HTML, defect, P5)

2.0 Branch




(Reporter: vincent-moz, Unassigned)




(Keywords: hang, testcase, Whiteboard: DUPEME)


(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-GB; rv: Gecko/20100713 Firefox/3.6.7
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-GB; rv: Gecko/20100713 Firefox/3.6.7

On some pages, Firefox freezes for more than 10 seconds. During this time, I can do nothing with Firefox.

Reproducible: Always

Steps to Reproduce:
1. Open the above URL.
Actual Results:  
Most of the page is rendered in the first few seconds, except "Liste des films". Then Firefox freezes for about 20 - 25 seconds. During this time, the mouse pointer is replaced by a wheel, and I cannot use Firefox (not even minimize the window). Firefox takes more than 100% CPU time.

Expected Results:  
While the page is being rendered, one should be able to use Firefox, e.g. the other tabs.

I suppose that a web site could freeze Firefox for an arbitrary amount of time, by doing the same kind of things.
Version: unspecified → 3.6 Branch
I've tried to reproduce the problem on a Linux machine, and it is a bit difficult because the machine is much faster. I used cpulimit to limit the CPU%, and I could reproduce the freeze with:

  Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110515 Firefox/6.0a1
Version: 3.6 Branch → 4.0 Branch
I am seeing this with Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1. Getting a freeze of approx 5-7 seconds, with a CPU usage on one core spiking up to about 85%. I'll try to throw a testcase together.
Ever confirmed: true
OS: Mac OS X → All
Hardware: PowerPC → All
Summary: Firefox freezes for 20 - 25 seconds on → Firefox freezes for several seconds on
Attached file Testcase
Looks like this may be caused by a large number of window.addEvent, I think it was 488 or so.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: 4.0 Branch → 2.0 Branch
Summary: Firefox freezes for several seconds on → Hang for several Seconds with several hundred window.addEvent() functions
The addEvent per se is not the problem.  All of those functions are onload handlers, so they're all called at onload.  On my machine that takes about 1.5s (in Firefox; about 3s in Chrome ad 5s in Opera). 

The actual time this takes to run is mostly getting attributes, getting stuff from content lists, JS execution.  All things we're working on.

So apart from that there are two issues:

1)  The slow script warning doesn't fire if we keep entering and exiting scripts (as here).  There's an existing bug on that, I think.

2)  We have only one process.  We have an existing bug on e10s.
Assignee: general → nobody
Component: JavaScript Engine → DOM
QA Contact: general → general
Whiteboard: DUPEME

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.