avm2: Throw when using delete with XMLList operand (name)

This commit is contained in:
Tom Schuster 2024-08-25 14:02:19 +02:00
parent a4f03173c2
commit 102e58b551
1 changed files with 12 additions and 0 deletions

View File

@ -1514,6 +1514,18 @@ impl<'a, 'gc> Activation<'a, 'gc> {
}
// main path for dynamic names
if multiname.has_lazy_name() {
let name_value = self.context.avm2.peek(0);
if matches!(name_value, Value::Object(Object::XmlListObject(_))) {
// ECMA-357 11.3.1 The delete Operator
// If the type of the operand is XMLList, then a TypeError exception is thrown.
return Err(Error::AvmError(type_error(
self,
"Error #1119: Delete operator is not supported with operand of type XMLList.",
1119,
)?));
}
}
let multiname = multiname.fill_with_runtime_params(self)?;
let object = self.pop_stack();
let object = object.coerce_to_object_or_typeerror(self, Some(&multiname))?;