summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/content-security-policy/inheritance/support/srcdoc-child-frame.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/content-security-policy/inheritance/support/srcdoc-child-frame.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-security-policy/inheritance/support/srcdoc-child-frame.html b/testing/web-platform/tests/content-security-policy/inheritance/support/srcdoc-child-frame.html
new file mode 100644
index 0000000000..9148be203d
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/inheritance/support/srcdoc-child-frame.html
@@ -0,0 +1,19 @@
+<head>
+ <meta http-equiv="Content-Security-Policy" content="img-src 'none'">
+</head>
+<body>
+ <script>
+ var i = document.createElement('iframe');
+ i.srcdoc=`<script>
+ window.addEventListener('securitypolicyviolation', function(e) {
+ if (e.violatedDirective == 'img-src') {
+ top.postMessage('img blocked', '*');
+ }
+ })
+ </scr` + `ipt>
+ <img src='/content-security-policy/support/fail.png'
+ onload='top.postMessage("img loaded", "*")'/>`;
+ i.id = "srcdoc-frame";
+ document.body.appendChild(i);
+ </script>
+</body>