Skip to content

Commit e5dd9be

Browse files
shanehandleyservo-wpt-sync
authored andcommitted
Implement document's active sandboxing flag set
Signed-off-by: Shane Handley <[email protected]>
1 parent a5312ef commit e5dd9be

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link rel="help" href="https://html.spec.whatwg.org/multipage/#eligible-for-autoplay" />
5+
<title>Test that autoplay is blocked by a document's active sandboxing flags</title>
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
<script src="/common/media.js"></script>
9+
</head>
10+
<body>
11+
<video id="v" autoplay></video>
12+
<script>
13+
async_test((t) => {
14+
var v = document.getElementById('v')
15+
16+
v.addEventListener('playing', t.unreached_func(
17+
'video should not autoplay due to sandboxing flags'
18+
));
19+
20+
v.src = getVideoURI('/media/movie_5') + '?' + new Date() + Math.random()
21+
t.step_timeout(() => t.done(), 500);
22+
}, 'csp-derived sandboxing flags prevent autoplay.')
23+
</script>
24+
</body>
25+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Content-Security-Policy: sandbox allow-forms
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link rel="help" href="https://html.spec.whatwg.org/multipage/#concept-form-submit">
5+
<title>Test that form submission is blocked by a document's active sandboxing flags</title>
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
</head>
9+
<body>
10+
<form id="f">
11+
<input type="hidden" value="test" />
12+
</form>
13+
<script>
14+
async_test((t) => {
15+
var f = document.getElementById('f')
16+
17+
f.addEventListener('submit', t.unreached_func(
18+
'form should not be submitted due to sandboxing flags'
19+
));
20+
21+
f.submit();
22+
t.step_timeout(() => t.done(), 500);
23+
}, 'csp-derived sandboxing flags prevent form submission.')
24+
</script>
25+
</body>
26+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Content-Security-Policy: sandbox allow-scripts

0 commit comments

Comments
 (0)