From 41c0132c59a31c6d8bcc711b94b0859349e88f9b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 23 May 2021 12:29:54 -0400 Subject: Improve support for sandboxed iframes (#1704) * Add more tests * Improve handling of errors from setupFrame * Passively handle errors when contentDocument is null --- test/data/html/test-document2.html | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/data/html/test-document2.html b/test/data/html/test-document2.html index bb7bfb97..fb3adb59 100644 --- a/test/data/html/test-document2.html +++ b/test/data/html/test-document2.html @@ -24,6 +24,9 @@ top: 0; bottom: 0; right: 0; +} +.danger { + color: #c83c28; } @@ -108,7 +111,20 @@ <iframe> element with srcdoc. - + + + + + <iframe> element with srcdoc and sandbox="allow-same-origin allow-scripts". + + + + + + <iframe> element with srcdoc and sandbox="allow-scripts".
+ This element is expected to not work. +
+
@@ -180,9 +196,10 @@ const iframeWithDataUrl = document.querySelector('#iframe-with-data-url'); const iframeWithBlobUrl = document.querySelector('#iframe-with-blob-url'); - const iframeWithSrcdoc = document.querySelector('#iframe-with-srcdoc'); iframeWithBlobUrl.src = URL.createObjectURL(dataUrlToBlob(iframeWithDataUrl.src)); - iframeWithSrcdoc.srcdoc = dataUrlToContent(iframeWithDataUrl.src).content; + for (const iframeWithSrcdoc of document.querySelectorAll('.iframe-with-srcdoc')) { + iframeWithSrcdoc.srcdoc = dataUrlToContent(iframeWithDataUrl.src).content; + } })(); -- cgit v1.2.3