зеркало из https://github.com/mozilla/gecko-dev.git
39 строки
1.1 KiB
HTML
39 строки
1.1 KiB
HTML
<!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>
|