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

YouTube in background tab not rendering completely #23

Closed
anrxc opened this issue Feb 22, 2021 · 3 comments
Closed

YouTube in background tab not rendering completely #23

anrxc opened this issue Feb 22, 2021 · 3 comments

Comments

@anrxc
Copy link

anrxc commented Feb 22, 2021

Since around December possibly longer, opening videos on youtube.com in a new/background tab would render only the video player, but not other elements (comments, recommendations). Force reloading the tab would make it render complete page.

Opening the main/index page of youtube was worse, since there is no video player, nothing would load.

Opening links in the current tab however would make them load instantly and in their entirety.

Firefox: 85.0.2
Cookiemaster: 1.2.0

Screenshot shows how it looks like, and a cookiemaster debug log generated when opening one such new/background tab. I couldn't attach it to this issue for some reason, had to use imgur: https://i.imgur.com/Cw4gtOB.jpg

@craigmiskell
Copy link
Owner

@anrxc I can't replicate this; on a profile with just CookieMaster installed, youtube works fine. Looks like you have a couple of other extensions installed and it's quite possible one of those is interfering/incompatible in some way. I can try to replicate with those installed if you let me know what they are and how they're configured.

@anrxc
Copy link
Author

anrxc commented Feb 23, 2021

Hi. I can reproduce it with all extensions disabled except cookiemaster. I'll list them below anyway.

Here's one thing that may be peculiar. I block google.com and www.google.com in CookieMaster.

I know from experience YouTube login will not work when those are blocked, but once logged in it keeps working. In the DEBUG log I showed previously I was expecting to see something about ".google.com", that could point to this issue being related, but there wasn't anything about it.

Edit: I also use YouTube in its native dark theme. The Dark Mode extension below excludes youtube.com.

CookieMaster
Dark Mode
Decentraleyes
Facebook Container
Livemarks
NoScript
uBlock Origin
YouTube NonStop

craigmiskell added a commit that referenced this issue Feb 25, 2021
Sometimes document.head might not be defined (see #23) so this code fails and then weird things happen to the rest of the page (honestly not sure why, but it may not matter).  However, the html element (document.documentElement) should always exist, so we now use dataset attributes on that, rather than injecting a whole new tag.  This has an additional advantage of probably being more efficient (gut instinct, no proof).
@craigmiskell
Copy link
Owner

Ahhh, sorry, I missed your point about the new tab, which was critical. The main page loads fine, but yeah, on a new tab we get just the video.

The clue for that is not in the cookiemaster logs, but in the web dev console, where there was a javascript error from the content script. Turns out document.head might be (somewhat surprisingly) undefined, so the content script fails and that seems to cause problems with the rest of the page (it's almost like a whole bunch of JS fails to run, although I can't imagine why that should be the case).

I just released 1.2.1 with a fix for that (a slightly different approach that should be more reliable).

I was able to "reproduce" the main page issue (nothing really loading at all) but only by having completely broken code injected, so I suspect when you see that there will be some clue in the web dev console (Ctrl-Shift-K, or similar depending on your OS). Next time that happens, see what's in there and share it with me. I would expect an error in red, hopefully with some indication of which line of code has failed.

I'll close this issue for now, in the hope that the fix has fixed both cases; please open a new issue with the above info, if it recurs.

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

2 participants