Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions build/assets/template/background.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Background</title>
</head>
<body>
<iframe
src="/src/sandbox.html"
name="sandbox"
sandbox="allow-scripts"
style="display: none"
sandbox="allow-same-origin allow-scripts"
hidden
aria-hidden="true"
tabindex="-1"
></iframe>
</body>
</html>
6 changes: 4 additions & 2 deletions build/assets/template/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
<iframe
src="/src/sandbox.html"
name="sandbox"
sandbox="allow-scripts"
style="display: none"
sandbox="allow-same-origin allow-scripts"
hidden
aria-hidden="true"
tabindex="-1"
></iframe>
</body>
<style>
Expand Down
12 changes: 1 addition & 11 deletions build/assets/template/sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script>
// 某些版本浏览器会因为sandbox中引用了dexie执行此方法导致报错,这里mock一个假的
window.BroadcastChannel = function () {
return {
postMessage: function () {},
close: function () {},
};
};
</script>
<title>Document</title>
<title>Sandbox</title>
</head>
<body></body>
</html>
4 changes: 2 additions & 2 deletions build/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ const chromeManifest = { ...manifest };
delete chromeManifest.content_security_policy;

delete firefoxManifest.sandbox;
// firefoxManifest.content_security_policy 是为了支持动态组合的 ts.worker.js Blob URL
firefoxManifest.content_security_policy = "script-src 'self' blob:; object-src 'self' blob:";
// 配置 Firefox 的 CSP,以支持在 sandbox 中动态执行 background script 代码
firefoxManifest.content_security_policy = "script-src 'self' blob: 'unsafe-eval'; object-src 'self' blob:";
firefoxManifest.browser_specific_settings = {
gecko: {
id: `{${
Expand Down
Loading