diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/style/test/test_non_content_accessible_env_vars.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | layout/style/test/test_non_content_accessible_env_vars.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/layout/style/test/test_non_content_accessible_env_vars.html b/layout/style/test/test_non_content_accessible_env_vars.html new file mode 100644 index 0000000000..f3fa474300 --- /dev/null +++ b/layout/style/test/test_non_content_accessible_env_vars.html @@ -0,0 +1,38 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<iframe></iframe> +<iframe srcdoc="Foo"></iframe> +<script> +const NON_CONTENT_ACCESSIBLE_ENV_VARS = [ + "-moz-gtk-csd-titlebar-radius", + "-moz-gtk-csd-minimize-button-position", + "-moz-gtk-csd-maximize-button-position", + "-moz-gtk-csd-close-button-position", + "-moz-content-preferred-color-scheme", + "scrollbar-inline-size", +]; + +function testInWin(win) { + let doc = win.document; + const div = doc.createElement("div"); + doc.documentElement.appendChild(div); + for (const envVar of NON_CONTENT_ACCESSIBLE_ENV_VARS) { + div.style.setProperty("--foo", `env(${envVar},FALLBACK_VALUE)`); + + assert_equals( + win.getComputedStyle(div).getPropertyValue("--foo"), + "FALLBACK_VALUE", + `${envVar} shouldn't be exposed to content in ${doc.documentURI}` + ); + } +} + +let t = async_test("Test non-content-accessible env() vars"); +onload = t.step_func_done(function() { + testInWin(window); + for (let f of document.querySelectorAll("iframe")) { + testInWin(f.contentWindow); + } +}); +</script> |