summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_non_content_accessible_env_vars.html
blob: c6886d5a218fed1becbf89a2972552f045663c79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div></div>
<script>
const NON_CONTENT_ACCESSIBLE_ENV_VARS = [
  "-moz-gtk-csd-titlebar-radius",
  "-moz-gtk-csd-menu-radius",
  "-moz-gtk-csd-minimize-button-position",
  "-moz-gtk-csd-maximize-button-position",
  "-moz-gtk-csd-close-button-position",
  "-moz-content-preferred-color-scheme",
];

const div = document.querySelector("div");
for (const envVar of NON_CONTENT_ACCESSIBLE_ENV_VARS) {
  test(function() {
    div.style.setProperty("--foo", `env(${envVar},FALLBACK_VALUE)`);

    assert_equals(
      getComputedStyle(div).getPropertyValue("--foo"),
      "FALLBACK_VALUE",
      `${envVar} shouldn't be exposed to content`
    );
  });
}
</script>