cvzi / Spotify-Genius-Lyrics-userscript

Userscript, shows lyrics from genius.com on Spotify web
https://greasyfork.org/en/scripts/377439-spotify-genius-lyrics
GNU General Public License v3.0
42 stars 4 forks source link

[Firefox] Lyrics stuck on loading #29

Closed HDark15 closed 5 months ago

HDark15 commented 5 months ago

Firefox with Violentmonkey, not working only on Spotify. This is the error when it active

TypeError: 'setTimeout' called on an object that does not implement interface Window. sandbox eval code:124:28
TypeError: 'setInterval' called on an object that does not implement interface Window. sandbox eval code:4907:73

The button not show up and this is the error when clicking "Show lyrics"

TypeError: 'requestAnimationFrame' called on an object that does not implement interface Window. sandbox eval code:3873:10

It stuck on loading, I can open settings and search firefox_7302FwDbny

cvzi commented 5 months ago

I will check on the weekend

cvzi commented 5 months ago

Happens only with Violentmonkey, Tampermonkey still works. It should be possible to fix it for Violentmonkey.

hdbordercollie commented 5 months ago

Same issue here with Firefox and Violentmonkey. Switching to Tampermonkey 'til fixed. <3

cyfung1031 commented 5 months ago

Can produce on my side. I will help to fix this issue.

cyfung1031 commented 5 months ago

The root cause is that there is a commit in Apr 20, 2024 which added @grant unsafeWindow in the script. This would change the window variable. The original method binding was incorrect.

Now issue should be fixed.

cvzi commented 5 months ago

Oh right, that is not supposed to be there. I tried using unsafeWindow to access the Spotify javascript to close the "Now Playing"-view, but that didn't work reliably. I'll remove it.

cvzi commented 5 months ago

I am getting TypeError: 'setTimeout' called on an object that does not implement interface Window. in Violentmonkey with Firefox

Here: https://github.com/cvzi/genius-lyrics-userscript/blob/5bb8bd13c4a407b06810cbf9003f31cb5cc43ec3/GeniusLyrics.js#L124 and here: https://github.com/cvzi/genius-lyrics-userscript/blob/5bb8bd13c4a407b06810cbf9003f31cb5cc43ec3/GeniusLyrics.js#L4939

cyfung1031 commented 5 months ago

@cvzi

Previously, you faced the issue that setTimeout/setInterval is modified by Spotify and the timer could not work, so you tried to add the code to obtain the native setTimeout/setInterval.

Now, the issue become the environment is already isolated so the obtaining native method is no longer required.

I will PR the changes required to omit unsafeWindow and make sure it is isolated from the page context. (both VM & TM)