From bdc176bc82a23f8d4654ad4fbed7bd6a00b05c7c Mon Sep 17 00:00:00 2001 From: Onkar Ruikar <87750369+OnkarRuikar@users.noreply.github.com> Date: Wed, 12 Jun 2024 09:51:40 +0530 Subject: [PATCH 1/2] fix(macros): typo in EmbedLiveSample.ejs --- kumascript/macros/EmbedLiveSample.ejs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kumascript/macros/EmbedLiveSample.ejs b/kumascript/macros/EmbedLiveSample.ejs index 071dadc1dda2..8e9d2f91d298 100644 --- a/kumascript/macros/EmbedLiveSample.ejs +++ b/kumascript/macros/EmbedLiveSample.ejs @@ -100,6 +100,5 @@ if (height) { %> height="<%= height %>"<% } %> src="<%- url %>"<% if (allowedFeatures) { %> allow="<%= allowedFeatures %>"<% } if ($token) { %> data-token="<%= JSON.stringify($token) %>"<% } -sandbox="allow-scripts allow-same-origin" -%>><% +%> sandbox="allow-same-origin allow-scripts"><% if (hasScreenshot) { %><% } %> From d7fcb535e23b8f2dbb3393a4d71dd5ae3bc18ebc Mon Sep 17 00:00:00 2001 From: OnkarRuikar <87750369+OnkarRuikar@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:07:29 +0530 Subject: [PATCH 2/2] update unit tests --- .../tests/macros/EmbedLiveSample.test.ts | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/kumascript/tests/macros/EmbedLiveSample.test.ts b/kumascript/tests/macros/EmbedLiveSample.test.ts index 648728b29647..3caf15b96b2a 100644 --- a/kumascript/tests/macros/EmbedLiveSample.test.ts +++ b/kumascript/tests/macros/EmbedLiveSample.test.ts @@ -16,7 +16,8 @@ describeMacro("EmbedLiveSample", function () { '
" ); }); @@ -28,7 +29,8 @@ describeMacro("EmbedLiveSample", function () { '
" ); }); @@ -39,7 +41,8 @@ describeMacro("EmbedLiveSample", function () { '
" ); }); @@ -51,7 +54,8 @@ describeMacro("EmbedLiveSample", function () { '
" ); }); @@ -62,7 +66,8 @@ describeMacro("EmbedLiveSample", function () { '
" ); }); @@ -74,7 +79,8 @@ describeMacro("EmbedLiveSample", function () { ' title="Example sample"' + ' id="frame_example"' + ' width="100%"' + - ' src="https://live.mdnplay.dev/en-US/docs/Web/CSS/border-top-width/runner.html?id=example">' + + ' src="https://live.mdnplay.dev/en-US/docs/Web/CSS/border-top-width/runner.html?id=example"' + + ' sandbox="allow-same-origin allow-scripts">' + "" ); }); @@ -86,7 +92,8 @@ describeMacro("EmbedLiveSample", function () { ' title="Example sample"' + ' id="frame_example"' + ' width=""><script>alert("XSS");</script>"' + - ' src="https://live.mdnplay.dev/en-US/docs/Web/CSS/border-top-width/runner.html?id=example">' + + ' src="https://live.mdnplay.dev/en-US/docs/Web/CSS/border-top-width/runner.html?id=example"' + + ' sandbox="allow-same-origin allow-scripts">' + "" ); }); @@ -98,7 +105,8 @@ describeMacro("EmbedLiveSample", function () { ' title="Images sample"' + ' id="frame_images"' + ' width="100%" height="250"' + - ' src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/figure/runner.html?id=images">' + + ' src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/figure/runner.html?id=images"' + + ' sandbox="allow-same-origin allow-scripts">' + "" ); }); @@ -111,7 +119,8 @@ describeMacro("EmbedLiveSample", function () { ' title="增加关键帧 sample"' + ' id="frame_增加关键帧"' + ' width="100%" height="250"' + - ' src="https://live.mdnplay.dev/zh-CN/docs/Web/CSS/CSS_Animations/Using_CSS_animations/runner.html?id=%E5%A2%9E%E5%8A%A0%E5%85%B3%E9%94%AE%E5%B8%A7">' + + ' src="https://live.mdnplay.dev/zh-CN/docs/Web/CSS/CSS_Animations/Using_CSS_animations/runner.html?id=%E5%A2%9E%E5%8A%A0%E5%85%B3%E9%94%AE%E5%B8%A7"' + + ' sandbox="allow-same-origin allow-scripts">' + "" ); }); @@ -127,7 +136,8 @@ describeMacro("EmbedLiveSample", function () { ' title="%E4%B8%80%E4%B8%AA%E6%A8%A1%E6%9D%BF%E9%AA%A8%E6%9E%B6 sample"' + ' id="frame_一个模板骨架"' + ' width="160" height="160"' + - ' src="https://live.mdnplay.dev/zh-CN/docs/Web/API/Canvas_API/Tutorial/Basic_usage/runner.html?id=%E4%B8%80%E4%B8%AA%E6%A8%A1%E6%9D%BF%E9%AA%A8%E6%9E%B6">' + + ' src="https://live.mdnplay.dev/zh-CN/docs/Web/API/Canvas_API/Tutorial/Basic_usage/runner.html?id=%E4%B8%80%E4%B8%AA%E6%A8%A1%E6%9D%BF%E9%AA%A8%E6%9E%B6"' + + ' sandbox="allow-same-origin allow-scripts">' + "" ); }); @@ -139,7 +149,8 @@ describeMacro("EmbedLiveSample", function () { ' title="Images sample"' + ' id="frame_images"' + ' width="100%" height=""><script>alert("XSS");</script>"' + - ' src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/figure/runner.html?id=images">' + + ' src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/figure/runner.html?id=images"' + + ' sandbox="allow-same-origin allow-scripts">' + "" ); }); @@ -148,7 +159,8 @@ describeMacro("EmbedLiveSample", function () { ' title="Examples sample"' + ' id="frame_examples"' + ' width="700px" height="700px"' + - ' src="https://live.mdnplay.dev/en-US/docs/Web/CSS/flex-wrap/runner.html?id=examples">' + + ' src="https://live.mdnplay.dev/en-US/docs/Web/CSS/flex-wrap/runner.html?id=examples"' + + ' sandbox="allow-same-origin allow-scripts">' + ""; itMacro("Three arguments: ID, width, height (same slug)", function (macro) { macro.ctx.env.url = "/en-US/docs/Web/CSS/flex-wrap";