summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_iframe_sandbox_document_write.html
blob: a3a09529411854ccfcd48e10868fb38b0ddb1218 (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}, "*");
  }
  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>