Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

控制台报错MutationEvent is not defined #299

Closed
zhangfangzhou01 opened this issue Jul 11, 2024 · 7 comments
Closed

控制台报错MutationEvent is not defined #299

zhangfangzhou01 opened this issue Jul 11, 2024 · 7 comments

Comments

@zhangfangzhou01
Copy link

zhangfangzhou01 commented Jul 11, 2024

脚本地址:更好的 Youtube Shorts

  1. 运行环境为:Chrome Dev 128.0.6559.0
  • 暴力猴 2.20.0:正常运行
  • 脚本猫 0.16.3:控制台报错 MutationEvent is not defined
  1. 运行环境为:Chrome 126.0.6478.127
  • 暴力猴 2.20.0:正常运行
  • 脚本猫 0.16.3:正常运行

MutationEvent从127开始被移除,但是我并没有使用MutationEvent,我在脚本中只使用了MutationObserver,而MutationObserver并没有被弃用

已知可以在用户端把chrome://flags/#mutation-events设置为Enabled解决这个问题,脚本猫是否可以像Tampermonkey/tampermonkey#2011 (comment)一样在之后的版本中修复这个问题

@CodFrm
Copy link
Member

CodFrm commented Jul 11, 2024

81e33ced68c2bc0f163e1a99fe1e6b95

啊,这个东西还挺重要的,影响有点严重了,我研究一下

https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent

主要是在脚本猫中的消息交互有用到

@CodFrm
Copy link
Member

CodFrm commented Jul 11, 2024

请问什么时候会触发?

我使用128.0.6559.0(正式版本)dev (arm64),脚本猫 v0.16.4,运行上述脚本,暂未复现

@zhangfangzhou01
Copy link
Author

浏览器:Chrome Dev 128.0.6559.0
网址:https://www.youtube.com/shorts/8Og5ZESMi8s
脚本猫版本:0.16.4 (github release) / 0.16.3 (chrome网上应用商店)
插件地址:https://greasyfork.org/zh-CN/scripts/487271-better-youtube-shorts
报错信息:MutationEvent is not defined

以上运行环境下稳定触发上述的报错 @CodFrm

@zhangfangzhou01
Copy link
Author

zhangfangzhou01 commented Jul 11, 2024

当我在相同的运行环境下使用另一个用到MutationObserver的插件去除链接重定向访问bing - hello时,Chrome Dev给出了更多的报错信息

content.ts在通信时用到了MutationEvent,有没有可能换成CustomEvent等其他方法来绕过MutationEvnet?

希望对作者有所帮助
屏幕截图 2024-07-11 161540

@zhangfangzhou01
Copy link
Author

81e33ced68c2bc0f163e1a99fe1e6b95

啊,这个东西还挺重要的,影响有点严重了,我研究一下

https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent

主要是在脚本猫中的消息交互有用到

是的,我认为这个bug需要及时得到修复,因为根据时间表来看,Chrome稳定版将在7月23日升到v127,如果不修复的话彼时可能所有带有MutationObserver或MutationEvent的插件将不能正常工作

@CodFrm
Copy link
Member

CodFrm commented Jul 12, 2024

修复了,哥哥试试这个版本:https://github.com/scriptscat/scriptcat/actions/runs/9901910434

主要影响到使用了GM_addElement/addStyle的脚本

没问题的话,我会尽快发布这个版本

@zhangfangzhou01
Copy link
Author

我这边测了一下没有报错了

@CodFrm CodFrm closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants