Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIDL attributes reflecting non-negative integer content attributes should throw IndexSizeError when set to a negative number #7461
Comments
|
I was reading the code wrong. This is accomplished by make_limited_uint_getter. |
|
Actually a real problem:
|
|
The first correctly fails silently and yields the default value. The second should throw an IndexSizeError exception. |
|
Your link is for
HTMLInputElement.size is actually
See #5923, web-platform-tests/wpt#1802, AFAICT the attribute you mention is already covered in WPT, with all its associated edge cases. Edit: fixed quote for unsigned long. |
|
And the testcase from above? |
|
This is the intended behaviour AFAIK. Let me try to reread the tests code and see where the hell that's actually tested. |
|
Oh right, my mistake. Firefox behaves the same as Servo. This is more relevant for #7323. |
|
servo/tests/wpt/web-platform-tests/html/dom/reflection.js Lines 422 to 462 in 576aad5 |
An example is
document.createElement('input').size = -5. Firefox throws an exception; Servo silently sets it to -1. https://html.spec.whatwg.org/multipage/infrastructure.html#limited-to-only-non-negative-numbers says that Firefox is right.We need to modify
parse_plain_attributeto return aResult<AttrValue, Error>, and take an argument indicating whether the attribute is being set by the parser or not. If it is, the default value should be used; if it's not, anErr(IndexSizeError)value should be returned instead.Code: components/script/dom/element.rs, components/script/dom/virtualmethods.rs