You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTMLOptionsCollection length setter should specify what happens when you go over the option limit. #8337
All browsers have an implementation limit to avoid blowing up with a snippet like the one below. WebKit and Gecko agree on that limit being 10000, but Blink seems to have changed that limit for some reason?
The behavior where the limit is surpassed is undefined: Gecko throws, WebKit/Blink just warn to the console. We can probably standardize on the WebKit / Blink behavior (just do nothing), but the spec should probably explicitly mention this.
I'm also curious about why the limit was changed in Blink?
We had 10,000 limit only when we add OPTIONs via IDL features, and no limit for OPTIONs added by the HTML parser. We observed 40,000+ OPTIONs were practically used, and the 10,000 limit didn't make sense.
I guess the point is it'd be weird if you had <select>... 50_000 options ...</select> via the parser, and then did select.options.length++, that would truncate you down to 10_000 options. Hmm....
I'm ok with the spec and behavior having a reasonable limit, much smaller than INT_MAX. However, I don't think we should start throwing when that limit is exceeded, since that could break things. I think a console warning and a refusal to set lengths > SPEC_LIMIT should hopefully be enough to keep people from having problems, right?
In Gecko and WebKit it wouldn't truncate, it just won't do anything.
I don't feel too strongly about the precise limit. 10000 matches two of the three engines and I've never seen a bug about people requesting more, so I don't think we need to raise it, but I wouldn't be opposed to do so... How strongly do you feel about it @mfreed7?
I don't feel too strongly about the precise limit. 10000 matches two of the three engines and I've never seen a bug about people requesting more, so I don't think we need to raise it, but I wouldn't be opposed to do so... How strongly do you feel about it @mfreed7?
I’m just worried about compat, given that it’s lower than before and the comment in our codebase suggesting problems with 40,000.
Activity
emilio commentedon Sep 29, 2022
The comment in the blink code doesn't make sense to me: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/forms/html_select_element.cc;l=93;drc=a432cd59d51281057ba2a2673ca645a9600bb927
domenic commentedon Sep 29, 2022
I found when Blink changed: https://source.chromium.org/chromium/chromium/src/+/a736194f01cfbb2688134cdfdf66f85996719ee4
I guess the point is it'd be weird if you had
<select>... 50_000 options ...</select>via the parser, and then didselect.options.length++, that would truncate you down to 10_000 options. Hmm....emilio commentedon Sep 30, 2022
In Gecko and WebKit it wouldn't truncate, it just won't do anything.
Specify a limit in HTMLOptionsCollection.length setter.
emilio commentedon Oct 2, 2022
#8347 is the PR for this. Tests are up in the mozilla bug (a volunteer contributed the patch).
mfreed7 commentedon Oct 3, 2022
I'm ok with the spec and behavior having a reasonable limit, much smaller than INT_MAX. However, I don't think we should start throwing when that limit is exceeded, since that could break things. I think a console warning and a refusal to set lengths > SPEC_LIMIT should hopefully be enough to keep people from having problems, right?
In Chromium also, I think: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/forms/html_select_element.cc;l=485;drc=a2a75509d6058498d6e00ca225455a53b1006188
Given the comment that options lists of 40k+ were observed (5 years ago), perhaps we should choose a limit like 100,000?
Specify a limit in HTMLOptionsCollection.length setter.
emilio commentedon Oct 7, 2022
I don't feel too strongly about the precise limit. 10000 matches two of the three engines and I've never seen a bug about people requesting more, so I don't think we need to raise it, but I wouldn't be opposed to do so... How strongly do you feel about it @mfreed7?
emilio commentedon Oct 7, 2022
Ok as per #8347 (comment), raising it to 100000 sounds good to me. @rniwa @smfr @nt1m, would WebKit be fine with raising it?
It'd be just adding one zero here: https://searchfox.org/wubkat/rev/e8e9be7353991aee7df45aa62f0e0148f16e6f9f/Source/WebCore/html/HTMLSelectElement.cpp#69
mfreed7 commentedon Oct 11, 2022
I’m just worried about compat, given that it’s lower than before and the comment in our codebase suggesting problems with 40,000.
Specify a limit in HTMLOptionsCollection.length setter.
Restore 100,000 limit in HTMLOptionsCollection.length setter
Restore 100,000 limit in HTMLOptionsCollection.length setter
Restore 100,000 limit in HTMLOptionsCollection.length setter
Bug 1800151 [wpt PR 36917] - Restore 100,000 limit in HTMLOptionsColl…
Bug 1800151 [wpt PR 36917] - Restore 100,000 limit in HTMLOptionsColl…
Specify a limit for HTMLOptionsCollection's length setter
Bug 1800151 [wpt PR 36917] - Restore 100,000 limit in HTMLOptionsColl…