Open Bug 840412 Opened 10 years ago Updated 2 years ago

Resize event handler being called before current executing function returns


(Core :: DOM: Events, defect, P5)

12 Branch
Windows 7




(Reporter: perroazul64, Unassigned)


(Keywords: regression, testcase)


(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130201065344

Steps to reproduce:

Added an event listener for the window resize event. The event handler calls a function through setTimeout. The function accesses the offsetWidth property of an element.

Actual results:

When I trigger a lot of resize events (resizing the window manually), the event handler is called in the middle of the function execution (the one called through setTimeout).

Expected results:

The event handler should be called after the current execution terminates.
Attachment #712801 - Attachment mime type: text/plain → text/html
Component: Untriaged → Event Handling
Product: Firefox → Core
Component: Event Handling → DOM: Events
Ever confirmed: true
(In reply to Loic from comment #1)
> Regression range:
> m-c
> good=2012-01-15
> bad=2012-01-16
> pushloghtml?fromchange=21c84409902e&tochange=047c8ba7d2e4
> m-i
> good=2012-01-14
> bad=2012-01-15
> pushloghtml?fromchange=256c57537507&tochange=006ab8403475
> My guess goes to bug 598482.

It looks like this fell through the cracks. Markus, since you were the developer on bug 598482, can you have a look into this?
Flags: needinfo?(mstange)
I've tried to reproduce the bug with Nightly on Mac OS X and with Release Firefox on Windows 7, and didn't see anything printed to the console. Has this been fixed in the meantime?
Flags: needinfo?(mstange) → needinfo?(perroazul64)
Attached file resizeduringexec.html
additional script to recreate issue.  
1. Body will be empty.
2. Open dev tools and embed in the bottom of window
3. move divider between dev tools and body region, thus resizing body region
4. when resize handler runs while wtf function is running then text is displayed in body, console message and trace are logged and debugger (breakpoint) occurs.
A coworker of mine recently ran into this bug as well.  He initially ran into it in IE11, but after creating a simple html+js case to reproduce he found that he could also recreate the issue in FireFox.

I just tried it with the recreation html/js attached to this issue and I was able to reproduce in nightly (48.0a1) as well as Firefox 45.0.1.   

However, I didn't reproduce it by changing the size of the entire window.  Instead, I had the devtools embedded in the bottom of the window and I changed the height of the devtools region.  This would cause the console message "Resize event called before foo() returned." to be logged reliably and frequently.

I have attached an additional script for recreating.
Thanks for the testcase. I can reproduce the problem on OS X.

Mats, would you like to fix this?
Flags: needinfo?(perroazul64) → needinfo?(mats)
And I don't like the current HTML spec for resize event firing. It puts too much pressure on the
animation frame tick time.
One option for bug 1149555 is to do it only for web content.
Sorry, I'm busy with other stuff for a while (implementing Grid & Align specs).
Flags: needinfo?(mats)

Bulk-downgrade of unassigned, 4 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.