Open Bug 439323 Opened 12 years ago Updated 9 years ago

sizeToContent() not always working

Categories

(Core :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

People

(Reporter: frisco82, Unassigned)

References

Details

(Keywords: regression)

Attachments

(3 files)

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 http://www.foxgame.org/foxgame.xpi
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.
Attached file "testcase"
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.
This was caused by Bug 300030.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
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.)
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  
Summary: sizeToContent() not allways working → sizeToContent() not always working
Some of our users confirm this as well:
http://bugs.code.downthemall.net/trac/ticket/731

Was supposed to be fixed by: bug 371508
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.
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 :
http://mxr.mozilla.org/mozilla-central/source/xpfe/appshell/src/nsXULWindow.cpp#1714

sizeToContent has the correct behavior.

I don't know why, but I think we are on to something.
Attached file 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.
Duplicate of this bug: 466886
Depends on: 465448
Seems to work know. Resolved ?
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?
Still broken:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
Since 7.0b1 candidate .resizeBy is also broken, and it's always!

Nothing in dev toolbar or firebug.
You need to log in before you can comment on or make changes to this bug.