Checkpoint web parity through Chromium input tasks
This commit is contained in:
17
web/tests/e2e/script-permission-policy.spec.ts
Normal file
17
web/tests/e2e/script-permission-policy.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("M13-02E grants only explicitly declared permissions", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const result = await page.evaluate(() => new Promise<Record<string, any>>((resolve, reject) => {
|
||||
const worker = new Worker("/src/workers/script-permission-policy-test.worker.ts", { type: "module" });
|
||||
worker.onmessage = (event: MessageEvent<Record<string, any>>) => { worker.terminate(); resolve(event.data); };
|
||||
worker.onerror = (event) => { worker.terminate(); reject(new Error(event.message)); };
|
||||
worker.postMessage({});
|
||||
}));
|
||||
expect(result.defaultGrant).toMatchObject({ status: "ALLOWED", granted: [] });
|
||||
expect(result.declaredGrant).toMatchObject({ status: "ALLOWED", granted: ["READ_MAIN"] });
|
||||
expect(result.escalation).toMatchObject({ status: "BLOCKED", code: "SCRIPT_POLICY_DENIED", granted: [] });
|
||||
expect(result.unknownRequest).toMatchObject({ status: "BLOCKED", code: "SCRIPT_POLICY_DENIED" });
|
||||
expect(result.duplicateRequest).toMatchObject({ status: "BLOCKED", code: "SCRIPT_POLICY_DENIED" });
|
||||
expect(result.unknownDeclaration).toBe("SCRIPT_POLICY_DENIED");
|
||||
});
|
||||
Reference in New Issue
Block a user