mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
fix: 数组 push/pop/shift/unshift 按规范接收 arraylike 与字符串接收者
This commit is contained in:
@@ -383,6 +383,15 @@ impl Vm {
|
||||
if obj.is_array() && prop_name_si == length_si {
|
||||
return self.set_array_length_value(obj, val, strict, builtin);
|
||||
}
|
||||
// 字符串 exotic 的 length 是 [[Writable]]: false 的固有数据属性(规范
|
||||
// String exotic [[Set]]):写不成立,严格抛 TypeError、sloppy 静默
|
||||
// no-op——不得落命名属性区。
|
||||
if obj.is_string_obj() && prop_name_si == length_si {
|
||||
if strict {
|
||||
return self.write_protection_failure(builtin, "cannot assign to read-only property");
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
if let Some(pos) = self.get_own_property_slot(obj, prop_name_si) {
|
||||
if let Some(meta) = obj.prop_meta_at(pos) {
|
||||
if meta.is_accessor {
|
||||
|
||||
Reference in New Issue
Block a user