You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In what situations is this feature needed? (e.g., when processing specific websites, improving operational efficiency, etc.)
真沙盒
don't need to access any JavaScript object from page context.
(unsafeWindow.jQuery becomes inaccessible)
But they can communicate with DOM APIs such as addEventListener.
Additional Information
(Optional) Supplementary screenshots, sample code, or other reference information
Activity
CodFrm commentedon Aug 27, 2025
应该是注册到 world: "USER_SCRIPT" 与 content.js 一个环境,需要修改脚本注入方式了,后续再来处理这个问题
我在使用
Immersive Translate - Translate Web & PDF这个脚本,在TM/SC的环境下是无法翻译页面的,VM可以,看起来就是因为这个问题导致的cyfung1031 commentedon Aug 27, 2025
题外话
https://stayfork.app/
我点这个
Immersive Translate - Translate Web & PDF后弹出了
但这个画面出然后要等7秒才弹出真正的安装画面
有空看一下原因吧
cyfung1031 commentedon Aug 27, 2025
补充一下
如果时间不够只能做一个新 meta 的支持
那一定是
@inject-into因为VM做了这个后,FM有跟随
你查一下脚本的话也会发现很多脚本都加了这个
正如你上面写的,有些脚本是必须要加这个才能用
你查一下也会发现有些用户批判过TM应该要加这个,不然脚本用不了
derjanb 有明确写过
// @sandbox DOM就是scripts are injected into the extension context所以
// @inject-into content// @sandbox DOM两者可视为等价
在world content兩者之間, TM有一個
// @sandbox JavaScript。這是為了解決Firefox的CSP問題CodFrm commentedon Aug 27, 2025
看起来是 stayfork.app 的服务器带宽太小了,读取脚本数据确实需要这么久
// @sandbox JavaScript是什么含义呢?cyfung1031 commentedon Aug 27, 2025
能不能在那個中間頁顯示一下進度/狀態?
不然不知道的話以為壞了
cyfung1031 commentedon Aug 27, 2025
Tampermonkey 中
@sandbox的三个可选属性Tampermonkey 的
@sandbox注释用于控制用户脚本(userscript)注入时所处的执行环境。以下是它支持的三种参数选项:1.
rawMAIN_WORLD)。@sandbox,就默认使用raw模式。2.
JavaScript含义:当脚本需要访问
unsafeWindow(即页面的window对象)时,使用该访问模式。浏览器行为差异:
USERSCRIPT_WORLD,并可以绕过现有的 CSP 限制。cloneInto和exportFunction来与页面共享对象。raw模式。(Tampermonkey)3.
DOMunsafeWindow时,推荐使用该模式。ISOLATED_WORLD),或者其他允许 DOM 访问的沙箱中执行。总结对照表
rawJavaScriptunsafeWindow时使用DOM如果你需要示例代码或如何在脚本中使用这些选项,也欢迎随时告诉我~
CodFrm commentedon Aug 27, 2025
可以先记着,以后在处理(issue囤得越来越多了)
先处理完之前的issue,再来弄这个
@inject-intocyfung1031 commentedon Aug 27, 2025
一堆 2024 2023 2022 年的应该可以很多都关掉吧
你都把整个SC重写到MV3
留住那些也没用
mon-jai commentedon Sep 4, 2025
我有遇到這個問題
最近在嘗試阻止頁面更改DOM 本來打算用修改prototype的方法
但現在的scriptcat好像做不到
CodFrm commentedon Sep 5, 2025
@mon-jai 不太明白这个示例
CodFrm commentedon Sep 5, 2025
@cyfung1031 @mon-jai 在#711 中实现了
@inject-into contentmon-jai commentedon Sep 5, 2025
@CodFrm 這樣才對
因為ExecutionWorld的關係 所以沒有機會真的測試
mon-jai commentedon Sep 5, 2025
@CodFrm
nodeValue的話 是在text node的實例上面跑的cyfung1031 commentedon Sep 5, 2025
我剛剛在SC試了
沒問題
cyfung1031 commentedon Sep 5, 2025
@inject-into content的話上面不會生效CodFrm commentedon Sep 20, 2025
最新版本中已经实现