mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-11 22:06:17 -08:00
test(iframe): [PKG-IFRAME-02] reproduce request and native window failures
This commit is contained in:
1 parent
a52f79a0cc
commit
b3f22652c2
10 files changed
+8259
-12
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,59 @@
|
||||
# PKG-IFRAME-02 历史消息、请求与销毁行为
|
||||
|
||||
新增52项Node检查,使用冻结发布主main/legacy及工作区main/legacy,保留既有正常控制,
|
||||
并将生命周期风险从源码观察推进到可重跑复现。额外helper继续由IFRAME-01独立契约覆盖,
|
||||
本轮不能代表helper的完整迁移验收。
|
||||
|
||||
| 场景 | 四份主实现的实际结果 |
|
||||
| --- | --- |
|
||||
| 同毫秒两个请求 | id相同;第二回调覆盖第一,第一响应错误地结算第二请求,第一请求悬挂 |
|
||||
| 已发送后destroy | 监听被移除,但public promises记录和Promise保留 |
|
||||
| 等待inject时destroy | 200ms定时器仍保留;待旧timer执行才拒绝,不能称为立即取消 |
|
||||
| 销毁后新请求 | 正常拒绝既有错误消息,没有新timer;作为正向控制 |
|
||||
| 不同ID乱序/错误 | 正确对应resolve/reject与Error(data),删除记录 |
|
||||
| 同ID自定义非error类型 | 同样resolve;这是generic postMessage兼容协议,不能只允许response |
|
||||
| event.data=null | public receiver抛TypeError |
|
||||
| 即时发送失败 | Promise拒绝,但请求记录保留 |
|
||||
| 轮询后发送失败 | 异常逃离timer回调,外层Promise悬挂且记录保留 |
|
||||
| 销毁后的已保存receiver | 仍可结算旧请求并通知message回调 |
|
||||
| iframe导航 | injected沿用旧值,未等新inject便发送 |
|
||||
| 重复child inject | 重复握手,但浏览器式EventTarget对相同handler去重,不能声称重复注册监听 |
|
||||
| child执行错误/恢复 | 发error后异步拒绝,后续命令正常 |
|
||||
|
||||
## 真实浏览器
|
||||
|
||||
矩阵4份产物×同源/跨源×6场景×Chromium/Firefox/WebKit,共144项通过。这里的通过是
|
||||
旧行为/缺陷的复现断言通过,不表示这些缺陷已修复。所有场景都创建实际iframe,使用浏览器
|
||||
原生WindowProxy、postMessage、event.source与event.origin;没有伪造MessageEvent来源。
|
||||
跨源使用127.0.0.1与localhost两个实际不同origin,由本地route提供冻结库及可控页面。
|
||||
首轮5项和120项、最终144项均归档report.json和整个results。
|
||||
|
||||
六类场景为:同步/resolve异步/错误/恢复round-trip,同毫秒冲突,destroy后迟到回复,
|
||||
无关窗口消息,导航到未inject页面,以及原生结构化克隆失败。
|
||||
|
||||
无关窗口能让父实例误认inject、结算其请求,还能向另一个子iframe发送commit并让它执行
|
||||
本地测试的常量表达式。报告保存真实origin/source关系;测试只操作自己创建的本地页面,
|
||||
不能从这组证据推导其他站点的数据可访问性。
|
||||
|
||||
导航后,旧实例提前发出的commit被新页面真实接收,但因尚未inject而丢失;之后inject并
|
||||
发出新请求可恢复,旧请求仍悬挂。clone-failure使用原生不可克隆函数触发DataCloneError,
|
||||
分别验证timer中的未处理异常/悬挂与即时拒绝/留记录。只拦截测试刻意触发的DataCloneError
|
||||
以及固定child错误,其余未处理页面错误仍由通用fixture判失败。Date.now仅为同tick冲突和
|
||||
两个clone失败的不同ID做受控设置,不能将其报告为自然网络计时。
|
||||
|
||||
工具本身不依赖ArtPlayer实例;本轮未创建播放器,不计作旧/新核心媒体集成,也未访问线上demo。
|
||||
正常消息控制和故障断言保持分离,后续03/04须新增候选修复断言,同时保留历史负例。
|
||||
|
||||
## 后续实施约束
|
||||
|
||||
保留resove公开拼写、promises公开视图、绑定onMessage、message回调receiver/返回形状、
|
||||
任意非error的同ID响应、commit函数体/resolve约定及既有错误消息。请求身份、等待timer、
|
||||
发送异常、销毁和导航的资源归属可在内部修复,必须用相同场景验证旧失败/候选成功。
|
||||
source/origin与可执行commit的信任模型在IFRAME-03/05单独说明,保留同源/跨源正常使用,
|
||||
不能将所有历史消息静默改成另一套RPC。
|
||||
|
||||
本任务没有修改生产源码、公开类型、协议或版本。完整CI和最终证据核验完成后专用提交;
|
||||
IFRAME-LIFE-01、IFRAME-TRUST-01仍open,下一项IFRAME-03实施资源与消息边界。
|
||||
|
||||
完整CI退出0:1489项(1315单元、14工程、160基线)与44重复契约通过,324生产TS。
|
||||
最终源码和浏览器报告哈希已核验;本任务完成后立即单独本地提交,不推送或发布。
|
||||
+3
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 222 项,范围 22 个包及工作区/示例。
|
||||
|
||||
状态:todo 107 / doing 9 / blocked 0 / done 106 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
|
||||
状态:todo 106 / doing 9 / blocked 0 / done 107 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
|
||||
|
||||
前置依赖是启动条件;验收是完成条件。任务可以继续拆分,但不能复用或悄悄删除旧 ID。
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
| ID | 范围 / 步骤 | 前置依赖 | 交付物 | 验收条件 | 风险 | 状态 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| PKG-IFRAME-01 | artplayer-tool-iframe<br>核对包契约与历史用法 | BASE-05 | constructor/commit/message/inject、postMessage 协议与历史公开拼写 | 源码/声明/README/demo/发布包差异已登记;公开形状和版本范围冻结 | H | done |
|
||||
| PKG-IFRAME-02 | artplayer-tool-iframe<br>建立特有行为与错误测试 | PKG-IFRAME-01, ENG-03, ENG-05 | 跨窗口消息、ID 匹配、请求失败、重复 inject、销毁中请求 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | todo |
|
||||
| PKG-IFRAME-02 | artplayer-tool-iframe<br>建立特有行为与错误测试 | PKG-IFRAME-01, ENG-03, ENG-05 | 跨窗口消息、ID 匹配、请求失败、重复 inject、销毁中请求 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | done |
|
||||
| PKG-IFRAME-03 | artplayer-tool-iframe<br>整理内部职责与资源 | PKG-IFRAME-02, CORE-02, BASE-07 | 请求注册/响应匹配/监听清理分离;origin/source 安全边界独立决策 | 结构变化和缺陷修复分开记录;原 API/事件/资源生命周期通过 | H | todo |
|
||||
| PKG-IFRAME-04 | artplayer-tool-iframe<br>迁移自有源码和公开类型 | PKG-IFRAME-03, ENG-04, ENG-06, CORE-07 | 消息联合类型、回调/Promise 推导、旧公开字段兼容;旧npm export=与实际namespace、额外helper协议分别核验 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容 | H | todo |
|
||||
| PKG-IFRAME-05 | artplayer-tool-iframe<br>验证新旧核心和组合 | PKG-IFRAME-04, CORE-22 | 真实同源/跨源 iframe、既有 commit 协议;安全变化有独立结论 | 最终核心与原支持范围核心分别通过;设备/SDK 缺证据不能标完成 | H | todo |
|
||||
@@ -531,4 +531,5 @@
|
||||
- PKG-MB-08: [记录](baselines/mb-entry-source.json) [记录](changes/2026-09-12-PKG-MB-08-entry-checkpoint.md) [记录](baselines/mb-entry-checkpoint.json) [记录](baselines/mb-capability-source.json) [记录](changes/2026-09-12-PKG-MB-08-capability.md) [记录](baselines/mb-capability-validation.json)
|
||||
- PKG-MB-09: [记录](changes/2026-09-12-PKG-MB-09-native-pip-checkpoint.md) [记录](baselines/mb-native-pip-checkpoint.json) [记录](changes/2026-09-12-PKG-MB-09-sustained-playback-checkpoint.md) [记录](baselines/mb-sustained-validation.json) [记录](baselines/mb-sustained-media.json)
|
||||
- PKG-IFRAME-01: [记录](changes/2026-09-12-PKG-IFRAME-01-contract.md) [记录](baselines/iframe-release.json) [记录](baselines/iframe-contract.md) [记录](baselines/iframe-contract-validation.json)
|
||||
- PKG-IFRAME-02: [记录](changes/2026-09-12-PKG-IFRAME-02-behavior.md) [记录](baselines/iframe-behavior-validation.json)
|
||||
- PKG-FACTORY-01: [记录](baselines/factory-assignment-gaps.json) [记录](baselines/factory-compatibility-proposals.json) [记录](factory-compatibility-decision.md) [记录](changes/2026-09-12-PKG-FACTORY-01-decision.md)
|
||||
@@ -1,5 +1,14 @@
|
||||
# 进度与证据
|
||||
|
||||
## PKG-IFRAME-02 完成:历史生命周期与真实窗口缺陷复现
|
||||
|
||||
52项Node和144项Chromium/Firefox/WebKit真实窗口检查通过,覆盖4份历史产物、同源/跨源。
|
||||
确认同毫秒请求串线、销毁/导航悬挂、克隆失败泄漏,以及无关窗口冒充握手/响应/commit。
|
||||
这是历史缺陷断言通过,尚未代表修复;工具测试未创建播放器,不计作核心媒体集成。
|
||||
完整CI1489与44重复契约通过,324生产TS;源码和归档报告哈希一致。
|
||||
见[变更](changes/2026-09-12-PKG-IFRAME-02-behavior.md)与[验证](baselines/iframe-behavior-validation.json)。
|
||||
222项:107 done、9 doing、106 todo;立即专用本地提交。三项Iframe风险仍open,下一项03实施修复。
|
||||
|
||||
## PKG-IFRAME-01 完成:发布名、辅助类与消息契约
|
||||
|
||||
实际旧包plugin-iframe@1.0.0的8个成员和工作区11个输入已冻结;新tool名本次npm查询404,
|
||||
|
||||
@@ -174,6 +174,6 @@
|
||||
| MB-CAP-01 | open / 已复现 | Current Windows WebKit lacks WebCodecs and Web Audio constructors needed by historical MediaBunny proxies | PKG-MB-02, PKG-MB-09 |
|
||||
| MB-READY-01 | resolved / 已复现 | MediaBunny historical readiness can repeat for trackless input and occur after capability errors | PKG-MB-04, PKG-MB-09 |
|
||||
| DPIP-DISPLAY-01 | resolved / 已复现 | Web fullscreen body placement reclaims a player adopted into another document | CORE-22, PKG-DPIP-05 |
|
||||
| IFRAME-LIFE-01 | open / 源码/产物事实 | Iframe timestamp IDs and unowned pending requests/timers lack terminal cleanup | PKG-IFRAME-02, PKG-IFRAME-03 |
|
||||
| IFRAME-TRUST-01 | open / 源码/产物事实 | Iframe executable commit protocol accepts messages without source/origin validation | PKG-IFRAME-03, PKG-IFRAME-05 |
|
||||
| IFRAME-LIFE-01 | open / 已复现 | Iframe timestamp IDs and unowned pending requests/timers lack terminal cleanup | PKG-IFRAME-02, PKG-IFRAME-03 |
|
||||
| IFRAME-TRUST-01 | open / 已复现 | Iframe executable commit protocol accepts messages without source/origin validation | PKG-IFRAME-03, PKG-IFRAME-05 |
|
||||
| IFRAME-DIST-01 | open / 已复现 | Iframe tool name is unavailable at registry observation and old archive includes distinct helper exports | PKG-IFRAME-04, PKG-IFRAME-06 |
|
||||
+8
-4
@@ -3774,13 +3774,15 @@
|
||||
"PKG-IFRAME-03"
|
||||
],
|
||||
"status": "open",
|
||||
"confirmation": "source-observed",
|
||||
"confirmation": "reproduced",
|
||||
"compatibleResolution": "Reproduce same-tick request collision, pending injection, response errors and destroy behavior before changing internal ownership; preserve public promises[id].resove.",
|
||||
"closureCriteria": "Old behavior and candidate fixes have deterministic race/resource tests plus actual iframe integration.",
|
||||
"evidence": [
|
||||
"refactor/baselines/iframe-contract.md",
|
||||
"refactor/baselines/iframe-release.json",
|
||||
"refactor/changes/2026-09-12-PKG-IFRAME-01-contract.md"
|
||||
"refactor/changes/2026-09-12-PKG-IFRAME-01-contract.md",
|
||||
"refactor/baselines/iframe-behavior-validation.json",
|
||||
"refactor/changes/2026-09-12-PKG-IFRAME-02-behavior.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3791,13 +3793,15 @@
|
||||
"PKG-IFRAME-05"
|
||||
],
|
||||
"status": "open",
|
||||
"confirmation": "source-observed",
|
||||
"confirmation": "reproduced",
|
||||
"compatibleResolution": "Treat message origin/source and executable commit as an explicit compatibility and trust-boundary decision; do not silently replace the protocol during TS conversion.",
|
||||
"closureCriteria": "Controlled and real same/cross-origin evidence plus an explicit documented compatibility decision and supported trust model.",
|
||||
"evidence": [
|
||||
"refactor/baselines/iframe-contract.md",
|
||||
"refactor/baselines/iframe-release.json",
|
||||
"refactor/changes/2026-09-12-PKG-IFRAME-01-contract.md"
|
||||
"refactor/changes/2026-09-12-PKG-IFRAME-01-contract.md",
|
||||
"refactor/baselines/iframe-behavior-validation.json",
|
||||
"refactor/changes/2026-09-12-PKG-IFRAME-02-behavior.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
+5
-2
@@ -3635,11 +3635,14 @@
|
||||
"ENG-03",
|
||||
"ENG-05"
|
||||
],
|
||||
"status": "todo",
|
||||
"status": "done",
|
||||
"risk": "H",
|
||||
"deliverable": "跨窗口消息、ID 匹配、请求失败、重复 inject、销毁中请求",
|
||||
"acceptance": "旧版本行为可重跑,成功/失败/切源/销毁有必要断言",
|
||||
"evidence": []
|
||||
"evidence": [
|
||||
"changes/2026-09-12-PKG-IFRAME-02-behavior.md",
|
||||
"baselines/iframe-behavior-validation.json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PKG-IFRAME-03",
|
||||
|
||||
Reference in new issue
Block a user