Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / test / test_non_content_accessible_properties.html
blobe059978050fd4aecdafed55054d2a7d92e5d2c9b
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <iframe></iframe>
5 <iframe srcdoc="Foo"></iframe>
6 <script>
7 const NON_CONTENT_ACCESSIBLE_PROPERTIES = [
8 "-x-span",
9 "-x-lang",
10 "-x-text-scale",
11 "-moz-window-input-region-margin",
12 "-moz-window-shadow",
13 "-moz-window-opacity",
14 "-moz-window-transform",
15 "-moz-window-transform-origin",
16 "-moz-top-layer",
17 "-moz-script-level",
18 "-moz-math-display",
19 "-moz-math-variant",
20 "-moz-font-smoothing-background-color",
21 "-moz-min-font-size-ratio",
22 "-moz-default-appearance",
23 "-moz-inert",
24 "-moz-control-character-visibility",
25 "-moz-context-properties",
28 function testInWin(win) {
29 const doc = win.document;
30 const sheet = doc.createElement("style");
31 const div = doc.createElement("div");
32 doc.documentElement.appendChild(sheet);
33 doc.documentElement.appendChild(div);
35 sheet.textContent = `div { color: initial }`;
36 assert_equals(sheet.sheet.cssRules[0].style.length, 1, `sanity: ${doc.documentURI}`);
38 for (const prop of NON_CONTENT_ACCESSIBLE_PROPERTIES) {
39 sheet.textContent = `div { ${prop}: initial }`;
40 let block = sheet.sheet.cssRules[0].style;
41 assert_equals(
42 block.length,
44 `${prop} shouldn't be parsed in ${doc.documentURI}`
46 block.setProperty(prop, "initial");
47 assert_equals(
48 block.length,
50 `${prop} shouldn't be settable via CSSOM in ${doc.documentURI}`
52 assert_equals(
53 win.getComputedStyle(div).getPropertyValue(prop),
54 "",
55 `${prop} shouldn't be accessible via CSSOM in ${doc.documentURI}`
57 assert_false(
58 win.CSS.supports(prop + ': initial'),
59 `${prop} shouldn't be exposed in CSS.supports in ${doc.documentURI}`
61 assert_false(
62 win.CSS.supports(prop, 'initial'),
63 `${prop} shouldn't be exposed in CSS.supports in ${doc.documentURI} (2-value version)`
68 let t = async_test("test non-content-accessible props");
69 onload = t.step_func_done(function() {
70 testInWin(window);
71 for (let f of document.querySelectorAll("iframe")) {
72 testInWin(f.contentWindow);
74 });
75 </script>