Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.26k stars 422 forks source link

Tampermonkey Safari randomly failing to load #2153

Closed jeffbyrnes closed 1 month ago

jeffbyrnes commented 2 months ago

Tampermonkey, since the most recent update, v5.2.6199, has been exhibiting inconsistent behavior & often failing to load at all on a page. I’ve seen this behavior across multiple sites, and have even tried resetting TM to factory defaults, and even uninstalling & reinstalling it from the Mac App Store. No dice.

Here is the error it spits out to the console:

[Error] TypeError: undefined is not an object (evaluating 'lo.userScripts')
    (anonymous function) (content.js:34:358)
    (anonymous function) (content.js:80)
    Global Code (content.js:80)
    appendChild
    (anonymous function) (content.js:71)
    (anonymous function) (content.js:71)
    inject (content.js:71:318)
    r (content.js:77)
    (anonymous function) (content.js:77:124)
    wn (content.js:14)
    (anonymous function) (content.js:75:269)
    (anonymous function) (content.js:79:335)
    then (content.js:14:146)
    (anonymous function) (content.js:63:301)
    (anonymous function) (content.js:62:91)
    (anonymous function) (content.js:80)
    (anonymous function) (content.js:80)
    Global Code (content.js:80)

Specifications

EricE549X commented 2 months ago

i've had the same issue too!!! glad to see the code now cuz i wouldn't be able to figure that out lol

jeffbyrnes commented 2 months ago

@EricE549X good to know it’s not just me!

derjanb commented 2 months ago

TypeError: undefined is not an object (evaluating 'lo.userScripts')

This error is only a cosmetic issue and can't cause script injection errors. :-/ It will be fixed at the next version, though.

jeffbyrnes commented 2 months ago

@derjanb ok, that’s good to know! Now to puzzle out why my scripts are only sometimes working…

marcpage commented 2 months ago

Safari Version 17.6 (19618.3.11.11.5) TM 5.2.6199

My scripts do not load at all. Everything is dead in the water. TM says it ran my script, but the first thing I do is console.log and it is not hitting. I have two different scripts that just stopped working altogether.

Happy to provide any info needed.

derjanb commented 2 months ago

@marcpage

1) Do you see errors at the console when opening the dev tools (cmd+option+c) 2) Are Tampermonkey's content scripts listed when this happens?

image

derjanb commented 2 months ago

Also, please to to Safari "Settings" -> "Advanced" and enable "Show features for web developers". Then inspect Tampermonkey's background page. Do you see errors being logged at this console?

image

mlb5000 commented 2 months ago

I'm having the same reliability issues with Safari. @derjanb , here are the logs I'm getting from background.html

Screenshot 2024-08-23 at 11 01 14 AM
marcpage commented 2 months ago

@marcpage

  1. Do you see errors at the console when opening the dev tools (cmd+option+c)
  2. Are Tampermonkey's content scripts listed when this happens?

image

I had several errors, but none from my script or TamperMonkey (all from the site I am on or their ads networks).

I disabled TamperMonkey for a while and just reenabled it and now it is working again.

derjanb commented 1 month ago

@mlb5000 Thanks a lot for the logs!

A new version 5.3.6210 was released to the App Store which should fix this issue. 😅