Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

YouTube scripts don't work on homepage #16

Closed
ghajini opened this issue Sep 29, 2016 · 13 comments
Closed

YouTube scripts don't work on homepage #16

ghajini opened this issue Sep 29, 2016 · 13 comments
Assignees

Comments

@ghajini
Copy link

ghajini commented Sep 29, 2016

Describe the issue

ublock breaking youtube pages.
cannot see preview images of youtube videos.
to see next youtube videos when i click "load more" nothing happens.
screenshot will tell you more
scroll down for seeing broken images

One or more specific URLs where the issue occurs

www.youtube.com

Screenshot in which the issue can be seen

screenshot 43

Steps for anyone to reproduce the issue

1.go to youtube homepage
2.ublock breaking youtube pages
3.To see next youtube videos when i click "load more" nothing happens
4.screenshot will tell you more
5. click load more at bottom of page ,nothing will hapen(will not load next video)

Your settings

default settings

  • Browser/version: microsoft edge
  • uBlock Origin version: 1.9.11.101
Your filter lists

Default filter lists + antiadblock killer + adblock warning removal list

Your custom filters (if any)

none

@japborst
Copy link

japborst commented Oct 3, 2016

@ghajini I had the same issue on the FrontPage (subscriptions worked fine). I believe it was a list issue, as everything does work perfectly now :)

@ghost
Copy link

ghost commented Oct 4, 2016

@ghajini I'm having the same issue as well.

@japborst How did you fix your list? I mean, what list are you using now?

@ghajini
Copy link
Author

ghajini commented Oct 6, 2016

still persists @nikrolls and @gorhill

@nicole-ashley
Copy link
Owner

I can reproduce this, but no exceptions are being thrown or logged so it's a little hard to identify where the issue is.

@anewuser
Copy link

@ghajini Please don't mention the nickname of gorhill on this repository. He doesn't work on the Edge version because he doesn't use Windows.

@nicole-ashley
Copy link
Owner

It seems the following lists cause the issue:

  • EasyList
  • EasyList without element hiding rules
  • Peter Lowe's Ad server list
  • Fanboy's Enhanced Tracking List
  • Malvertising filter list by Disconnect
  • All multipurpose lists

The issue is that all some or all YouTube scripts seem to stop working. This includes lazy-load of assets and items.

@nicole-ashley
Copy link
Owner

nicole-ashley commented Nov 6, 2016

After many hours of trawling through YouTube's uglified code, I've discovered that the root cause of the issue seems to be that window.onload never fires. YouTube binds to this to set off its asynchronous scheduler (which then loads all the nice-to-have JS). I can't replicate outside YouTube though.

To replicate it inside YouTube:

  1. Set a breakpoint at line 1 of scheduler.js (this is run before window.onload)
  2. Refresh the page and wait for the breakpoint to hit
  3. Go to the console and use the command window.onload = alert
  4. Continue debugging

Now you should either get an alert (eg, maybe a race condition meaning YouTube sets window.onload after the event has already fired), or YouTube should work (because it bound to window.onload in time and its scheduler was kicked off). Neither happens.

DOMContentLoaded works fine.

@nicole-ashley nicole-ashley changed the title youtube YouTube scripts don't work on homepage Nov 6, 2016
@nicole-ashley
Copy link
Owner

Curiously this doesn't seem to be an issue if you load a video and then click back to the homepage; everything seems to init fine on video pages, and as long as you don't refresh the tab the homepage works fine.

@nicole-ashley
Copy link
Owner

The Edge team is looking into the issue: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9699196/

@nicole-ashley
Copy link
Owner

Update from one of the developers on the Edge team:

I spent some time this morning trying to come up with a workaround and I couldn’t really find much that would actually work well. Unfortunately, the issue looks related to blocking an iFrame with webrequest, so the only thing I can think of as a workaround right now would be to avoid blocking iFrames with webrequest before onload fires and then just hiding them (already happens, the only workaround that needs to be added is to prevent webrequest from filtering iFrames before document.readyState hits “complete”). I’ve tested this out and it works with my reduced repro and with youtube.com. Not ideal, but it hides the ads.

@gorhill, what are your thoughts about this? I don't know a lot about the core yet but I would assume this is fairly deep and challenging to override in platform. If I could it would still mean that iframe resources are loading (even if they're being hidden) which is less than ideal.

My current best (but untested) idea for implementing a workaround extension-side is to detect the YouTube homepage URL in vapi-client.js (or something else page-side) and bind an event to the DOMContentLoaded event (not affected by this bug) to call the method at window.onload if it hasn't already been called. Pretty hacky but it would fix the issue for now.

The alternative is to wait until this is fixed in Edge (Creators Update). It may or may not be backported to a cumulative update for the current release. Either way, waiting for an Edge fix will mean a delay in releasing the extension to the Windows Store.

@gorhill
Copy link

gorhill commented Nov 21, 2016

what are your thoughts about this?

The issue needs to be more specifically described with all the technical details -- the description is too vague. Whatever solution there is might be different if I understand exactly the core issue with all the technical details.

Not blocking iframe through webRequest is an awfully terrible solution, this essentially means that uBO would be forced to connect to 3rd-party sites and load iframe payload despite assurance to the contrary in its UI and filters/rules (like the ability to block all 3rd-party frames in advanced panel).

I see this as a anti-user workaround. My stance with uBO is that it must be true to users. Silently doing the opposite of what its filters/rules say is the opposite of being true to users. uBO is a content blocker, not an "ad blocker", so its purpose is to block content, not to merely make "ads not visible" (which is what the proposed workaround does), something acceptable for an "ad blocker", but not for uBO. If no other solutions are possible, I rather not have uBO available until they fix such basic issue. uBO being true to users is more important than uBO being in Windows store.

@nicole-ashley
Copy link
Owner

Thanks @gorhill. I agree on all points, I mainly wanted to cross-reference my thoughts with yours.

I have found a workaround that addresses the exact issue, has no side-effects, and will be easy to remove once the Edge bug is fixed: Workaround for YouTube / window.onload issue. I'll leave it open for a day or so to give opportunity for feedback (optional), and then merge it for a future release.

nicole-ashley added a commit that referenced this issue Nov 29, 2016
Workaround for YouTube / window.onload issue #16
@nicole-ashley
Copy link
Owner

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

No branches or pull requests

5 participants