IDLGenerators: Set reflected unsigned long value according to spec

Setting an unsigned long attribute with IDL to a value outside the
range 0 to 2147483647, the value should be set to the default value.
This commit is contained in:
Tim Ledbetter 2024-11-26 19:46:55 +00:00 committed by Andreas Kling
commit e5c99b475a
Notes: github-actions[bot] 2024-11-27 10:04:07 +00:00
3 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
function testProperty(elementName, propertyName, propertyGetter, propertySetter) {
const attributeName = propertyName.toLowerCase();
function setValue(value) {
let element = document.createElement(elementName);
element.setAttribute(attributeName, value.toString());
println(`${elementName}.getAttribute("${attributeName}") after ${elementName}.setAttribute("${propertyName}", "${value}"): ${element.getAttribute(`${attributeName}`)}`);
println(`${elementName}.${propertyName} after ${elementName}.setAttribute("${attributeName}", "${value}"): ${propertyGetter(element)}`);
element = document.createElement(elementName);
propertySetter(element, value);
println(`${elementName}.getAttribute("${attributeName}") after ${elementName}.${propertyName} = ${value}: ${element.getAttribute(attributeName)}`);
println(`${elementName}.${propertyName} after ${elementName}.${propertyName} = ${value}: ${propertyGetter(element)}`);
}
setValue(1);
setValue(2147483647);
setValue(2147483648);
setValue(4294967295);
}
testProperty("img", "hspace", (img) => img.hspace, (img, value) => img.hspace = value);
});
</script>