uBlock-LLC / uBlock

uBlock: a fast, lightweight, and lean blocker for Chrome, Firefox, and Safari.
https://ublock.org/
GNU General Public License v3.0
8.18k stars 436 forks source link

[Firefox] uBlock does not block element loaded via javascript (ABP does) #955

Closed ganego closed 2 years ago

ganego commented 9 years ago

So I recently wanted to block a certain video file that gets loaded via js but it does not work - in ABP it does. I also tried it with µBlock v0.8.9.3.

To reproduce:


a) The video seems to be loaded via a < video> tag in http://cdn2.younow.com/angularjsapp/build/younow.js?ver=3.201 (search for .mp4) b) Using the traffic logger from your addon: the video does not show up c) Using the traffic logger from firefox built-in devtools: the video does not show up (firefox bug?) e) Using ABP and showing the hideable elements: the video does show up f) Adding the video url to the ABP filter gets the video blocked

gorhill commented 9 years ago

I don't get a request to http://cdn2.younow.com/angularjsapp/src/assets/animations/intro-video.mp4 when I go to the site. I get a "Sign in and get started!" thing.

Also, at point 4 you say "add the intro-video.mp4 url to the filter": can you tell me exactly what is that "intro-video.mp4" filter? And where do you add it exactly? The details need to be spelled out.

So first step, you need to tell me how to get that http://cdn2.younow.com/angularjsapp/src/assets/animations/intro-video.mp4 network request, it's not happening on my side.

ganego commented 9 years ago

See this image for the steps I explain now: http://imgur.com/I7pC93S

I added exactly this url to uBlock filter: http://cdn2.younow.com/angularjsapp/src/assets/animations/intro-video.mp4

And yes you do not see that networkrequest either via your addon nor through the built-in devtools from Firefox (devtools -> network). ABP shows it in the loaded elements and blocking works.

gorhill commented 9 years ago

Ok, finally I could get that http://cdn2.younow.com/angularjsapp/src/assets/animations/intro-video.mp4 by clicking a link in the "Trending People" section.

I added http://cdn2.younow.com/angularjsapp/src/assets/animations/intro-video.mp4 as is in the "Your filters" pane, and tried again. uBlock showed the request blocked, and so did the developer console in Chromium.

On Firefox, I am completely unable to see any request in the network traffic which ends with intro-video.mp4, whether with uBlock's logger, or whether with Firefox network pane in the dev console.

ganego commented 9 years ago

Just realized I forgot to write which browser I use in the first post. I thought I did that but I forgot somehow. I'm Sorry. Firefox 39 Nightly on W7x64.

Yes indeed it does not show up in the dev console of FF - so I guess your addon uses those functions, but ABP does something different?

gorhill commented 9 years ago

All network requests are supposed to be intercepted, so will have to find out why this one is not. That would seem a trivial thing to do if it wasn't for the fact that Firefox doesn't see it either.

gorhill commented 9 years ago

I see the video tag in the DOM but it's removed quickly, I have no time to inspect it. Still, I would expect a network request for the remote resource to occur, I can't see any for that mp4 video.

chrisaljoudi commented 9 years ago

@gorhill I was able to reverse-engineer the JavaScript and stop the video element from being removed. Here it is in the inspector:

video elm

gorhill commented 9 years ago

How is it on Safari? Can you see it through network traffic and block it just fine?

chrisaljoudi commented 9 years ago

@gorhill yep, it works exactly as expected on Safari.

safari captures it fine

chrisaljoudi commented 9 years ago

@gorhill by the way, this is some info about the video element from the Firefox console:

info

This tells me Firefox is indeed using that as a src, but for some reason it doesn't seem to show up in Firefox's network request logger. Wonder if Firefox is screwing up caching...

chrisaljoudi commented 9 years ago

@gorhill more updates.

I can definitely confirm that part of this is how Firefox does caching. It appears that once you have the video cached, it doesn't show up in Firefox's network request log anymore.

I get the request in Firefox's logger just fine after a hard clear of the caches:

Firefox seems to be mean

However, µBlock doesn't see the request even then, which leads me to believe there's a missing hook somewhere on how µBlock attaches handlers to intercept requests.

Edit: actually, it does show up in µBlock after a hard cache reset.

Deathamns commented 9 years ago

It's even worse for me, it shows that it blocked the request (it even reached the channel.cancel(this.ABORT); line, I checked), but it still loads the content.

gorhill commented 9 years ago

If I re-launch Firefox, I can get the network request in the log. If there is a filter, it shows as blocked in the log. However, it plays in the browser. Also, I won't ever see again the network request afterward. Clearing the browser cache does not bring the network request back. Only re-launching Firefox I can see it again, once.

Edit: correction, I can see it in the log all the time now. No need to relaunch the browser. Blocked, yet still play in the browser.

tntc4 commented 9 years ago

I have the same issue.

  1. go to http://www.telerik.com/
  2. a huge video is loaded via

using FireFox 36.0 and uBlock 0.9.2.3

edit: after close and reopen Firefox, the video is no longer loads. I want to propose in the future not to try to remove

gorhill commented 9 years ago

I want to propose in the future not to try to remove tag but to intercept requests and stop them

That's what uBlock does, just look at the code.

gorhill commented 9 years ago

Saw this comment from Giorgio Maone regarding what looks like a similar situation:

As far as I can see, the playing movie stream is nowhere to be found in the HTTP traffic, so they're currently streaming it only through the unsupported, Adobe-proprietary RTMP protocol, as therube hinted

gorhill commented 9 years ago

About http://www.telerik.com/:

Filter ||d585tldpucybw.cloudfront.net/telerik-videos/tlrk_home230720141733.* works for Chromium, does not work for Firefox.

For Firefox, the resource shows as being blocked in uBlock's request log, does not show as not being fetched in Firefox's network log, and yet the video is apparently still downloaded and played. Looks like a Firefox bug to me.