fix: URI 四函数正确性修复并新增 AsyncIteratorPrototype 原型

This commit is contained in:
2026-09-24 18:39:28 +00:00
parent 53505dc38c
commit 31d4082210
8 changed files with 297 additions and 31 deletions
+4 -1
View File
@@ -371,7 +371,7 @@ pub(crate) fn wire_builtin_world_links(world: &BuiltinWorld) {
}
let obj_proto_val = JsValue::from_js_object(world.object_proto.as_ptr() as *mut JsObject);
let non_object_protos: [&P<JsObject>; 27] = [
let non_object_protos: [&P<JsObject>; 28] = [
&world.array_proto,
&world.function_proto,
&world.string_proto,
@@ -399,6 +399,7 @@ pub(crate) fn wire_builtin_world_links(world: &BuiltinWorld) {
&world.bigint_proto,
&world.disposable_stack_proto,
&world.async_disposable_stack_proto,
&world.async_iterator_proto,
];
for proto in &non_object_protos {
set_proto_if_changed(proto, obj_proto_val);
@@ -553,6 +554,7 @@ impl BuiltinWorld {
let set_iterator_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
let string_iterator_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
let regexp_string_iterator_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
let async_iterator_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
let iterator_helper_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
let disposable_stack_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
let async_disposable_stack_proto = P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
@@ -664,6 +666,7 @@ impl BuiltinWorld {
set_iterator_proto,
string_iterator_proto,
regexp_string_iterator_proto,
async_iterator_proto,
iterator_helper_proto,
disposable_stack_proto,
async_disposable_stack_proto,
@@ -456,6 +456,7 @@ impl BuiltinWorld {
set_iterator_proto,
string_iterator_proto,
regexp_string_iterator_proto,
async_iterator_proto,
iterator_helper_proto,
disposable_stack_proto,
async_disposable_stack_proto,
@@ -470,6 +471,7 @@ impl BuiltinWorld {
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
P::new(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())),
)
} else {
(
@@ -479,6 +481,7 @@ impl BuiltinWorld {
current.set_iterator_proto.clone(),
current.string_iterator_proto.clone(),
current.regexp_string_iterator_proto.clone(),
current.async_iterator_proto.clone(),
current.iterator_helper_proto.clone(),
current.disposable_stack_proto.clone(),
current.async_disposable_stack_proto.clone(),
@@ -594,6 +597,7 @@ impl BuiltinWorld {
set_iterator_proto,
string_iterator_proto,
regexp_string_iterator_proto,
async_iterator_proto,
iterator_helper_proto,
disposable_stack_proto,
async_disposable_stack_proto,
+6 -1
View File
@@ -134,6 +134,9 @@ pub struct BuiltinWorld {
pub string_default_iterator: std::cell::Cell<*const JsObject>,
/// `%RegExpStringIteratorPrototype%`:matchAll 返回的迭代器。
pub regexp_string_iterator_proto: P<JsObject>,
/// `%AsyncIteratorPrototype%`:异步迭代器原型(链到 Object.prototype),
/// 持有 `@@asyncIterator`/`@@asyncDispose`;`%AsyncGeneratorPrototype%` 链到它。
pub async_iterator_proto: P<JsObject>,
/// `%IteratorHelperPrototype%`:Iterator helpers 结果对象的共享原型,链到 %IteratorPrototype%。
pub iterator_helper_proto: P<JsObject>,
/// `DisposableStack.prototype`:同步资源栈原型(链到 Object.prototype),
@@ -350,7 +353,7 @@ impl BuiltinWorld {
/// session 收尾(`teardown_heap_data`)与选择性重建收尾(`retire_replaced`)
/// 的 P 字段枚举唯一入口:`BuiltinWorld` 新增 P 字段须在此同步补一行,否则
/// 收尾时该字段属性区无法释放、重建原型槽改写/释放漏掉该字段。
pub(crate) fn all_p_fields(&self) -> [&P<JsObject>; 107] {
pub(crate) fn all_p_fields(&self) -> [&P<JsObject>; 108] {
[
&self.object_proto,
&self.array_proto,
@@ -455,6 +458,7 @@ impl BuiltinWorld {
&self.set_iterator_proto,
&self.string_iterator_proto,
&self.regexp_string_iterator_proto,
&self.async_iterator_proto,
&self.iterator_helper_proto,
&self.disposable_stack_proto,
&self.async_disposable_stack_proto,
@@ -604,6 +608,7 @@ impl BuiltinWorld {
BuiltinId::BigIntConstructor => &self.bigint_constructor,
BuiltinId::BigIntProto => &self.bigint_proto,
BuiltinId::Console => &self.console_object,
BuiltinId::AsyncIteratorProto => &self.async_iterator_proto,
}
}
}