
Loading…
[Firefox] Some embedded youtube videos do not work without a global noop rule for youtube. #795
Looks to me you get the logic. I had no problem playing the embedded Youtube video:
* * * block
* * image noop
ocw.mit.edu googlevideo.com * noop
ocw.mit.edu jwpcdn.com * noop
ocw.mit.edu mit.edu * noop
ocw.mit.edu youtube.com * noop
ocw.mit.edu ytimg.com * noop
I can't reproduce the issue you are having. Whether Youtube is allowed globally or locally makes no difference for the site.
I see a difference in your request log from mine: inline script tags for Youtube are blocked on your side, while they are not on my side.
Is your embedded player Flash-based or HTML5-based?
The flash player works with both rule sets I included in my original post but the HTML5 player which I was using does not work with the first ruleset. After you mentioned inline scripts I have found out that setting noop (or allow) globally for inline scripts works as well but setting noop (or allow) for inline scripts locally does not work. So, these rulesets work with the HTML5 player:
* * * block
* * image noop
* youtube.com * noop
ocw.mit.edu googlevideo.com * noop
ocw.mit.edu jwpcdn.com * noop
ocw.mit.edu mit.edu * noop
ocw.mit.edu ytimg.com * noop
or
* * * block
* * image noop
* * inline-script noop
ocw.mit.edu googlevideo.com * noop
ocw.mit.edu jwpcdn.com * noop
ocw.mit.edu mit.edu * noop
ocw.mit.edu youtube.com * noop
ocw.mit.edu ytimg.com * noop
but the following rule does not work:
* * * block
* * image noop
ocw.mit.edu * inline-script noop
ocw.mit.edu googlevideo.com * noop
ocw.mit.edu jwpcdn.com * noop
ocw.mit.edu mit.edu * noop
ocw.mit.edu youtube.com * noop
ocw.mit.edu ytimg.com * noop
Shouldn't setting noop for inline-scripts (or the youtube.com domain) locally override the global block all rule on the MIT OCW website? I don't understand why I still get
− * * * block inline-script
when I set noop (or allow) for inline-scripts (and/or youtube.com) locally with the HTML5 player.
Shouldn't setting noop for inline-scripts (or the youtube.com domain) locally override the global block all rule on the MIT OCW website?
Yes.
I understand what is happening, but I don't understand why it is happening. I need to investigate further. Somehow, uBlock thinks that the Youtube video is being played in its own tab, while it's probably in an iframe on the page -- because HTML5.
How do I force HTML5 for the embedded Youtube video? It's always falling back to Flash on my side.
Disable Flash in chrome://plugins/ and refresh the page should force HTML5 embeded youtube.
Firefox 35.0.1/uBlock 0.8.7.1-dev.7 on Ubuntu 14.04
@gorhill Doh.
How about about:addons disabling flash there?
Tools > Add-ons > Plugins on the sidebar > Shockwave Flash > Never Activate from the dropdown menu.
Ok, now I can reproduce. Inline script tags should definitely not be blocked. Investigating.
Ok, I confirm there is a problem with uBlock/Firefox here: uBlock is being told there is no parent frame, which means being told the embedded Youtube is a top-level frame, while it's of course not the case. The results in uBlock using www.youbube.com as the scope to evaluate rules.
Help from @Deathamns will be appreciated here.
In frameModules.js, line 152, I have replaced:
let isTopLevel = context === context.top;
By
let isTopLevel = context === context.top && type === this.MAIN_FRAME;
This fixes the issue. Can you confirm the code change is ok?
I will check in the tentative fix and hope @Deathamns gives feedback today, as I wish to release a version today (I prefer week-ends). No matter how I look at this, anything else than a top-level main_frame should never be an orphan.
The latest release has the fix, if you want to try it.
Yep, it works. Thanks a lot!
Ok, I get it, you are right about side-effects.
Ok, I will rewrite the fix to have parentFrameId set only for when we are dealing with a MAINFRAME document, it's not used any other way in the core code.
So how about this:
let isTopLevel = context === context.top;
let parentFrameId;
if ( isTopLevel && type === this.MAIN_FRAME ) {
Instead of:
let isTopLevel = context === context.top && type === this.MAIN_FRAME;
let parentFrameId;
if ( isTopLevel ) {
Well, if the problem was that the frame didn't use its own ids (instead it was considered as a resource file), then wouldn't be enough to just check that (then other resources would get correct ids, even if the ids are not used currently)?
let isTopLevel = context === context.top && type !== 7;
@Deathamns I don't get your suggestion: anything embedded in the top main frame object should have a parentFrameId set to the id that top main frame object, isn't?
Everything embedded in the main_frame has -1 as parentFrameId, except sub_frame (which has 0).
So, to match Chrome's behavior, this was missing in the Firefox port's frameModule.js:142:
else if ( type === 7 ) { // SUB_DOCUMENT
context = context.contentWindow;
}to match Chrome's behavior
Well, I had assumed all along the parentFrameId was 0 for any secondary resources. I just checked and you are right. Can you make whatever change you think is best? I really want to release an official version before the end of the weekend.
I use dynamic filtering with default-deny all global rule and use local noop rules to make websites work. I was trying to watch youtube videos on the MIT OCW website (any of the videos on http://ocw.mit.edu/courses/mathematics/18-06sc-linear-algebra-fall-2011/ax-b-and-the-four-subspaces/the-geometry-of-linear-equations/) but I could not get the videos to work unless I set a global noop rule for youtube.com. Even setting all the local rule cells to allow didn't work. I don't even know if this is a bug or I just don't understand how dynamic filtering works but my assumption was local rules for domains would supersede all the other rules however the only thing that can get the video to work is a global noop (or allow) rule for the youtube.com domain.
The rule set that doesn't work:
The rule set that does work:
3rd party filters:
http://i.imgur.com/lvmuEhd.png
Firefox 35.0.1/uBlock 0.8.7.1-dev.7 on Ubuntu 14.04