JavScript

一站式体验,JavBus & JavDB 兼容

< Feedback on JavScript

Question/comment

§
Posted: 03.12.2022

开启脚本会导致A、B站等出现暂停不了,视频缓冲出现问题,隐身模式只启用该脚本一样复现了问题。
还是限制一下作用域名比较好吧,这种全局作用很容易出现BUG

blcAuthor
§
Posted: 03.12.2022

开启脚本会导致A、B站等出现暂停不了,视频缓冲出现问题,隐身模式只启用该脚本一样复现了问题。还是限制一下作用域名比较好吧,这种全局作用很容易出现BUG

  • 反馈信息有限无法定位 / 复现
  • 建议排查环境问题(大概率)
§
Posted: 03.12.2022

开启脚本会导致A、B站等出现暂停不了,视频缓冲出现问题,隐身模式只启用该脚本一样复现了问题。还是限制一下作用域名比较好吧,这种全局作用很容易出现BUG

  • 反馈信息有限无法定位 / 复现
  • 建议排查环境问题(大概率)

我贴下console信息给你,我的猜测原因是 const DOC = document;导致的问题,这个变量名字太常用了,A站也使用了同一个变量名,注释掉这行后正常了

https://www.acfun.cn/v/ac39937215

Uncaught TypeError: n.Doc is not a constructor
    at Function.n.prepare (asyncPlayerPlugins.b678fa.js:153)
    at Array.<anonymous> (asyncPlayerPlugins.b678fa.js:153)
    at HTMLDocument.DOC.addEventListener (userscript.html?name=JavScript.user.js&id=4816598c-0f97-40dd-b1c8-fe5a70641608:54)
    at asyncPlayerPlugins.b678fa.js:153
    at Object.<anonymous> (asyncPlayerPlugins.b678fa.js:153)
    at Object.window.asyncPlayerPlugins (asyncPlayerPlugins.b678fa.js:153)
    at n (asyncPlayerPlugins.b678fa.js:2)
    at Module.<anonymous> (asyncPlayerPlugins.b678fa.js:177)
    at n (asyncPlayerPlugins.b678fa.js:2)
    at window.asyncPlayerPlugins (asyncPlayerPlugins.b678fa.js:2)
n.prepare @ asyncPlayerPlugins.b678fa.js:153
(anonymous) @ asyncPlayerPlugins.b678fa.js:153
DOC.addEventListener @ userscript.html?name=JavScript.user.js&id=4816598c-0f97-40dd-b1c8-fe5a70641608:54
(anonymous) @ asyncPlayerPlugins.b678fa.js:153
(anonymous) @ asyncPlayerPlugins.b678fa.js:153
window.asyncPlayerPlugins @ asyncPlayerPlugins.b678fa.js:153
n @ asyncPlayerPlugins.b678fa.js:2
(anonymous) @ asyncPlayerPlugins.b678fa.js:177
n @ asyncPlayerPlugins.b678fa.js:2
window.asyncPlayerPlugins @ asyncPlayerPlugins.b678fa.js:2
(anonymous) @ asyncPlayerPlugins.b678fa.js:2
ac39937215:117 Uncaught TypeError: Cannot read property 'init' of undefined
    at ac39937215:117
    at arguments.<computed> (userscript.html?name=%E8%AE%A1%E6%97%B6%E5%99%A8%E6%8E%8C%E6%8E%A7%E8%80%85%7C%E8%A7%86%E9%A2%91%E5%B9%BF%E5%91%8A%E8%B7%B3%E8%BF%87%7C%E8%A7%86%E9%A2%91%E5%B9%BF%E5%91%8A%E5%8A%A0%E9%80%9F%E5%99%A8.user.js&id=2553224b-4b8b-4121-b676-1047cf3d3258:2550)
blcAuthor
§
Posted: 03.12.2022

开启脚本会导致A、B站等出现暂停不了,视频缓冲出现问题,隐身模式只启用该脚本一样复现了问题。还是限制一下作用域名比较好吧,这种全局作用很容易出现BUG

反馈信息有限无法定位 / 复现
建议排查环境问题(大概率)

我贴下console信息给你,我的猜测原因是 const DOC = document;导致的问题,这个变量名字太常用了,A站也使用了同一个变量名,注释掉这行后正常了

https://www.acfun.cn/v/ac39937215

Uncaught TypeError: n.Doc is not a constructor
at Function.n.prepare (asyncPlayerPlugins.b678fa.js:153)
at Array. (asyncPlayerPlugins.b678fa.js:153)
at HTMLDocument.DOC.addEventListener (userscript.html?name=JavScript.user.js&id=4816598c-0f97-40dd-b1c8-fe5a70641608:54)
at asyncPlayerPlugins.b678fa.js:153
at Object. (asyncPlayerPlugins.b678fa.js:153)
at Object.window.asyncPlayerPlugins (asyncPlayerPlugins.b678fa.js:153)
at n (asyncPlayerPlugins.b678fa.js:2)
at Module. (asyncPlayerPlugins.b678fa.js:177)
at n (asyncPlayerPlugins.b678fa.js:2)
at window.asyncPlayerPlugins (asyncPlayerPlugins.b678fa.js:2)
n.prepare @ asyncPlayerPlugins.b678fa.js:153
(anonymous) @ asyncPlayerPlugins.b678fa.js:153
DOC.addEventListener @ userscript.html?name=JavScript.user.js&id=4816598c-0f97-40dd-b1c8-fe5a70641608:54
(anonymous) @ asyncPlayerPlugins.b678fa.js:153
(anonymous) @ asyncPlayerPlugins.b678fa.js:153
window.asyncPlayerPlugins @ asyncPlayerPlugins.b678fa.js:153
n @ asyncPlayerPlugins.b678fa.js:2
(anonymous) @ asyncPlayerPlugins.b678fa.js:177
n @ asyncPlayerPlugins.b678fa.js:2
window.asyncPlayerPlugins @ asyncPlayerPlugins.b678fa.js:2
(anonymous) @ asyncPlayerPlugins.b678fa.js:2
ac39937215:117 Uncaught TypeError: Cannot read property 'init' of undefined
at ac39937215:117
at arguments. (userscript.html?name=%E8%AE%A1%E6%97%B6%E5%99%A8%E6%8E%8C%E6%8E%A7%E8%80%85%7C%E8%A7%86%E9%A2%91%E5%B9%BF%E5%91%8A%E8%B7%B3%E8%BF%87%7C%E8%A7%86%E9%A2%91%E5%B9%BF%E5%91%8A%E5%8A%A0%E9%80%9F%E5%99%A8.user.js&id=2553224b-4b8b-4121-b676-1047cf3d3258:2550)

感谢补充,基本是 addEventListener 事件的劫持代码导致

// 大约 52 ~ 56 行
const addListener = EventTarget.prototype.addEventListener;
DOC.addEventListener = function (type, ...args) {
    if (type === "DOMContentLoaded" && DOC.readyState !== "loading") return args[0]();
    addListener.call(this, type, ...args);
};

这段代码最初是为了少部分客户端下脚本注入执行被(未知原因)延迟导致未执行生效做的兼容,以下是一些解决方案:

  • 尝试删除上述劫持代码,绝大部分客户端都能正常注入执行脚本
  • 前往脚本管理扩展(如 Tampermonkey)管理页点击脚本设置 包括/排除
  • 等待下次推送更新修复此项

Post reply

Sign in to post a reply.