Source code

Revision control

Other Tools

1
<!DOCTYPE HTML>
2
<html>
3
<!--
5
-->
6
<head>
7
<meta charset="utf-8">
8
<title>Test for Bug 1421568</title>
9
<script src="/tests/SimpleTest/SimpleTest.js"></script>
10
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11
<script type="application/javascript"><!--
12
13
/** Test for Bug 1421568 **/
14
15
SimpleTest.waitForExplicitFinish();
16
17
function init() {
18
document.getElementById("content").innerHTML =
19
"<iframe src='about:blank' onload='test(this)'></iframe>";
20
}
21
22
function test(iframe) {
23
var d = iframe.contentDocument;
24
d.body.innerHTML = "<div>";
25
var div = d.body.firstChild;
26
var sr = div.attachShadow({mode: "closed"});
27
is(sr.mode, "closed", "Shadow root should be closed.");
28
is(div.shadowRoot, null, "Closed shadow root shouldn't be exposed.");
29
is(div.openOrClosedShadowRoot, undefined,
30
"openOrClosedShadowRoot should be exposed to the privileged scripts only.");
31
ok("openOrClosedShadowRoot" in SpecialPowers.wrap(div),
32
"Should have openOrClosedShadowRoot in privileged wrapper.")
33
is(SpecialPowers.unwrap(SpecialPowers.wrap(div).openOrClosedShadowRoot), sr);
34
SimpleTest.finish();
35
}
36
37
//--></script>
38
</head>
39
<body onload="init()">
40
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1421568">Mozilla Bug 1421568</a>
41
<p id="display"></p>
42
<div id="content">
43
44
</div>
45
<pre id="test">
46
</pre>
47
</body>
48
</html>