Commit 57644371 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Add more testing of un-sandboxed iframes

This just adds a few more test cases to the existing
declarative Shadow DOM opt-in test.

Bug: 1042130
Change-Id: I11f20fd3115d4e508e1cf4091afafe2c10cd2382
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522874
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825233}
parent 17ad51e3
......@@ -201,6 +201,17 @@ async_test((t) => {
iframe.srcdoc = content;
}, 'iframe, enabled');
async_test((t) => {
const iframe = document.createElement('iframe');
iframe.style.display = "none";
document.body.appendChild(iframe);
iframe.addEventListener('load', t.step_func_done(() => {
assert_dsd(iframe.contentDocument.body,true);
t.done();
}));
iframe.srcdoc = content;
}, 'iframe, no sandbox - supports DSD by default');
function getHandler(t, name, shouldHaveShadow) {
return (e) => {
t.step(() => {
......@@ -213,14 +224,19 @@ function getHandler(t, name, shouldHaveShadow) {
};
}
async_test((t) => {
window.addEventListener('message', getHandler(t, 'iframe_disallow', false));
window.addEventListener('message', getHandler(t, 'iframe-disallow', false));
}, 'iframe without allow-declarative-shadow-dom sandbox flag disallows declarative Shadow DOM');
async_test((t) => {
window.addEventListener('message', getHandler(t,'iframe_allow', true));
window.addEventListener('message', getHandler(t,'iframe-allow', true));
}, 'iframe with allow-declarative-shadow-dom sandbox flag allows declarative Shadow DOM');
async_test((t) => {
window.addEventListener('message', getHandler(t,'iframe-no-sandbox', true));
}, 'iframe with no sandbox flag allows declarative Shadow DOM');
</script>
<iframe name="iframe_disallow" sandbox="allow-scripts" src="support/declarative-child-frame.html" ></iframe>
<iframe name="iframe_allow" sandbox="allow-scripts allow-declarative-shadow-dom" src="support/declarative-child-frame.html"></iframe>
<iframe name="iframe-disallow" sandbox="allow-scripts" src="support/declarative-child-frame.html" ></iframe>
<iframe name="iframe-allow" sandbox="allow-scripts allow-declarative-shadow-dom" src="support/declarative-child-frame.html"></iframe>
<iframe name="iframe-no-sandbox" src="support/declarative-child-frame.html"></iframe>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment