
Loading…
Expand/refactor dynamic filtering #433
webRequest.onBeforeRequest overhead after re-factoring to support broader dynamic filtering (last lines reported after completing reference benchmark once):
µBlock> onBeforeRequest: 0.132 ms (8599 samples)
µBlock> onBeforeRequest: 0.132 ms (8649 samples)
µBlock> onBeforeRequest: 0.132 ms (8698 samples)
µBlock> onBeforeRequest: 0.132 ms (8763 samples)
µBlock> onBeforeRequest: 0.132 ms (8815 samples)
µBlock> onBeforeRequest: 0.132 ms (8894 samples)
µBlock> onBeforeRequest: 0.132 ms (8969 samples)
µBlock> onBeforeRequest: 0.132 ms (9025 samples)
µBlock> onBeforeRequest: 0.131 ms (9154 samples)
µBlock> onBeforeRequest: 0.131 ms (9169 samples)
µBlock> onBeforeRequest: 0.131 ms (9266 samples)
µBlock> onBeforeRequest: 0.131 ms (9271 samples)
New plumbing code works fine now.
Test case for issue #358:
- Open http://www.wired.com/2014/12/2014-year-in-dystopia/
- Just as before, popup UI is minimalist:
- Dynamic filtering available for users who want more control: block 3rd-party frames everywhere (strongly advised):
- Frames from
disqus.com,google.com,googlesyndication.com,outbrain.com,twitter.com,youtube.comwere blocked (great) - However, as per #358, one may want to not block frames from Youtube (generally, or on that particular site)
New plumbing allows to bypass dynamic filtering for a specific hostname --
youtube.comhere -- globally (pic) or just site-specific, user choose
Result:
iframefromdisqus.com,google.com,googlesyndication.com,outbrain.com,twitter.comstill blocked (great), embedded Youtube video now plays just fine while still filtered through static filtering (great)
Three columns:
- hostname
- global rules
- site-specific rules (site of current web page)
A cell can have one of four states:
- no rule = pale gray, can inherit broader dynamic rule
- red = block everything without exception (bypass static exception filters)
- green = allow everything without exception (useful to un-break sites broken by static filtering)
- dark gray = do not inherit any dynamic filtering rules -- static filtering will still apply
The + and - sign in the site-specific columns provides an overview of the number of requests, allowed or blocked respectively, which where made for a specific hostname. One + means the number of requests was in the single-digit range i.e. less than 10, ++ means the number of requests were in the doulbe-digit range, while +++ means 100 or more.
Case: take control of your privacy in your own hands
- Does EasyPrivacy, "Fanboy's Social Blocking List" and "Anti-ThirdpartySocial" all together prevent your browsing history from leaking?
- Not necessarily
- Go to wired.com
- See that
twitter.comnow knows you went to wired.com (see request toplatform.twitter.com)
- Another benefit of dynamic filtering: full disclosure of remote connections as a result of loading a web page
- Do not want your browsing history to be leaked to ubiquitous twitter.com? Block twitter.com everywhere by default (the 1st column means "apply everywhere"):
- However, when you visit twitter.com, it's not very practical to have requests to
twitter.comblocked
- No problem, just create an exception for
twitter.comwhen on twitter.com
- The "dark gray" exception above means: do not dynamically filter requests to
twitter.comwhen on twitter.com -- static network filtering will still take place - Now as a result, no requests to
twitter.comwill be made outside twitter.com, so you are no longer leaking browsing history to ubiquitous Twitter. - The same way you can create an exception for
twitter.comwhen on twitter.com, you can create an exception fortwitter.comfor any other web site where you do not mind having Twitter available. - That's just an example using Twitter, could be any other ubiquitous servers: Facebook, Youtube, Google, Gravatar, Disqus, whatever.
Case: un-breaking sites broken by some overzealous filters in one of the (static) filter lists.
- I will use a real case which occurred earlier this week.
- Broken site: boldchat.com
- Found out the site was broken because "Peter Lowe's Ad server list" blacklists
boldchat.com(I don't know the reason). - So all requests to
boldchat.comwere blocked, which obviously is an issue when visiting boldchat.com - As seen above in uBlock's popup, a user could see that network requests to
boldchat.comwere blocked (the−−). - To un-break the site, it's a matter of overriding static filtering using an
allowdynamic rule (green)
- As seen above, an
allowrule was created forboldchat.comfor when visiting a web page on boldchat.com: it overrides whatever block filters in effect. - Of course, the rule could be set to apply anywhere if you do not agree at all with the blacklisting of
boldchat.com - An
allowrule (green), means: unconditionally allow requests, i.e. override any existing static block filters, or any more generic dynamic block rules (like the blocking of 3rd-party frames, etc)
Being able to see the log of net requests and the why they were allowed/blocked is really a PITA currently, which is something an advanced user of dynamic filtering will want to have (I do) -- as one of its purpose is to un-break broken sites. As part of this major feature, I will provide the ability to see net requests in real time from a developer tool panel.
Being able to see all at once is definitely a huge improvement for mroe advanced users:
Unsure though if/how the dev tool pane can be ported to Firefox. There is really only one platform specific call to create the pane, all the rest is platform independent, so the pane could be in an iframe on the target page, or a separate tab. Will see what @Deathamns think of this.
Never mind, using devtools API was non-trivial with regard to portability. And I could not solve it, facing a systematic whole browser crash when trying to solve in the proper manner. In the end, I went with a fully portable mechanism. Currently network request logger will have its own separate tab, which a user can detach so that he can observe the flow of network requests in real time. Down the road, it is also easily embed-able into a existing tab (in an iframe) through a mini content script if ever we want to sort-of mimic devtools, except that this will also work for Firefox (as far as I understand).
Can you consider to add filter name to the filter list, in the dev tools. This will help the users themselves to identify, the culprit filter list and report it to the filter list maintainers appropriately.
Can you consider to add filter name to the filter list
I guess you meant "to add filter list to the filter name". Dup of #43. Not trivial unless one doesn't mind sacrificing efficiency. I mind. So far a reverse lookup is what I have in mind. Only those who care to find the list will incur a resource cost.
Ok Thanks. I agree, efficiency comes first. This is just a trivial case in-terms of usability.
Just to note, IMO, it's almost mandatory to warn the user that the flip of a given option will consume additional, non trivial, resources.
What option?
"..of a given option.." = any option.
Just wanted to note this for the future, so that the efficiency can (and should IMO) be controlled by the user, but in a consciously way of any effect of each option that is offered to him.
No worry, I don't plan to depart from what has been among top priorities since the beginning.
Just keeping track, given code change:
µBlock> onBeforeRequest: 0.123 ms (9201 samples)
µBlock> onBeforeRequest: 0.123 ms (9274 samples)
µBlock> onBeforeRequest: 0.123 ms (9361 samples)
µBlock> onBeforeRequest: 0.123 ms (9411 samples)
µBlock> onBeforeRequest: 0.122 ms (9575 samples)
µBlock> onBeforeRequest: 0.122 ms (9590 samples)
µBlock> onBeforeRequest: 0.123 ms (9741 samples)
µBlock> onBeforeRequest: 0.123 ms (9764 samples)
µBlock> onBeforeRequest: 0.123 ms (9794 samples)
µBlock> onBeforeRequest: 0.123 ms (9854 samples)
Fixed in 0.8.5.0.


To address one way or another various filed issues: #361, #358, #331, #282, #236, #68.
Definitions:
Filtering:
Filtering precedence inside dynamic filtering -- most specific to least specific:
UI:
script,iframe) to address the issues enumerated above.