4 https://bugzilla.mozilla.org/show_bug.cgi?id=????
9 <title>Test for Bug ????
</title>
10 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
12 <iframe id=
"ifr"></iframe>
16 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1094930">Mozilla Bug
1094930</a>
18 <div id=
"test_contents">
19 <!-- Extracted from nsHTMLTagList.h -->
26 <blockquote></blockquote>
106 <textarea></textarea>
110 <template></template>
120 <script type=
"application/javascript">
121 SimpleTest.waitForExplicitFinish();
125 // Because private fields may not be enabled, we construct A via the below eval of an IFFE,
126 // and return early if it syntax errors.
129 A = eval(`(function(){
136 class A extends Base {
149 is(e instanceof SyntaxError, true,
"Threw Syntax Error, Private Fields Not Enabled");
150 is(/private fields are not currently supported/.test(e.message), true,
"correct message");
153 if (A instanceof Function) {
154 function assertThrewInstance(f, error) {
160 // info(
"Caught " + e.name);
161 is(e instanceof error, true,
"Correct Error thrown");
163 is(threw, true,
"Error was thrown");
166 function testNode(node) {
167 info(
"Testing node " + node.nodeName);
169 assertThrewInstance(() =
> A.g(node), TypeError);
170 assertThrewInstance(() =
> A.s(node, 'node'), TypeError);
171 // info(
"Stamping Node");
173 // info(
"Asserting read");
174 is(A.g(node),
1,
"correct value read");
177 // info(
"Verifing setter set the value");
178 is(A.g(node), 'node',
"updated value read");
179 // info(
"Verifying we cannot double-init");
180 assertThrewInstance(() =
> new A(node), TypeError);
183 function testNodeRecursive(node) {
185 for (c of node.children) {
190 const test_contents = document.getElementById('test_contents');
191 testNodeRecursive(test_contents);
193 info(
"Checking Window");
194 // Window itself isn't allowed to host private fields, because it's
195 // a cross-origin object
196 assertThrewInstance(() =
> A.g(window), TypeError)
198 info(
"Checking Window Prototype Chain")
199 // However, it's prototype chain can.
200 w = Object.getPrototypeOf(window);
203 w = Object.getPrototypeOf(w);
206 info(
"Test Document")
210 info(
"Test CSSRuleList")
211 testNode(document.styleSheets[
0].cssRules)
213 info(
"Test DOMTokenList")
214 const div = document.createElement('div');
215 testNode(div.classList);