summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/webcomponents/test_declarative_shadowdom_failure_log.html
blob: 04a7bd3ead9b2ccc55c1056beb51fb56ccbf7eda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1870055
-->
<head>
  <title>Test for Logging of Declarative ShadowDOM attachment failure</title>
  <script type="text/javascript" src="head.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1870055">Bug 1870055</a>
<script>

SimpleTest.waitForExplicitFinish();

window.addEventListener("load", () => {
  const declarativeString = `<template shadowrootmode="open"></template>`;
  const wrapper = document.createElement('div');
  wrapper.attachShadow({mode: "open"});

  SimpleTest.monitorConsole(SimpleTest.finish, [{ errorMessage: "Failed to attach Declarative Shadow DOM." }]);

  const observer = new MutationObserver(e => {
    if (e[0].addedNodes) {
      SimpleTest.endMonitorConsole();
    }
  });
  observer.observe(document.body, { childList: true });

  wrapper.setHTMLUnsafe(declarativeString);
  document.body.appendChild(wrapper);
});
</script>
</body>
</html>