Bl4Cc4t / GoodTwitter2

Userscript to modify the looks of twitter.com
489 stars 64 forks source link

Twitter Freezes and Crashes when GT is enabled #455

Closed JesperDramsch closed 2 years ago

JesperDramsch commented 2 years ago

Please check the following before you continue

This is related to #454 but much more extensive, hence the new issue. (Sorry if that was wrong)

Describe the bug Twitter breaks on any site I open when GT is enabled. The site is unresponsive to the point that I can't even open the console with F12 or click anything. It also affects the Twemex extension (however, disabling twemex doesn't solve it).

When I disable GT Twitter loads fine.

When I let it crash by itself eventually it gives the code "result_code_hung", but that hasn't helped debugging it so far.

Screenshots twitter-breaks

Your configuration

arturo182 commented 2 years ago

Have the same issue with latest Opera (89.0.4447.83). Downgrading GT2 to v0.0.39 doesn't fix it, it must be something that changed either in the Chromium engine or in Twitter itself.

If you search "GoodTwitter2" on Twitter, you can see quite a few people are experiencing this.

jesusmgg commented 2 years ago

Unusable on Firefox 103.0.1 currently. :( Hope it gets fixed.

arturo182 commented 2 years ago

Fairly sure Firefox isn't Chromium-based, so it would mean it's a twitter.com change that caused this 🤔

JesperDramsch commented 2 years ago

Fairly sure Firefox isn't Chromium-based, so it would mean it's a twitter.com change that caused this 🤔

Yes that's correct. Edge, Brave, and Chrome are Chromium. Firefox is its own thing.

maxymax13 commented 2 years ago

currently unusable on FF 103.0.1, makes the entire tab completely die while trying to load :(

Bl4Cc4t commented 2 years ago

Sadly I cannot reproduce any of these issues...

Tested on

Are there perhaps any errors showing up in the console? Please press F12 and then switch to "console". The yellow messages are warnings, they are not related to this script. You can toggle them off by removing the tick under "Custom levels" (Chrome) Inked183266019-c424653c-a6d3-4479-aa05-f680aae24f57_LI

or by clicking "Warnings" so it isn't marked anymore image

A screenshot of the output there usually helps more than a log.


Offtopic: These kinds of bugs are by far the nastiest. The ones others got on their end but cannot be reproduced by me (so I cannot fix them). I always suspect twitter to change things on the site to a specific group of accounts. For example, I still have no access to anything related to "communities", a change added a few months ago now (on any of my accounts). I can't even know if the button I added for that stuff is working now which is just hideous. Sorry for the rambling.

EdinUser commented 2 years ago
Firefox 103.0.1 Ubuntu 22, canonical
Chromium 104.0.5112.79 (Official Build) snap (64-bit) Ubuntu 22

In both of the cases either browser tab crashes, or the browser itself dies.

Aridow commented 2 years ago

image In English it means: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at api.twitter.com... Reason: CORS request did not succeed

Bl4Cc4t commented 2 years ago

As I suspected, no errors related to the script... It looks like the freezing occurs at random during the initial loading of the page, judging by the screenshots. I'm really sorry, but I certainly don't know how to fix this issue myself...

If someone wants to try and test this debug script I made, that would be helpful: gt2eb.0.0.40-debug.user.js It just prints the current line to the console for each scoped block. Maybe this helps to pinpoint the bug a bit... If you try it out, please take a screenshot of the console output and post it here. also a screenshot of what you can see on the site would be nice

you can wrap the images in a spoiler tag to make them take up less space:

<details>
<summary>console output</summary>

paste images here
</details>
Aridow commented 2 years ago

Here what it shows for me:

console output ![image](https://user-images.githubusercontent.com/65539338/183295794-8cb9e990-cdf6-4233-a63f-7fd5aced459a.png) ![image](https://user-images.githubusercontent.com/65539338/183295819-1c5aee33-38a9-4a92-870b-a0f0967b0e24.png) ![image](https://user-images.githubusercontent.com/65539338/183295854-e4fcb43b-03a6-4da6-a4dc-f811ea0f6090.png) ![image](https://user-images.githubusercontent.com/65539338/183295880-579aa280-6941-4f73-b48b-38f5feba118b.png) ![image](https://user-images.githubusercontent.com/65539338/183295957-301c3b4b-36ec-4e4f-afd2-42d0ac089609.png)

edit: wrapped images in spoiler tag for more space :)

EdinUser commented 2 years ago

Here's mine - the marked lines are where the previous page ends

Firefox 103.0.1, Ubuntu 22 console
chillycontro commented 2 years ago

same problem here, goodtwitter 2 was working earlier in the day, but now it's a 50/50 gamble on whether it works fine or is absolutely broken:

console view, on firefox v103.0.2 (64-bit), windows 10 home ![image](https://user-images.githubusercontent.com/28816808/183985804-ac92c33d-26d6-43b9-be30-819471159c87.png)

it appears to be a problem with the browser version itself, i just updated iridium browser to 2022.04.100 and i've gotten the same problem

thatsprettygood commented 2 years ago

I was wondering why my twitter page started hanging.. This happened right after I updated Firefox. The debug codes on which the script crashes are inconsistent, which coupled with the browser update, indicates that this problem may not be able to be fixed with a script update.

EdinUser commented 2 years ago

nogod

C'mon, somehow it can be made to work again...

Bl4Cc4t commented 2 years ago

I am very sure I can fix this issue, but I just cannot reproduce it. Has someone in here with tested if the issues happen with older browser versions?

highesttt commented 2 years ago

Whoops, did not see this opened. Chrome 90.0.4430.72 image

It doesn't even change the look and doesn't load

image And this is the twitter app which uses Edge in the background (I don't know if it's useful or not, just putting it there in case)

CalicoKittenPawsies commented 2 years ago

I just downgraded and tested it on Firefox 102.0.1 (64-bit) and experienced the same issue, unfortunately. Since the issue seems to be a bit sporadic, I happen to agree with the consensus that it's userbased and a Twitter side issue. Not sure if it means anything, but I did try a different Twitter reskin (Lume) which does work, so I don't think Twitter will actively block ALL changes made to their site (although Lume is an extension and the coding is obviously completely different in general as well). Let's not give up hope! Perhaps someone has a side account with the issue that Bl4Cc4t can use to try and reproduce the error? Let's not give up hope! 102.0.1

highesttt commented 2 years ago

What I find the most weird is that It happened at different times for some people... For some of you it has happened for a week, for me its only been a day and nothing was updated

Aridow commented 2 years ago

I don't know if it can be useful, but I tried to install version 0.0.6 (because it's shorter) of Good Twitter 2 and to play with it (I have no idea how it works). There's this part in it:

  let navHome = `nav > a[href='/home'],
                 nav > a[href='/notifications'],
                 nav > a[href='/messages']`

and when I replace it by:

  let navHome = `nav > a[href='/messages']`

...it seems to work. It doesn't crash or load endlessly anymore.

I then tried with version 0.0.21 (the last version where this part appears) and it works too.

Version 0.0.40 is too long to try and delete each part like that, but I deleted this line anyway:

      avatarUrl:  x(/profile_image_url_https\":\"(.+?)\",/, defaultAvatarUrl),

and replaced it by:

      avatarUrl:  x(),

and it works. It breaks, but it loads without crashing.

I have Firefox 103.0.2 and Windows 11. Hope it can help.

EdinUser commented 2 years ago

OK, a little bit narrowing down. Somehow I've decided the problem might be in the "navbar". So I played a little with it, first disabling all calls to the function addNavBar(), and later - commenting only for loop in it. This way Twitter loads with a little broken navbar on top, GT accepts changing of settings, etc. I will try to check which part is exactly the culprit of the loop...

image

UPDATE: it appears that in my case this is the Bad Guy:

          $e.appendTo(".gt2-nav-left")

on line 806, the for loop in addNavBar(). Is it possible for this append to appear too early, or to call itself somehow?

UPDATE 2: OK, so, at least for me, the solution is this:

// Line 806
        $e.appendTo(".gt2-nav-left")
// replace with
        $(".gt2-nav-left").append($e.get(0).outerHTML)

I don't know why the JQuery object breaks, but when replace it with pure, old-fashion HTML, it works normally. image

Tested on Firefox 103.0.2 (64-bit) - Ubuntu and Chromium Version 104.0.5112.79 (Official Build) snap (64-bit) - Ubuntu

Bl4Cc4t commented 2 years ago

Thank you @Aridow @EdinUser so much for finding the source of this error! Since this seems to work for both of you, I'm guessing it really is the culprit. I'll put an update out ASAP since this issue affects so many people.

I am really sorry for not being able to fix this myself, but somehow my accounts are on some less updated site all the time - not sure what to do about it.

I plan on removing jQuery altogether and restructuring the project a bit, it should (hopefully) become easier in the future to find these kinds of errors!

Aridow commented 2 years ago

I confirm @EdinUser's fix works for me.

JesperDramsch commented 2 years ago

Can confirm as well. The change of line 806 does it for me. Thank you @EdinUser!

Bl4Cc4t commented 2 years ago

Awesome, will release an update in a minute!

Bl4Cc4t commented 2 years ago

just released the update.

@Mavoy please let me know if you have any issues with v0.0.40.1 as well! (preferably in a new issue)

jeffyjeffy1023 commented 1 year ago

To anyone else that was about to make a new issue due to this bug seemingly coming back: Try just doing a hard refresh (CTRL+SHIFT+R, or COMMAND+SHIFT+R on a Mac) and that should fix it. Fixed it for me at least here on Firefox 114.0.2 with GT2 0.0.44.1.