Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions content-security-policy/sandbox/autoplay-disabled-by-csp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#eligible-for-autoplay" />
<title>Test that autoplay is blocked by a document's active sandboxing flags</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
</head>
<body>
<video id="v" autoplay></video>
<script>
async_test((t) => {
var v = document.getElementById('v')

v.addEventListener('playing', t.unreached_func('video should not autoplay due to sandboxing flags'));

v.src = getVideoURI('/media/movie_5') + '?' + new Date() + Math.random()
t.step_timeout(() => t.done(), 500);
}, 'csp-derived sandboxing flags prevent autoplay.')
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Content-Security-Policy: sandbox allow-forms
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#concept-form-submit">
<title>Test that form submission is blocked by a document's active sandboxing flags</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<form id="f">
<input type="hidden" value="test" />
</form>
<script>
async_test((t) => {
var f = document.getElementById('f')

f.addEventListener('submit', t.unreached_func('form should not be submitted due to sandboxing flags'));

f.submit();
t.step_timeout(() => t.done(), 500);
}, 'csp-derived sandboxing flags prevent form submission.')
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Content-Security-Policy: sandbox allow-scripts