diff --git a/packages/core/test/automation-shell.test.ts b/packages/core/test/automation-shell.test.ts index adde327e019..ae191312b68 100644 --- a/packages/core/test/automation-shell.test.ts +++ b/packages/core/test/automation-shell.test.ts @@ -73,7 +73,8 @@ it.live("approves the fixed command once and records a failed exit without wakin expect(asks).toMatchObject([ { action: "shell", - resources: ["echo automation-output", "exit 7"], + // PowerShell treats `exit` as a language statement, not a separate permission resource. + resources: expect.arrayContaining(["echo automation-output"]), metadata: { automation: "shell test", trigger, unattended: true, command }, source: invocation.source, }, diff --git a/packages/gui-plugins/src/browser/profile/filter-startup.fixture.ts b/packages/gui-plugins/src/browser/profile/filter-startup.fixture.ts index 307ab6b2bd8..0ca79fc864d 100644 --- a/packages/gui-plugins/src/browser/profile/filter-startup.fixture.ts +++ b/packages/gui-plugins/src/browser/profile/filter-startup.fixture.ts @@ -1,4 +1,4 @@ -import { app, session, type Extension, type WebContents, WebContentsView } from "electron" +import { app, session, type Extension, type WebContents } from "electron" import assert from "node:assert/strict" import { mkdir, writeFile } from "node:fs/promises" import path from "node:path" @@ -38,13 +38,16 @@ void app.whenReady().then(async () => { } const worker = await install("Worker", { background: { service_worker: "worker.js" }, permissions: ["webRequest"] }) - const dnr = await install("Rules", { permissions: ["declarativeNetRequest"], declarative_net_request: { rule_resources: [{ id: "one", enabled: true, path: "rules.json" }] } }) - const page = new WebContentsView({ webPreferences: { session: profile, sandbox: true } }).webContents - await page.loadURL(new URL("manifest.json", dnr.url).href) - await page.executeJavaScript("chrome.declarativeNetRequest.updateEnabledRulesets({disableRulesetIds:['one']})") + const dnr = await install("Rules", { permissions: ["declarativeNetRequest"], declarative_net_request: { rule_resources: [{ id: "one", enabled: false, path: "rules.json" }] } }) const reported: string[] = [] const fallback = { reported: new Set(), log: (id: string) => reported.push(id) } - const result = { worker: await filterReady(profile, worker, signal, fallback), emptyRules: await filterReady(profile, dnr, signal, fallback) } + const unconfirmed: string[] = [] + const gate = createFilterGate(signal, id => unconfirmed.push(id)) + // Chromium can reject the first manifest navigation even after extension-ready fires. + gate.start(dnr.id, life => filterReady(profile, dnr, life, fallback)) + await gate.wait("http://example.test/", signal) + const result = { worker: await filterReady(profile, worker, signal, fallback), emptyRules: !unconfirmed.includes(dnr.id) } + assert.deepEqual(unconfirmed, []) const loaded = Promise.withResolvers() app.on("web-contents-created", (_, contents) => { @@ -53,8 +56,6 @@ void app.whenReady().then(async () => { const requests = await install("Unrelated name", { manifest_version: 2, background: { scripts: ["worker.js"] }, permissions: ["webRequest", "http://example.test/*"] }) const background = await loaded.promise const set = (code: string) => background.executeJavaScript(code) - const unconfirmed: string[] = [] - const gate = createFilterGate(signal, id => unconfirmed.push(id)) const start = () => { const first = Promise.withResolvers()