Changes between Version 10 and Version 11 of Ticket #6622


Ignore:
Timestamp:
05/16/2018 12:24:41 PM (13 months ago)
Author:
kzar
Comment:

Thanks for updating the test instructions. I've fleshed out the description a bit more for you and once the dependency update details are in I'll mark this as ready.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6622

    • Property Cc sebastian kzar Ross added
    • Property Priority changed from Unknown to P2
  • Ticket #6622 – Description

    v10 v11  
    11=== Background === 
    2 Issue #6592 introduce a new rewrite option to rewrite URL instead of blocking. This is to implement the WebExt side of the rewrite. 
     2Sometimes it's desirable to redirect a request, instead of blocking it entirely. Perhaps the website detects when requests fail, or perhaps a request is necessary but its URL has tracking information appended which would be desirable to strip. For this we're adding the `$rewrite` filter option. In #6592 we introduced the option, and here we're going to make use of it. 
    33 
    4 Rewriting a URL is, instead of blocking the request, modifying the request URL to load that instead. 
     4Take an example `$rewrite` filter: 
     5 
     6{{{ 
     7/(server\.com\/content\/.*\.m3u8)\?.*$/$rewrite=$1 
     8}}} 
     9 
     10A request to this URL: 
     11 
     12{{{ 
     13https://server.com/content/foo.m3u8?userId=12345 
     14}}} 
     15 
     16Would be redirected to would be redirected to 
     17 
     18{{{ 
     19https://server.com/content/foo.m3u8 
     20}}} 
     21 
     22- The syntax for the rewrite option is the same as [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter for Regexp.replace]. 
     23- A request will only be redirected if the rewritten URL is of the same origin, yet different to the original URL. 
    524 
    625=== What to change === 
     
    2241 
    2342=== Hint for testers === 
    24 * Test that blocking filters without rewrite aren't broken 
    25 * Ensure that the rewrites are logged accordingly into the developer tools. 
     43* Test that regular request blocking still works. 
    2644* Test filters with rewrite option. 
    2745  * Basic rewrite: add filter `/(testpages\.adblockplus\.org\/css\/testpages\.css)\?14$/$rewrite=$1?42` and visit https://testpages.adblockplus.org/en/testcases/css/03 . You should notice the rewrite in the Adblock Plus developer tool panel. 
    2846  * Rewrite to relative URL. Should succeed. Add filter `/testpages\.adblockplus\.org(\/css\/testpages\.css)\?14$/$rewrite=$1?42` (and make sure the previous filter is removed). You should notice the rewrite in the Adblock Plus developer tool panel. 
    2947  * Rewrite to different origin: Should fail and the original request let through. Add filter `/testpages\.adblockplus\.org(\/css\/testpages\.css)\?14$/$rewrite=bogus.adblockplus.org$1?42` (and make sure the previous filter is removed). You should notice the rewrite in the Adblock Plus developer tool panel, showing that the rewritten URL is the same as the original one. 
     48* Ensure that the rewrites are logged accordingly into the developer tools.