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_properties.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.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 'layout/style/test/test_non_content_accessible_properties.html')
-rw-r--r-- | layout/style/test/test_non_content_accessible_properties.html | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/layout/style/test/test_non_content_accessible_properties.html b/layout/style/test/test_non_content_accessible_properties.html new file mode 100644 index 0000000000..0b3e22981f --- /dev/null +++ b/layout/style/test/test_non_content_accessible_properties.html @@ -0,0 +1,78 @@ +<!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_PROPERTIES = [ + "-x-span", + "-x-lang", + "-x-text-scale", + "-moz-window-input-region-margin", + "-moz-window-shadow", + "-moz-window-opacity", + "-moz-window-transform", + "-moz-window-transform-origin", + "-moz-top-layer", + "-moz-script-size-multiplier", + "-moz-script-level", + "-moz-math-display", + "-moz-math-variant", + "-moz-script-min-size", + "-moz-font-smoothing-background-color", + "-moz-min-font-size-ratio", + "-moz-script-size-multiplier", + "-moz-default-appearance", + "-moz-inert", + "-moz-control-character-visibility", + "-moz-context-properties", +]; + +function testInWin(win) { + const doc = win.document; + const sheet = doc.createElement("style"); + const div = doc.createElement("div"); + doc.documentElement.appendChild(sheet); + doc.documentElement.appendChild(div); + + sheet.textContent = `div { color: initial }`; + assert_equals(sheet.sheet.cssRules[0].style.length, 1, `sanity: ${doc.documentURI}`); + + for (const prop of NON_CONTENT_ACCESSIBLE_PROPERTIES) { + sheet.textContent = `div { ${prop}: initial }`; + let block = sheet.sheet.cssRules[0].style; + assert_equals( + block.length, + 0, + `${prop} shouldn't be parsed in ${doc.documentURI}` + ); + block.setProperty(prop, "initial"); + assert_equals( + block.length, + 0, + `${prop} shouldn't be settable via CSSOM in ${doc.documentURI}` + ); + assert_equals( + win.getComputedStyle(div).getPropertyValue(prop), + "", + `${prop} shouldn't be accessible via CSSOM in ${doc.documentURI}` + ); + assert_false( + win.CSS.supports(prop + ': initial'), + `${prop} shouldn't be exposed in CSS.supports in ${doc.documentURI}` + ); + assert_false( + win.CSS.supports(prop, 'initial'), + `${prop} shouldn't be exposed in CSS.supports in ${doc.documentURI} (2-value version)` + ); + } +} + +let t = async_test("test non-content-accessible props"); +onload = t.step_func_done(function() { + testInWin(window); + for (let f of document.querySelectorAll("iframe")) { + testInWin(f.contentWindow); + } +}); +</script> |