修正原生壳预览边界守卫以接受刷新重载变量
Project CI / Backend tests (pull_request) Failing after 24s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 5m47s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 6m38s
Project CI / Repository checks (pull_request) Failing after 14s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 7m11s
Project CI / Frontend tests (pull_request) Successful in 2m14s
Project CI / Native shell tests (pull_request) Successful in 8m40s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m25s
Project CI / Backend tests (pull_request) Failing after 24s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 5m47s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 6m38s
Project CI / Repository checks (pull_request) Failing after 14s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 7m11s
Project CI / Frontend tests (pull_request) Successful in 2m14s
Project CI / Native shell tests (pull_request) Successful in 8m40s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m25s
- 预览框 src 断言改为两种形态都接受:旧的 `src={embeddedUrl}`,或 `src={iframeUrl ?? undefined}`
- 新形态额外要求 `iframeUrl` 由 `useMemo` 定义、且定义体内引用 `embeddedUrl`(只改名不算通过)
- 其余断言(`resolveEmbeddedPreviewUrl(` / loopback 校验 / sandbox / 单 iframe 与单挂载)原样保留
- 背景:14283db94 为「刷新运行画面」引入 iframeUrl,撞红了 Native shell tests 的
Run native shell contract gates(missing src={embeddedUrl});只接受新形态会让 master 反过来红
This commit is contained in:
@@ -2642,7 +2642,6 @@ function assertAiGameCreatorShellUserDevBoundary() {
|
||||
'function resolveEmbeddedPreviewUrl(',
|
||||
"url.protocol !== 'http:' || url.hostname !== '127.0.0.1'",
|
||||
'sandbox="allow-scripts allow-same-origin allow-forms allow-pointer-lock"',
|
||||
'src={embeddedUrl}',
|
||||
]) {
|
||||
if (
|
||||
!sourceIncludesSnippet(aiGameCreatorLocalGamePreviewFrameSource, snippet)
|
||||
@@ -2652,6 +2651,29 @@ function assertAiGameCreatorShellUserDevBoundary() {
|
||||
);
|
||||
}
|
||||
}
|
||||
// 预览框的 `src` 允许经一个短变量中转(刷新时要在地址上叠加 `__agc_reload` 这类非业务参数),
|
||||
// 但这个变量必须由被校验过的 `embeddedUrl` 派生:只换名字、丢掉派生关系仍按漂移处理。
|
||||
const iframeUrlDerivation = aiGameCreatorLocalGamePreviewFrameSource.match(
|
||||
/const\s+iframeUrl\s*=\s*useMemo\(\s*\(\s*\)\s*=>\s*\{[\s\S]*?\}\s*,\s*\[/,
|
||||
);
|
||||
if (
|
||||
!sourceIncludesSnippet(
|
||||
aiGameCreatorLocalGamePreviewFrameSource,
|
||||
'src={embeddedUrl}',
|
||||
) &&
|
||||
!(
|
||||
sourceIncludesSnippet(
|
||||
aiGameCreatorLocalGamePreviewFrameSource,
|
||||
'src={iframeUrl ?? undefined}',
|
||||
) &&
|
||||
iframeUrlDerivation !== null &&
|
||||
iframeUrlDerivation[0].includes('embeddedUrl')
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
'AI game creator embedded preview boundary drifted: iframe src must derive from the validated embeddedUrl',
|
||||
);
|
||||
}
|
||||
for (const snippet of [
|
||||
"await invoke<LocalPreviewStatus>(\n 'activate_local_game_preview'",
|
||||
'已载入客户端运行视图',
|
||||
|
||||
Reference in New Issue
Block a user