Last Comment Bug 439323 - sizeToContent() not always working
: sizeToContent() not always working
Status: NEW
: regression
Product: Core
Classification: Components
Component: General (show other bugs)
: Trunk
: x86 Windows XP
-- major with 6 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: 466886 (view as bug list)
Depends on: 465448
Blocks: reflow-refactor
  Show dependency treegraph
Reported: 2008-06-15 07:49 PDT by Ramiro Aparicio
Modified: 2011-08-19 04:52 PDT (History)
16 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

"testcase" (11.15 KB, application/vnd.mozilla.xul+xml)
2008-06-15 07:54 PDT, Ramiro Aparicio
no flags Details
screenshot of the problem (42.13 KB, image/png)
2008-06-15 14:07 PDT, Ria Klaassen (not reading all bugmail)
no flags Details
minimal test case (865 bytes, application/vnd.mozilla.xul+xml)
2008-11-25 08:02 PST, Paul Rouget [:paul]
no flags Details

Description User image Ramiro Aparicio 2008-06-15 07:49:13 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9) Gecko/2008052906 Firefox/3.0

I am a extension developer and I got a bug report for this, I thought that I was not calling sizeToContent() in some situation but it seems FF3 has some problems with setting false and element in XUL and resizing as it does not resize correctly.

I have tested adding it to a setTimeout to see if that helps and nothing.

Reproducible: Always

Steps to Reproduce:
1. Install Foxgame (probably it can be found a minimal case but this is what I have) from
2. Open Tools -> Add-ons -> Foxgame Options.
3. Select 4 tab "Messages"
4. In the bottom click on Add, and in the new dialog check "From"
Actual Results:  
The from textarea is shown but the window is not resized even after a window.sizeToContent() call.

Expected Results:  
It should have resized the dialog.
If after that you select "Spy Report" it resizes without problem, but not only that, if you select back "PM" now checking/unchecking resizes as it should.

I have tried it on a FF3 RC2 protable clean installation, my reports are that this happens in RC1 and RC2 but I have not tested it on other version / OS.
Comment 1 User image Ramiro Aparicio 2008-06-15 07:54:40 PDT
Created attachment 325167 [details]

It's the code of the dialog giving problems, it is not working as is as it uses DTD-entities and external javascript files, but removing calls and entities should show the same behavior.
Comment 2 User image Ria Klaassen (not reading all bugmail) 2008-06-15 14:07:38 PDT
Created attachment 325198 [details]
screenshot of the problem
Comment 3 User image Ria Klaassen (not reading all bugmail) 2008-06-15 14:10:13 PDT
This was caused by Bug 300030.
Comment 4 User image Andy McDonald 2008-06-24 17:42:20 PDT
I've seen the same issue while working on the Firefox extension FoxClocks. Previous release versions of Firefox (<= 2.x) are unaffected.

To reproduce: call window.sizeToContent() where no resizing is necessary - subsequent calls to window.sizeToContent() then fail. Thus the behaviour can seem intermittent. (Corollary: workaround is to call window.sizeToContent() only when resizing will occur, e.g. on hiding/unhiding an element.)
Comment 5 User image ricky 2008-08-18 10:59:33 PDT
The workaround doesn't seems to work in all cases either. I call sizeToContent once ever in the beginning of my javascript and it makes the window as small as possible making the entire page disappear. The window has plenty of content at that point and should have resized. Was introduced in FF3 as it works fine in FF1&2  
Comment 6 User image Nils Maier [:nmaier] 2008-09-08 00:43:33 PDT
Some of our users confirm this as well:

Was supposed to be fixed by: bug 371508
Comment 7 User image Eric Appleman 2008-11-05 09:25:04 PST
This bug breaks the popup window feature of my extension, Text-to-Image, on Windows XP, Windows Vista, and Linux (Firefox 3.1 builds only).

In either case, a zero height/width popup is created that is either invisible, unresizable, or only as large as the window header.
Comment 8 User image Paul Rouget [:paul] 2008-11-25 08:00:17 PST
If sizeToContent is called when the size already fit to the content, then all next calls to sizeToContent will not work.

If you get ride of this test :

sizeToContent has the correct behavior.

I don't know why, but I think we are on to something.
Comment 9 User image Paul Rouget [:paul] 2008-11-25 08:02:40 PST
Created attachment 349968 [details]
minimal test case

Open this xul dialog page :
Click on hide, then show, then hide, then show, ... it works.
But click twice on hide or show, it stops working.
Comment 10 User image Nils Maier [:nmaier] 2008-11-27 13:24:18 PST
*** Bug 466886 has been marked as a duplicate of this bug. ***
Comment 11 User image Paul Rouget [:paul] 2009-01-14 07:30:11 PST
Seems to work know. Resolved ?
Comment 12 User image Martijn Wargers [:mwargers] 2009-01-14 09:15:56 PST
Yes, it seems to work for me in current trunk build with the testcases.
However, the FoxGame extension gives me problems trying out if it works there. I get js errors in the error console, so I can't really test the extension.
Paul, you mean this seems to work now that bug 465448 is fixed?
Comment 13 User image ricky 2010-03-01 11:49:18 PST
Still broken:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
Comment 14 User image Dennis Jakobsen 2011-08-19 04:52:38 PDT
Since 7.0b1 candidate .resizeBy is also broken, and it's always!

Nothing in dev toolbar or firebug.

Note You need to log in before you can comment on or make changes to this bug.