Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rejoin Favorite Rooms broken on Firefox #52

Open
bbrk24 opened this issue Jul 7, 2023 · 5 comments
Open

Rejoin Favorite Rooms broken on Firefox #52

bbrk24 opened this issue Jul 7, 2023 · 5 comments

Comments

@bbrk24
Copy link
Contributor

bbrk24 commented Jul 7, 2023

I recently got a new laptop and, while I was at it, switched from Chrome (Chrome 112 for Windows 10) to Firefox (Firefox 114 for Windows 11). The "rejoin favorite rooms" userscript no longer works, and I see this error in the console:

Script error in [Greasemonkey script https://github.com/Glorfindel83//Stack Exchange Rejoin Favorite Chatrooms; version 0.1.1]:
ReferenceError: $ is not defined

   <anonymous> user-script:https://github.com/Glorfindel83//Stack Exchange Rejoin Favorite Chatrooms:144
@makyen
Copy link
Contributor

makyen commented Jul 7, 2023

The userscript you're wanting to use is, currently, incompatible with Greasemonkey 4.X (i.e., Greasemonkey 4.X is the incompatibility, not Firefox). While this particular issue is that the userscript isn't taking into account the more restrictive security context in which Greasemonkey runs userscripts, there are many compatibility issues with running userscripts under Greasemonkey 4.X, due to the Greasemonkey developers intentionally breaking compatibility in the 4.X versions with earlier versions of Greasemonkey. IIRC, I found that about 75% of the userscripts I use for Stack Exchange are not compatible with Greasemonkey 4.x.

I used to strongly recommend people use Greasemonkey 3.X, due to better security. Unfortunately, there are just too many userscripts which are not compatible with Greasemonkey 4.X, so I recommend against using it (and Firefox dropped support for Greasemonkey 3.X a couple years ago), unless you really want some of the remaining added security, and are willing to deal with a large number of userscripts not working without changes, potentially major changes. From the point of view of not running into major and consistent compatibility issues, I recommend using either Tampermonkey or Violentmonkey.

@bbrk24
Copy link
Contributor Author

bbrk24 commented Jul 7, 2023

Unfortunately, there are just too many userscripts which are not compatible with Greasemonkey 4.X, so I recommend against using it (and Firefox dropped support for Greasemonkey 3.X a couple years ago)

So 4.x is broken and 3.x is unsupported? That's unfortunate.

@makyen
Copy link
Contributor

makyen commented Jul 7, 2023

Basically, yes. The move from 3.X to 4.X was forced by Firefox switching to allowing only WebExtensions-based browser extensions, so that's on Firefox/Mozilla. That 4.X has a variety of breaking-incompatibilities with 3.X (and all other userscript managers) was a choice on the part of the Greasemonkey developers. It's possible to be compatible (as demonstrated by all the other userscript managers), it's just not as easy and would add some overhead processing/memory.

The issue this particular userscript has with being in a different security context is an issue it would have had in Greasemonkey 3.X too, so it wouldn't have worked there either. Basically, this userscript assumes that it's running in the page context, specifically that it has access to the $ function from jQuery that's loaded into the page by SE. That assumption is something which a lot of userscript writers make, including myself sometimes, because it can make things quite a bit easier. In addition, that the userscript might be running in a different context is something which most JavaScript programmers really aren't used to and don't think about. Tampermonkey and Violentmonkey do quite a bit to try to allow things to "just work", even though that's at the expense of some of the security which is provided by running the userscript in a different context, which is what Greasemonkey (now) does in 4.X (and did in 3.X and earlier).

@tuywassam
Copy link

@tuywassam
Copy link

Script error in [Greasemonkey script https://github.com/Glorfindel83//Stack Exchange Rejoin Favorite Chatrooms; version 0.1.1]:
ReferenceError: $ is not defined

user-script:https://github.com/Glorfindel83//Stack Exchange Rejoin Favorite Chatrooms:144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants