Sketch iframes block pointer lock and file downloads (requestPointerLock and save* examples do nothing)
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
调研方向
sandbox 属性在 src/components/CodeEmbed/frame.tsx 中设置,issue 指出该行是唯一需要的改动。请阅读该行,查看存在哪些 allow- 令牌,然后检查 issue 要求保持不变的 allow 属性。使用参考示例 requestPointerLock() 和 saveJSON() 进行复现。完成的标准是:指针锁定能够生效,下载在用户操作时开始,并且有测试覆盖 sandbox 的值。由于issue未说明安全方面的理由,在修改之前,请先向维护者询问当初为何省略这些标志。
由索引模型根据 Issue 内容生成。
描述
Most appropriate sections of the p5.js website?
Reference, Examples
What is your operating system?
Linux
Web browser and version
152.0.7977.64
I reproduced this in Chromium. The cause is the sandbox attribute on the iframe, which is in the HTML the site sends.
Actual Behavior
The iframe that runs sketches on the site has this sandbox in src/components/CodeEmbed/frame.tsx:
allow-scripts allow-popups allow-modals allow-forms allow-same-origin
It has no allow-pointer-lock and no allow-downloads. So two things fail silently:
requestPointerLock()is blocked. The browser logs "Blocked pointer lock". This is the problem in #789.- Downloads are blocked. The
saveJSON()andsaveStrings()examples on the reference pages download nothing. The Download button in the Loading and Saving Data examples (JSON and Table) does nothing too.
Expected Behavior
These examples should work the same as they do in the web editor. The pointer lock should engage, and the files should download when the user clicks or presses a key.
Steps to reproduce
- Open the
requestPointerLock()reference page, double click the sketch, and check the console. - Open the
saveJSON()reference page, double click the sketch, and check for a download. - Open the Examples page for Loading and Saving Data, then JSON, and click the Download button.
On a local build I added allow-pointer-lock allow-downloads to the sandbox. The pointer lock then worked, and numbers.json and data.txt downloaded.
I checked the reference examples that call save functions. They run on a key press, a double click or a button, so none of them should start a download on page load.
The fix is small. I would change only the sandbox line and add a test for it. I did not touch the allow attribute, so this does not overlap with #1583.
Related: #789
Would you like to work on the issue?
Yes, I would like to work on it. Is there any reason these flags were left out on purpose?
- 主要语言
- MDX
- 星标
- 97
- 派生
- 330
- 平均合并
- 2 天 6 小时
- 30 天内合并 PR
- 14
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
processing/p5.js-website 的其他 Issue
-
Link prefetching downloads hundreds of pages (~10 MB on the Reference page) that are never reused未关闭Bug
难度 2/5 1-3 小时 新手友好度 76/100
processing/p5.js-website#1647 · 3 条评论 ·
维护者通常 1 天内回复
-
`<canvas>` tag rendered instead of escaped in `p5.Graphics` reference page可能重新可做 @rakesh2OO5 于 147 天前认领,目前没有进行中的 PR。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 74/100
processing/p5.js-website#1389 · 3 条评论 ·
维护者通常 1 天内回复
-
Add Korean translations for `layered-rendering-with-framebuffers.mdx`可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
processing/p5.js-website#1374 ·
维护者通常 1 天内回复
-
Add Korean translations for `intro-to-p5-strands.mdx`可能已有人在做 @eupthere 于 202 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 86/100
processing/p5.js-website#1356 · 1 个 reaction ·
维护者通常 1 天内回复
-
[2.0] TutorialLayout.astro is missing the showBanner translation feature可能已有人在做 @kramosss 于 109 天前认领。 未关闭Bug Reserved (CodeDay)
难度 2/5 1-3 小时 新手友好度 68/100
processing/p5.js-website#1329 · 7 条评论 ·
维护者通常 1 天内回复
查看 processing/p5.js-website 的全部 Issue
相似的 Issue
-
account bug communication lecture
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ls1intum/artemis-ios#571 ·
维护者通常 1 天内回复
-
WOPI editor page is scrollable by a few pixels, which breaks scrolling in the document (Firefox)未关闭
难度 2/5 1-3 小时 新手友好度 84/100
suitenumerique/drive#969 ·
维护者通常 1 天内回复
-
文字サイズ最大で服薬タブの日付の見出しとカレンダータブの月の見出しが切れる可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
bannzai/medicalarm#572 ·
维护者通常 1 天内回复