gecko-dev/layout/style/test/test_non_content_accessible_values.html
Emilio Cobos Álvarez e2075d6bdd Bug 1710643 - Remove support for unused gtk infobar widget and colors. r=stransky
Presumably they were for notifications and now we use native notifications?

Differential Revision: https://phabricator.services.mozilla.com/D114874
2021-05-12 19:13:21 +00:00

167 lines
4.2 KiB
HTML

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="sheet"></style>
<div></div>
<script>
const NON_CONTENT_ACCESSIBLE_VALUES = {
"color": [
"-moz-gtk-buttonactivetext",
"-moz-colheaderhovertext",
"-moz-colheadertext",
],
"display": [
"-moz-deck",
"-moz-popup",
],
"-moz-appearance": [
"button-arrow-down",
"button-arrow-next",
"button-arrow-previous",
"button-arrow-up",
"button-focus",
"dualbutton",
"groupbox",
"menubar",
"menuitem",
"checkmenuitem",
"radiomenuitem",
"menuitemtext",
"menupopup",
"menucheckbox",
"menuradio",
"menuseparator",
"menuarrow",
"menuimage",
"-moz-menulist-arrow-button",
"checkbox-container",
"radio-container",
"checkbox-label",
"radio-label",
"resizerpanel",
"resizer",
"scrollbar",
"scrollbar-small",
"scrollbar-horizontal",
"scrollbar-vertical",
"scrollbarbutton-up",
"scrollbarbutton-down",
"scrollbarbutton-left",
"scrollbarbutton-right",
"scrollcorner",
"separator",
"spinner",
"spinner-upbutton",
"spinner-downbutton",
"spinner-textfield",
"splitter",
"statusbar",
"statusbarpanel",
"tab",
"tabpanel",
"tabpanels",
"tab-scroll-arrow-back",
"tab-scroll-arrow-forward",
"toolbar",
"toolbarbutton",
"toolbarbutton-dropdown",
"toolbargripper",
"toolbox",
"tooltip",
"treeheader",
"treeheadercell",
"treeheadersortarrow",
"treeitem",
"treeline",
"treetwisty",
"treetwistyopen",
"treeview",
"window",
"dialog",
"-moz-win-communications-toolbox",
"-moz-win-media-toolbox",
"-moz-win-browsertabbar-toolbox",
"-moz-win-glass",
"-moz-win-borderless-glass",
"-moz-win-exclude-glass",
"-moz-mac-help-button",
"-moz-window-button-box",
"-moz-window-button-box-maximized",
"-moz-window-button-close",
"-moz-window-button-maximize",
"-moz-window-button-minimize",
"-moz-window-button-restore",
"-moz-window-frame-bottom",
"-moz-window-frame-left",
"-moz-window-frame-right",
"-moz-window-titlebar",
"-moz-window-titlebar-maximized",
"-moz-mac-active-source-list-selection",
"-moz-mac-disclosure-button-closed",
"-moz-mac-disclosure-button-open",
"-moz-mac-source-list",
"-moz-mac-source-list-selection",
"-moz-mac-vibrant-titlebar-dark",
"-moz-mac-vibrant-titlebar-light",
"button-bevel",
"caret",
"listitem",
"menulist-textfield",
"menulist-text",
],
"user-select": [
"-moz-text",
],
"line-height": [
"-moz-block-height",
],
};
if (!SpecialPowers.getBoolPref("layout.css.xul-box-display-values.content.enabled")) {
NON_CONTENT_ACCESSIBLE_VALUES.display.push("-moz-box", "-moz-inline-box");
}
const sheet = document.getElementById("sheet");
const div = document.querySelector("div");
test(function() {
sheet.textContent = `div { color: initial }`;
assert_equals(sheet.sheet.cssRules[0].style.length, 1);
}, "sanity");
for (const prop in NON_CONTENT_ACCESSIBLE_VALUES) {
const values = NON_CONTENT_ACCESSIBLE_VALUES[prop];
test(function() {
for (const value of values) {
sheet.textContent = `div { ${prop}: ${value} }`;
const block = sheet.sheet.cssRules[0].style;
assert_equals(
block.length,
0,
`${prop}: ${value} should not be parsed in content`
);
block.setProperty(prop, value);
assert_equals(
block.length,
0,
`${prop}: ${value} should not be settable via CSSOM in content`
);
div.style.setProperty(prop, value);
assert_equals(
div.style.length,
0,
`${prop}: ${value} should not be settable via CSSOM in content (inline style)`
);
assert_not_equals(
getComputedStyle(div).getPropertyValue(prop),
value,
`${prop}: ${value} should not be settable via CSSOM in content (gcs)`
);
assert_false(CSS.supports(prop, value), `${prop}: ${value} should not claim to be supported`)
}
}, prop + " non-accessible values: " + values.join(", "))
}
</script>