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: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825233}
diff --git a/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative.html b/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative.html
index b314adb..e023477 100644
--- a/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative.html
+++ b/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative.html
@@ -201,6 +201,17 @@
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 @@
};
}
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>