Greasemonkey scripts not working with 2.53.15

User Help for Seamonkey and Mozilla Suite
Post Reply
Big Al 58
Posts: 11
Joined: July 17th, 2011, 11:39 am

Greasemonkey scripts not working with 2.53.15

Post by Big Al 58 »

Greasemonkey 3.10.0.1rc3pre still shows as installed but none of the scripts work anymore nor do they show up in the list of scripts when selecting Greasemonkey.
tyukok
Posts: 18
Joined: November 8th, 2021, 4:49 pm

Re: Greasemonkey scripts not working with 2.53.15

Post by tyukok »

Can confirm, Greasemonkey no longer works right in 2.53.15. All the installed scripts don't work, and when I try to install new scripts, this window appears
Image
and stays this way indefinitely.
Big Al 58
Posts: 11
Joined: July 17th, 2011, 11:39 am

Re: Greasemonkey scripts not working with 2.53.15

Post by Big Al 58 »

Same here.

Looks like it's probably a new security setting that's now blocking the scripts.

I didn't find any new setting under preferences that might allow you to "approve" it either.

Maybe there's a setting somewhere in about:config that would re-enable it?
Big Al 58
Posts: 11
Joined: July 17th, 2011, 11:39 am

Re: Greasemonkey scripts not working with 2.53.15

Post by Big Al 58 »

Managed to isolate the problem to the new greprefs.js file in omni.ja (swapped it out for the old one from 2.53.14 and Greasemonkey started working again)

After some testing by replacing parts of the new one with parts from the old one I've discovered that, whatever it is, it "seems" to be located somewhere between line 184 and 274.

I'll continue trying and narrow it down and, if I manage to find the specific command that's causing the problem, I'll post it here.
frg
Posts: 1361
Joined: December 15th, 2015, 1:20 pm

Re: Greasemonkey scripts not working with 2.53.15

Post by frg »

Try setting intl.locale.matchOS to false and general.useragent.locale to en-US or whatever locale you want. We needed to move in later locale stuff for going forward supporting new web apis. Seems Greasemonkey uses the old prefs/apis directly. No guarantee that this will work but it is a start.

https://bugzilla.mozilla.org/show_bug.cgi?id=1414390
Big Al 58
Posts: 11
Joined: July 17th, 2011, 11:39 am

Re: Greasemonkey scripts not working with 2.53.15

Post by Big Al 58 »

frg, thanks for the tip but I'd already figured out those were the two prefs missing from the new greprefs.js file that caused Greasemonkey to stop working.

The problem was the "getPreferredLocale.js" located in {e4a8a97b-f2ed-450b-b12d-ee082ba24781}\modules\util in Greasemonkey used both of those values.

The section that used "intl.locale.matchOS" made a call to "Services.locale.getLocaleComponentForUserAgent" if it was true but, since it was "always" false, it didn't really do anything (except cause Greasemonkey to fail once that pref no longer existed.)

So I modified the "getPreferredLocale.js" file in my version of Greasemonkey to remove that section and replaced "general.useragent.locale" with the new "intl.locale.requested" and got it working again.

See below for the new download link that supports multiple languages.
Last edited by Big Al 58 on January 28th, 2023, 4:32 am, edited 1 time in total.
tyukok
Posts: 18
Joined: November 8th, 2021, 4:49 pm

Re: Greasemonkey scripts not working with 2.53.15

Post by tyukok »

Can confirm, now Greasemonkey works again... but only if the browser's locale is "en_US". For other locales it still doesn't work.
Maybe there is a way to fix it properly, but I found that using the US version and installing an appropriate langpack doesn't seem to break things, so I'm ok with that.
User avatar
qwert1
Posts: 3
Joined: January 27th, 2023, 6:50 am

Re: Greasemonkey scripts not working with 2.53.15

Post by qwert1 »

