aboutsummaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorTianren Dong <tianrendong.dtr@gmail.com>2026-05-13 01:29:51 -0400
committerTianren Dong <tianrendong.dtr@gmail.com>2026-05-13 01:29:51 -0400
commit6ddb6007df14a865d4226d7ee16e08ff4d3c36ca (patch)
treef9cb55e32c3991171b2f8a449de781eb30d04458 /test-suite
parent6dd4b2b0abe30ed11b0969fe838fa24f67b7d6d1 (diff)
pi-chrome 0.10.1: chrome_key modifiers param for trusted chords (Cmd+V etc)
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/challenges/10-user-activation.html7
1 files changed, 5 insertions, 2 deletions
diff --git a/test-suite/challenges/10-user-activation.html b/test-suite/challenges/10-user-activation.html
index d0929d8..1a12e39 100644
--- a/test-suite/challenges/10-user-activation.html
+++ b/test-suite/challenges/10-user-activation.html
@@ -12,15 +12,18 @@
<script>
Challenge.init({ id: "user-activation", instructions: "click button; user-activation must unlock gated APIs" });
document.getElementById("go").addEventListener("click", async () => {
+ // Capture activation state synchronously before any await (activation can be consumed by gated APIs).
const ua = navigator.userActivation;
- Challenge.log("activation", { isActive: ua?.isActive, hasBeenActive: ua?.hasBeenActive });
+ const wasActive = !!ua?.isActive;
+ const hadBeenActive = !!ua?.hasBeenActive;
+ Challenge.log("activation", { isActive: wasActive, hasBeenActive: hadBeenActive });
let clip = "skip", fs = "skip";
try { await navigator.clipboard.writeText("pi-chrome-test"); clip = "ok"; }
catch (e) { clip = "err:" + e.name; }
try { await document.documentElement.requestFullscreen(); fs = "ok"; document.exitFullscreen?.(); }
catch (e) { fs = "err:" + e.name; }
const bad = [];
- if (!ua?.isActive) bad.push("userActivation.isActive === false (synthetic click)");
+ if (!wasActive && !hadBeenActive) bad.push("userActivation.isActive/hasBeenActive both false (synthetic click)");
if (clip.startsWith("err")) bad.push("clipboard.writeText " + clip);
if (fs.startsWith("err")) bad.push("requestFullscreen " + fs);
Challenge.log("gates", { clip, fs });