File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22< html >
33 < head >
44 < meta charset ="UTF-8 " />
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < title > Background</ title >
57 </ head >
68 < body >
79 < iframe
810 src ="/src/sandbox.html "
911 name ="sandbox "
10- sandbox ="allow-scripts "
11- style ="display: none "
12+ sandbox ="allow-same-origin allow-scripts "
13+ hidden
14+ aria-hidden ="true "
15+ tabindex ="-1 "
1216 > </ iframe >
1317 </ body >
1418</ html >
Original file line number Diff line number Diff line change 1010 < iframe
1111 src ="/src/sandbox.html "
1212 name ="sandbox "
13- sandbox ="allow-scripts "
14- style ="display: none "
13+ sandbox ="allow-same-origin allow-scripts "
14+ hidden
15+ aria-hidden ="true "
16+ tabindex ="-1 "
1517 > </ iframe >
1618 </ body >
1719 < style >
Original file line number Diff line number Diff line change 22< html lang ="en ">
33 < head >
44 < meta charset ="UTF-8 " />
5- < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
65 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7- < script >
8- // 某些版本浏览器会因为sandbox中引用了dexie执行此方法导致报错,这里mock一个假的
9- window . BroadcastChannel = function ( ) {
10- return {
11- postMessage : function ( ) { } ,
12- close : function ( ) { } ,
13- } ;
14- } ;
15- </ script >
16- < title > Document</ title >
6+ < title > Sandbox</ title >
177 </ head >
188 < body > </ body >
199</ html >
Original file line number Diff line number Diff line change @@ -75,8 +75,8 @@ const chromeManifest = { ...manifest };
7575delete chromeManifest . content_security_policy ;
7676
7777delete firefoxManifest . sandbox ;
78- // firefoxManifest.content_security_policy 是为了支持动态组合的 ts.worker.js Blob URL
79- firefoxManifest . content_security_policy = "script-src 'self' blob:; object-src 'self' blob:" ;
78+ // 配置 Firefox 的 CSP,以支持在 sandbox 中动态执行 background script 代码
79+ firefoxManifest . content_security_policy = "script-src 'self' blob: 'unsafe-eval' ; object-src 'self' blob:" ;
8080firefoxManifest . browser_specific_settings = {
8181 gecko : {
8282 id : `{${
Original file line number Diff line number Diff line change 2020 },
2121 "content_scripts" : [
2222 {
23- "matches" : [" <all_urls>" ],
24- "js" : [" src/content.js" ],
23+ "matches" : [
24+ " <all_urls>"
25+ ],
26+ "js" : [
27+ " src/content.js"
28+ ],
2529 "run_at" : " document_start" ,
2630 "all_frames" : true
2731 }
4044 " webRequestBlocking"
4145 ],
4246 "sandbox" : {
43- "pages" : [" src/sandbox.html" ]
44- }
47+ "pages" : [
48+ " src/sandbox.html"
49+ ]
50+ },
51+ "content_security_policy" : " script-src 'self' blob: 'unsafe-eval'; object-src 'self' blob:"
4552}
You can’t perform that action at this time.
0 commit comments