Hey guys!
I believe, I fixed the issue with Greasemonkey.
Like Big Al said, extract the addon and navigate to modules/util and open getPreferredLocale.js in your preferred text editor and make the following changes:
In line 7, replace "intl.locale.matchOS" with "intl.regional_prefs.use_os_locales"
In line 10, replace "Services.locale.getLocaleComponentForUserAgent" with "Services.locale.getAppLocaleAsLangTag"

Save these changes, close everything and zip the addon again and now it should work. :D
Or download my fixed version here https anonfiles.com/K7ndr3U9ye/greasemonkey-3.10-SM-2.53.15-FIX
Last edited by LIMPET235 on January 30th, 2023, 4:48 am, edited 1 time in total.
Reason: Broke the direct/live links.
Big Al 58
Posts: 11
Joined: July 17th, 2011, 11:39 am

Re: Greasemonkey scripts not working with 2.53.15

Post by Big Al 58 »

tyukok wrote:but only if the browser's locale is "en_US". For other locales it still doesn't work.
My bad! #-o

The Greasemonkey extension I updated was the one already installed on my system which only supported the en-US locale (I had "deliberately" removed all the others since I'll never use them.)

I went back and downloaded the "original" directly from SourceForge, modified it, and here's an updated link to this version that now supports 34 different locales.

https://mega.nz/file/XMsXVS6I#v2zIbEmId ... IN-iLZiFdg
DoYouWantKarate
Posts: 24
Joined: March 24th, 2005, 9:24 am

Re: Greasemonkey scripts not working with 2.53.15

Post by DoYouWantKarate »

qwert1 wrote:Like Big Al said, extract the addon and navigate to modules/util and open getPreferredLocale.js in your preferred text editor and make the following changes:
In line 7, replace "intl.locale.matchOS" with "intl.regional_prefs.use_os_locales"
In line 10, replace "Services.locale.getLocaleComponentForUserAgent" with "Services.locale.getAppLocaleAsLangTag"

Save these changes, close everything and zip the addon again and now it should work. :D
I tried this on macOS 12.6 [Edit - and Xubuntu 20], but it doesn't seem to work (Greasemonkey 3.10.0.1rc3pre misbehaving the same way as before with SM 2.53.15).

Downloaded latest gmport and extracted /modules/util/getPreferredLocale.js, then edited it like so:

Code: Select all

Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import('chrome://greasemonkey-modules/content/util.js');

var EXPORTED_SYMBOLS = ['getPreferredLocale'];

var preferredLocale = (function() {
  var matchOS = Services.prefs.getBoolPref("intl.regional_prefs.use_os_locales");

  if (matchOS)
    return Services.locale.getAppLocaleAsLangTag();

  return Services.prefs.getCharPref("general.useragent.locale") || "en-US";
})();

function getPreferredLocale() {
  return preferredLocale;
Freshened the .XPI with the updated file:

Code: Select all

$ zip -rf ../greasemonkey-3.10.0.1rc3pre-sm.xpi *
freshening: modules/util/getPreferredLocale.js (deflated 44%)
Confirmed the file was updated in the .XPI:

Code: Select all

$ unzip -l greasemonkey-3.10.0.1rc3pre-sm.xpi | grep -i getpreferredlocale
      517  01-30-2023 10:03   modules/util/getPreferredLocale.js
Confirmed I was installing the modified XPI and tried uninstalling/reinstalling it to no effect.
User avatar
qwert1
Posts: 3
Joined: January 27th, 2023, 6:50 am

Re: Greasemonkey scripts not working with 2.53.15

Post by qwert1 »

I'm kind of at a loss here.
Can't speak for MacOS, but these changes worked for me on Debian with SeaMonkey 2.53.15.
Greasemonkey lost all userscripts after I updated it and I had to reinstall them. Other than that, in SeaMonkey in about:config
the setting "intl.regional_prefs.use_os_locales" has to be "false" for this to work and it should default to false.
The only thing I did differently was, I didn't update the old xpi, I made a new one.
Post Reply