Closed WhiteSevs closed 1 year ago
Since you call the function DOMUtils.width
from your own UserScript, where unsafeWindow
is not granted, the window object is surely a proxied one.
For the context of @require
, the window
object is always the global one so that global definition could work.
By contrast, the globalThis
object is proxied.
To solve the issue for your script, either you ask to grant unsafeWindow
, or in the library DOMUtils
, set your window
object to be globalThis
.
感谢,我使用globalThis
代替了window
,脚本可以正常工作了
脚本👉https://greasyfork.org/zh-CN/scripts/445489-%E7%BD%91%E7%9B%98%E9%93%BE%E6%8E%A5%E8%AF%86%E5%88%AB
当
@require
的库内进行window
判断时,通过传递参数的window
为被Proxy
的window,而@require
库内的window却是unsafeWindow