gorhill / uBlock

uBlock Origin - An efficient blocker for Chromium and Firefox. Fast and lean.
GNU General Public License v3.0
46.33k stars 3.1k forks source link

Run request data tests with Wasm enabled too #3829

Closed mjethani closed 3 years ago

mjethani commented 3 years ago

Following up from here: https://github.com/gorhill/uBlock/pull/3828#issuecomment-899449015

mjethani commented 3 years ago

@gorhill to see that this works, slice the requests array to keep only the first 10 items and remove the --reporter argument to Mocha in test.js. You'll see that the tests are run in a sequence, first without Wasm and then with Wasm.

mjethani commented 3 years ago

@gorhill to see that this works, slice the requests array to keep only the first 10 items and remove the --reporter argument to Mocha in test.js. You'll see that the tests are run in a sequence, first without Wasm and then with Wasm.

Here's what the output looks like for me:

  Request data
    Wasm off
      ✔ should allow sub_frame URL https://www.craigslist.org/ from origin https://www.craigslist.org/
      ✔ should allow sub_frame URL https://geo.craigslist.org/ from origin https://geo.craigslist.org/
      ✔ should allow sub_frame URL https://frederick.craigslist.org/ from origin https://frederick.craigslist.org/
      ✔ should allow stylesheet URL https://www.craigslist.org/styles/cl.css?v=6f112c5b20333b3a4055760b0ef35bd9 from origin https://frederick.craigslist.org/
      ✔ should allow stylesheet URL https://www.craigslist.org/styles/homepage.css?v=fd782da6f17087631880964a0e5fd86f from origin https://frederick.craigslist.org/
      ✔ should allow stylesheet URL https://www.craigslist.org/styles/jquery-ui-clcustom.css?v=3b05ddffb7c7f5b62066deff2dda9339 from origin https://frederick.craigslist.org/
      ✔ should allow script URL https://www.craigslist.org/js/general-concat.min.js?v=d905ad65b5ccd3878b8049d38cbd6b4c from origin https://frederick.craigslist.org/
      ✔ should allow script URL https://www.craigslist.org/js/homepage-concat.min.js?v=2d722fc0dae16bf9eec44ae3af659873 from origin https://frederick.craigslist.org/
      ✔ should allow other URL https://www.craigslist.org/js/search-concat.min.js?v=e58b739367a8d2133031faf62c398e87 from origin https://frederick.craigslist.org/
      ✔ should allow sub_frame URL https://www.craigslist.org/static/www/localStorage-b2c30773fe82c3d5e475613ad0f725fa9ab277fb.html from origin https://www.craigslist.org/static/www/localStorage-b2c30773fe82c3d5e475613ad0f725fa9ab277fb.html
    Wasm on
      ✔ should allow sub_frame URL https://www.craigslist.org/ from origin https://www.craigslist.org/
      ✔ should allow sub_frame URL https://geo.craigslist.org/ from origin https://geo.craigslist.org/
      ✔ should allow sub_frame URL https://frederick.craigslist.org/ from origin https://frederick.craigslist.org/
      ✔ should allow stylesheet URL https://www.craigslist.org/styles/cl.css?v=6f112c5b20333b3a4055760b0ef35bd9 from origin https://frederick.craigslist.org/
      ✔ should allow stylesheet URL https://www.craigslist.org/styles/homepage.css?v=fd782da6f17087631880964a0e5fd86f from origin https://frederick.craigslist.org/
      ✔ should allow stylesheet URL https://www.craigslist.org/styles/jquery-ui-clcustom.css?v=3b05ddffb7c7f5b62066deff2dda9339 from origin https://frederick.craigslist.org/
      ✔ should allow script URL https://www.craigslist.org/js/general-concat.min.js?v=d905ad65b5ccd3878b8049d38cbd6b4c from origin https://frederick.craigslist.org/
      ✔ should allow script URL https://www.craigslist.org/js/homepage-concat.min.js?v=2d722fc0dae16bf9eec44ae3af659873 from origin https://frederick.craigslist.org/
      ✔ should allow other URL https://www.craigslist.org/js/search-concat.min.js?v=e58b739367a8d2133031faf62c398e87 from origin https://frederick.craigslist.org/
      ✔ should allow sub_frame URL https://www.craigslist.org/static/www/localStorage-b2c30773fe82c3d5e475613ad0f725fa9ab277fb.html from origin https://www.craigslist.org/static/www/localStorage-b2c30773fe82c3d5e475613ad0f725fa9ab277fb.html
mjethani commented 3 years ago

Here's what the output looks like for me

With no local changes after this patch:

[▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬]

  498289 passing (3m)

-----------------------------|---------|----------|---------|---------|-----------------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s           
-----------------------------|---------|----------|---------|---------|-----------------------------
All files                    |   76.26 |    83.94 |   58.64 |   76.26 |                             
 uBlock0.npm                 |   83.81 |    72.73 |      80 |   83.81 |                             
  index.js                   |   83.81 |    72.73 |      80 |   83.81 | ...,251-252,258-261,271-272 
 uBlock0.npm/js              |   76.06 |    84.32 |   57.93 |   76.06 |                             
  base64-custom.js           |   54.88 |    56.25 |      50 |   54.88 | ...,161-192,196-228,232-240 
  biditrie.js                |   87.98 |    87.14 |   83.78 |   87.98 | ...-858,865-914,931-932,948 
  filtering-context.js       |    68.8 |    82.76 |   37.14 |    68.8 | ...,334-336,339-348,351-360 
  globals.js                 |   96.36 |    85.71 |     100 |   96.36 | 33-34                       
  hntrie.js                  |   79.46 |    81.48 |   78.13 |   79.46 | ...-701,704-715,718-767,799 
  static-filtering-io.js     |    89.8 |     87.5 |   66.67 |    89.8 | ...,111-113,123-124,126-127 
  static-filtering-parser.js |   70.16 |    73.39 |   51.43 |   70.16 | ...2913,2917-2923,2929-2930 
  static-net-filtering.js    |   78.34 |    90.09 |   58.74 |   78.34 | ...4433,4472-4497,4539-4587 
  text-utils.js              |    72.9 |    83.33 |      30 |    72.9 | ...,77-81,83-86,88-95,97-98 
  uri-utils.js               |   64.61 |    78.95 |   27.27 |   64.61 | ...,130-135,137-139,141-165 
-----------------------------|---------|----------|---------|---------|-----------------------------