Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /permissions-policy/policy-extends-to-sandbox-all.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Permissions Policy with wildcard '*' extends to sandboxed frame with opaque origin</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
"use strict";
async_test(t => {
let frame = document.createElement('iframe');
frame.src = "/permissions-policy/resources/sandbox-self.html";
// The wildcard '*' allowlist must match all origins, including opaque origins
// (per W3C Permissions Policy §Allowlist matching algorithm step 1).
frame.allow = "fullscreen *";
frame.sandbox = "allow-scripts";
var handle_message = t.step_func(evt => {
if (evt.source === frame.contentWindow) {
assert_equals(evt.data.child, true,
"Wildcard '*' in allow attribute must match opaque origin of sandboxed frame.");
assert_equals(evt.data.grandchild, false,
"Nested sandboxed frame does not inherit container policy by default unless specified.");
document.body.removeChild(frame);
window.removeEventListener('message', handle_message);
t.done();
}
});
window.addEventListener('message', handle_message);
document.body.appendChild(frame);
}, "Permissions Policy with wildcard '*' extends to sandboxed frame with opaque origin");
</script>
</body>