Closed Bug 644192 Opened 11 years ago Closed 11 years ago

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


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

Not set





(Reporter: adam, Unassigned)




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[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 ( <-> 5 (

Nice if sombody can narrow down further using e.g.
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


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?
Ever confirmed: true
The issue is that mz_() in 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)....
Component: General → DOM: Core & HTML
Depends on: 639175
Ever confirmed: false
Keywords: regression, testcase
QA Contact: general → general
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.
Closed: 11 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.