SimonAlling / better-sweclockers

Better SweClockers
MIT License
11 stars 4 forks source link

Script sometimes fails when navigating(Tampermonkey) #217

Open PontusMagnusson opened 2 years ago

PontusMagnusson commented 2 years ago

When navigating around on Sweclockers, the script sometimes fails with the following error.

Navigated to https://www.sweclockers.com/forum/trad/1541641-better-sweclockers-2018?p=1
userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:21 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild')
    at mi (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:21:5132)
    at Module.eval (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:21:41461)
    at n (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:17:110)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:17:902)
    at Proxy.tms_5036f5d4_0105_406d_a9e2_c96b033710a5$ (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:17:912)
    at nt (<anonymous>:13:1036)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:1:95)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:1:537)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:22:6)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=5036f5d4-0105-406d-a9e2-c96b033710a5:24:3)

This causes the entire script to fail and all BCS features disappear until the page is reloaded.

I've only experienced this when using Tampermonkey.

I'm running Tampermonkey 4.14, and Better Sweclocker v. 2021.9.3.10.47.55.

Browser is Chrome 98.0.4758.102 64-bit

SimonAlling commented 2 years ago

Thanks for the bug report! I was quickly able to reproduce a similar error (with hasAttribute instead of appendChild) by simply visiting the link in your error message:

userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:17 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'hasAttribute')
    at Module.W (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:17:34679)
    at Module.eval (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:21:41972)
    at n (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:17:110)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:17:902)
    at Window.tms_135161ea_0acc_4c8f_a502_27013788c40d (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:17:912)
    at <anonymous>:4:80
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:1:95)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:1:598)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:22:6)
    at eval (userscript.html?name=Better%20SweClockers.user.js&id=135161ea-0acc-4c8f-a502-27013788c40d:24:3)

As a quick fix, I recommend switching to Violentmonkey. I would do so anyway, as it's superior to Tampermonkey in my opinion.