mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
fix: close keyframe bypasses on protected controls without policing skin layout
Hold @keyframes to the same hide/yeet checks as regular declarations, including escaped and namespaced animation names. Loosen decorative host-chrome layout locks so open skins can restyle layout freely. Listen for the recovery shortcut in the capture phase, move the load-failure banner into the host-owned layer, and fix recovery aria-labels.
This commit is contained in:
1 parent
a84f66b47d
commit
a4ae4de82f
9 files changed
+286
-57
No files matched your search
+2
@@ -26,6 +26,8 @@
|
||||
<div id="overlay" data-ws-part="host.plugins.overlay">Application library</div>
|
||||
<button type="button" id="launcher" data-ws-part="host.plugins.launcher">Plugins</button>
|
||||
</div>
|
||||
<!-- Decorative host chrome lives outside the skin root in the real client. -->
|
||||
<div id="watermark" data-ws-part="host.watermark" aria-hidden="true">Watermark</div>
|
||||
<div id="app"></div>
|
||||
<div id="auth-app"></div>
|
||||
<pre id="result" style="position:relative;z-index:5;background:#fff">pending</pre>
|
||||
|
||||
@@ -42,15 +42,26 @@ const scenarios = [
|
||||
name: "pointer-events-none",
|
||||
css: compileHostile('[data-ws-part="host.plugins.launcher"], [data-ws-part="host.plugins.overlay"] { pointer-events: none !important; }'),
|
||||
},
|
||||
{
|
||||
// Decorative host chrome may legitimately be a fixed, viewport-sized,
|
||||
// max-stacking decoration. Recovery lives in a closed-shadow top layer and
|
||||
// must still win the hit test.
|
||||
name: "decorative-watermark-overlay",
|
||||
css: compileHostile(`
|
||||
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(12px); } }
|
||||
[data-ws-part="host.watermark"] { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 2147483647; background: #123; animation: drift 3s ease-in-out infinite alternate; }
|
||||
`),
|
||||
},
|
||||
];
|
||||
|
||||
test("host chrome renders recovery and authorization in a closed-shadow top layer", async () => {
|
||||
const [hostChrome, authorization, ownedLayer, hostChromeService, publicSkin] = await Promise.all([
|
||||
const [hostChrome, authorization, ownedLayer, hostChromeService, publicSkin, recoveryNotice] = await Promise.all([
|
||||
read("../src/components/HostChrome.vue"),
|
||||
read("../src/components/InstanceAuthorization.vue"),
|
||||
read("../src/services/host-owned-layer.ts"),
|
||||
read("../src/services/host-chrome.ts"),
|
||||
read("../src/composables/usePublicSkin.ts"),
|
||||
read("../src/components/SkinLoadRecoveryNotice.vue"),
|
||||
]);
|
||||
|
||||
// Recovery: closed shadow root + manual popover + no skin hook.
|
||||
@@ -59,6 +70,11 @@ test("host chrome renders recovery and authorization in a closed-shadow top laye
|
||||
assert.match(hostChrome, /data-ws-recovery-action="built-in"/);
|
||||
assert.match(hostChrome, /requestBuiltInSkin/);
|
||||
assert.match(hostChrome, /isThirdPartySkinActive/);
|
||||
// The shortcut runs in the capture phase so a plugin/skin capture listener
|
||||
// cannot swallow it with preventDefault().
|
||||
assert.match(hostChrome, /addEventListener\("keydown", onKeydown, true\)/);
|
||||
assert.match(hostChrome, /removeEventListener\("keydown", onKeydown, true\)/);
|
||||
assert.doesNotMatch(hostChrome, /event\.defaultPrevented \|\| event\.repeat/);
|
||||
assert.doesNotMatch(hostChrome, /data-ws-part="host\.recovery"/);
|
||||
assert.doesNotMatch(hostChrome, /ws-host-recovery-layer/);
|
||||
|
||||
@@ -67,6 +83,12 @@ test("host chrome renders recovery and authorization in a closed-shadow top laye
|
||||
assert.match(authorization, /showModal\(\)/);
|
||||
assert.doesNotMatch(authorization, /data-ws-part="host\.permission"/);
|
||||
|
||||
// The load-failure banner is trusted UI too: closed shadow layer, stylesheet
|
||||
// inside the boundary, no document-level scoped stylesheet to override.
|
||||
assert.match(recoveryNotice, /createHostOwnedLayer\("skin-load"/);
|
||||
assert.match(recoveryNotice, /data-ws-part="app\.skin-load-recovery"/);
|
||||
assert.doesNotMatch(recoveryNotice, /<style scoped>/);
|
||||
|
||||
// The layer itself: closed shadow root, no data-ws-part, fixed fallback.
|
||||
assert.match(ownedLayer, /attachShadow\(\{ mode: "closed" \}\)/);
|
||||
assert.match(ownedLayer, /data-ws-host-layer/);
|
||||
|
||||
Reference in new issue
Block a user