Closed Bug 644192 Opened 13 years ago Closed 13 years ago

Firefox 4: Dynamically-created SELECT boxes have no OPTION tags, throw NS_ERROR_DOM_INDEX_SIZE_ERR error

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: adam, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0

All of the SELECT boxes within our web application are dynamically rendered:  they are created via document.write or inserted via AJAX. On every other browser they work fine. But with Firefox 4.0 they arrive without their OPTION tags, and the following error is generated:

NS_ERROR_DOM_INDEX_SIZE_ERR, Index or size is negative or greater than the allowed amount

Reproducible: Always

Steps to Reproduce:
1. Visit https://25live.collegenet.com/rowant/#event_search_advanced[0] with any browser other than Firefox 4. Five SELECT inputs are rendered and are properly populated.
2. Visit the same page with Firefox 4. All five SELECT inputs are without OPTIONS.

Actual Results:  
Dynamically rendered SELECT inputs do not have any OPTION tags. The following JavaScript error is generated:

NS_ERROR_DOM_INDEX_SIZE_ERR, Index or size is negative or greater than the allowed amount

Expected Results:  
Dynamically rendered SELECT boxes should have all their OPTIONS.

Our application uses Backbase, a GUI Framework that translates XML into HTML/CSS/Javascript. These SELECT boxes render fine in every other browser from IE6 to Chrome 10, including Firefox 3.x. Only Firefox 4 is choking on them.
I am able to get the OPTION tags to render if the SELECT tag is rendered first, then the OPTION tags are added to it.
Version: unspecified → Trunk
This broke between Alpha 4 (http://hg.mozilla.org/mozilla-central/rev/231cc7025b6f) <-> 5 (http://hg.mozilla.org/mozilla-central/rev/b2f7bc2aa0bc).

Nice if sombody can narrow down further using e.g. http://harthur.github.com/mozregression/
Severity: major → normal
Product: Firefox → Core
QA Contact: general → general
So...  The page has been changed so the problem can't be reproduced anymore.

Adam, do you have a page that shows the problem?
Nevemind; I got in by spoofing the UA.  But I don't see the error from comment 0. Is the site catching it and eating the exception?
XtC, thanks for the prelim range, that sped things up a lot.

Last good nightly: 2010-05-23 
First bad nightly: 2010-05-24

Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=37b7ca43fafe&tochange=da9e50cb4091

The only <select> related change I could see is:
Mounir Lamouri — Bug 551846. <select> size should default to 4 when 'multiple' attribute is present. r=smaug, sr=jst

(Note this is just a guess, there are other changesets in the range)

Provisionally CCing Mounir, any ideas about the range, could bug 551846 be the cause?
Status: UNCONFIRMED → NEW
Ever confirmed: true
The issue is that mz_() in https://25live.collegenet.com/backbase/3_3_1d/bpc/bpc_02.js tries to do |x.size = 0| where |x| is an HTMLSelectElement.

Per the current HTML5 spec text, which Firefox 4 implements, this is supposed to throw.  See bug 640800 and bug 639175.

This will be changed in an upcoming release, and a request made to change the spec, but in the meantime the workaround is to not set the size of a <select> to 0 (or to catch the exception when doing so)....
Status: NEW → UNCONFIRMED
Component: General → DOM: Core & HTML
Depends on: 639175
Ever confirmed: false
Keywords: regression, testcase
QA Contact: general → general
Status: UNCONFIRMED → NEW
Ever confirmed: true
Note that I have no idea what mz_() is _actually_ doing since it's all obfuscated.  I'm just observing us land in nsHTMLSelectElement::SetSize with aValue == 0 and the caller is that function.
Sorry about the example URL being blocked. I'm in the process of opening up a new URL that will remain unblocked to FF4. 

And yes, the obfuscated code of our GUI framework makes my life a nightmare. But thanks to all for your help! I will note as soon as the new example URL is available.
Example URL has been edited. There are five hidden SELECT boxes when the page initially loads. Clicking "More Search Options" attempts to replace each SELECT with a new one that has content. All of them trigger an error.
This should be fixed in current trunk.
Status: NEW → RESOLVED
Closed: 13 years ago
OS: Windows 7 → All
Hardware: x86 → All
Resolution: --- → FIXED
It should be fixed with Firefox 4.0.1 (next minor release).
You need to log in before you can comment on or make changes to this bug.