summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_iframe_sandbox_document_write.html
blob: cdfa87c8f842a118b9f0d55584e9a7d92438a1fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE HTML>
<html>
<head> <meta charset="utf-8"> </head>
<script type="text/javascript">
  function ok(result, desc) {
    window.parent.postMessage({ok: result, desc: desc}, "*");
  }
  function doStuff() {
    var beforePrincipal = SpecialPowers.wrap(document).nodePrincipal;
    document.open();
    document.write("rewritten sandboxed document");
    document.close();
    var afterPrincipal = SpecialPowers.wrap(document).nodePrincipal;
    ok(beforePrincipal.equals(afterPrincipal),
       "document.write() does not change underlying principal");
  }
</script>
<body onLoad='doStuff();'>
  sandboxed with allow-scripts
</body>
</html>